summaryrefslogtreecommitdiff
path: root/boost/intrusive
diff options
context:
space:
mode:
Diffstat (limited to 'boost/intrusive')
-rw-r--r--boost/intrusive/any_hook.hpp86
-rw-r--r--boost/intrusive/avl_set.hpp1066
-rw-r--r--boost/intrusive/avl_set_hook.hpp132
-rw-r--r--boost/intrusive/avltree.hpp562
-rw-r--r--boost/intrusive/avltree_algorithms.hpp253
-rw-r--r--boost/intrusive/bs_set_hook.hpp132
-rw-r--r--boost/intrusive/circular_list_algorithms.hpp176
-rw-r--r--boost/intrusive/circular_slist_algorithms.hpp136
-rw-r--r--boost/intrusive/derivation_value_traits.hpp8
-rw-r--r--boost/intrusive/detail/any_node_and_algorithms.hpp20
-rw-r--r--boost/intrusive/detail/assert.hpp4
-rw-r--r--boost/intrusive/detail/avltree_node.hpp8
-rw-r--r--boost/intrusive/detail/clear_on_destructor_base.hpp2
-rw-r--r--boost/intrusive/detail/common_slist_algorithms.hpp18
-rw-r--r--boost/intrusive/detail/config_begin.hpp6
-rw-r--r--boost/intrusive/detail/config_end.hpp2
-rw-r--r--boost/intrusive/detail/ebo_functor_holder.hpp2
-rw-r--r--boost/intrusive/detail/function_detector.hpp6
-rw-r--r--boost/intrusive/detail/generic_hook.hpp16
-rw-r--r--boost/intrusive/detail/has_member_function_callable_with.hpp30
-rw-r--r--boost/intrusive/detail/hashtable_node.hpp10
-rw-r--r--boost/intrusive/detail/is_stateful_value_traits.hpp2
-rw-r--r--boost/intrusive/detail/list_node.hpp28
-rw-r--r--boost/intrusive/detail/memory_util.hpp23
-rw-r--r--boost/intrusive/detail/mpl.hpp24
-rw-r--r--boost/intrusive/detail/parent_from_member.hpp38
-rw-r--r--boost/intrusive/detail/preprocessor.hpp4
-rw-r--r--boost/intrusive/detail/rbtree_node.hpp8
-rw-r--r--boost/intrusive/detail/slist_node.hpp24
-rw-r--r--boost/intrusive/detail/transform_iterator.hpp4
-rw-r--r--boost/intrusive/detail/tree_algorithms.hpp410
-rw-r--r--boost/intrusive/detail/tree_node.hpp30
-rw-r--r--boost/intrusive/detail/utilities.hpp20
-rw-r--r--boost/intrusive/detail/workaround.hpp2
-rw-r--r--boost/intrusive/hashtable.hpp480
-rw-r--r--boost/intrusive/intrusive_fwd.hpp2
-rw-r--r--boost/intrusive/linear_slist_algorithms.hpp108
-rw-r--r--boost/intrusive/link_mode.hpp6
-rw-r--r--boost/intrusive/list.hpp520
-rw-r--r--boost/intrusive/list_hook.hpp134
-rw-r--r--boost/intrusive/member_value_traits.hpp10
-rw-r--r--boost/intrusive/options.hpp12
-rw-r--r--boost/intrusive/parent_from_member.hpp6
-rw-r--r--boost/intrusive/pointer_plus_bits.hpp8
-rw-r--r--boost/intrusive/pointer_traits.hpp8
-rw-r--r--boost/intrusive/rbtree.hpp568
-rw-r--r--boost/intrusive/rbtree_algorithms.hpp275
-rw-r--r--boost/intrusive/set.hpp1078
-rw-r--r--boost/intrusive/set_hook.hpp136
-rw-r--r--boost/intrusive/sg_set.hpp1106
-rw-r--r--boost/intrusive/sgtree.hpp602
-rw-r--r--boost/intrusive/sgtree_algorithms.hpp247
-rw-r--r--boost/intrusive/slist.hpp680
-rw-r--r--boost/intrusive/slist_hook.hpp140
-rw-r--r--boost/intrusive/splay_set.hpp1098
-rw-r--r--boost/intrusive/splay_set_hook.hpp136
-rw-r--r--boost/intrusive/splaytree.hpp576
-rw-r--r--boost/intrusive/splaytree_algorithms.hpp251
-rw-r--r--boost/intrusive/treap.hpp594
-rw-r--r--boost/intrusive/treap_algorithms.hpp241
-rw-r--r--boost/intrusive/treap_set.hpp1166
-rw-r--r--boost/intrusive/trivial_value_traits.hpp6
-rw-r--r--boost/intrusive/unordered_set.hpp854
-rw-r--r--boost/intrusive/unordered_set_hook.hpp146
64 files changed, 8029 insertions, 6457 deletions
diff --git a/boost/intrusive/any_hook.hpp b/boost/intrusive/any_hook.hpp
index cccc820e7d..7d60de001a 100644
--- a/boost/intrusive/any_hook.hpp
+++ b/boost/intrusive/any_hook.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -50,7 +50,7 @@ struct make_any_base_hook
Options...
#endif
>::type packed_options;
-
+
typedef detail::generic_hook
< get_any_node_algo<typename packed_options::void_pointer>
, 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
//! in an intrusive container.
-//!
+//!
//! The hook admits the following options: \c tag<>, \c void_pointer<> and
//! \c link_mode<>.
//!
-//! \c tag<> defines a tag to identify the node.
-//! 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
+//! \c tag<> defines a tag to identify the node.
+//! 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
//! unique tag.
//!
//! \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:
//! <b>Effects</b>: If link_mode is or \c safe_link
//! initializes the node to an unlinked state.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
any_base_hook();
//! <b>Effects</b>: If link_mode is or \c safe_link
//! 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
- //! 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
//! move-semantics.
any_base_hook(const any_base_hook& );
//! <b>Effects</b>: Empty function. The argument is ignored.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Rationale</b>: Providing an assignment operator
- //! makes classes using the hook STL-compliant without forcing the
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Rationale</b>: Providing an assignment operator
+ //! makes classes using the hook STL-compliant without forcing the
//! user to do some additional work. \c swap can be used to emulate
//! move-semantics.
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
//! 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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
~any_base_hook();
//! <b>Precondition</b>: link_mode must be \c safe_link.
//!
//! <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
- //! will return a valid iterator.
+ //! otherwise. This function can be used to test whether \c container::iterator_to
+ //! will return a valid iterator.
//!
- //! <b>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
bool is_linked() const;
#endif
};
@@ -148,7 +148,7 @@ struct make_any_member_hook
{
/// @cond
typedef typename pack_options
- < hook_defaults,
+ < hook_defaults,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3
#else
@@ -168,10 +168,10 @@ struct make_any_member_hook
//! Store this hook in a class to be inserted
//! in an intrusive container.
-//!
+//!
//! The hook admits the following options: \c void_pointer<> and
//! \c link_mode<>.
-//!
+//!
//! \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
@@ -194,27 +194,27 @@ class any_member_hook
public:
//! <b>Effects</b>: If link_mode is or \c safe_link
//! initializes the node to an unlinked state.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
any_member_hook();
//! <b>Effects</b>: If link_mode is or \c safe_link
//! 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
- //! 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
//! move-semantics.
any_member_hook(const any_member_hook& );
//! <b>Effects</b>: Empty function. The argument is ignored.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Rationale</b>: Providing an assignment operator
- //! makes classes using the hook STL-compliant without forcing the
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Rationale</b>: Providing an assignment operator
+ //! makes classes using the hook STL-compliant without forcing the
//! user to do some additional work. \c swap can be used to emulate
//! move-semantics.
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
//! 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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
~any_member_hook();
//! <b>Precondition</b>: link_mode must be \c safe_link.
//!
//! <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
- //! will return a valid iterator.
+ //! otherwise. This function can be used to test whether \c container::iterator_to
+ //! will return a valid iterator.
//!
- //! <b>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
bool is_linked() const;
#endif
};
@@ -336,8 +336,8 @@ struct any_to_unordered_set_hook
{};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/avl_set.hpp b/boost/intrusive/avl_set.hpp
index 92baf473ce..91e2dbbdf0 100644
--- a/boost/intrusive/avl_set.hpp
+++ b/boost/intrusive/avl_set.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -22,9 +22,9 @@
namespace boost {
namespace intrusive {
-//! The class template avl_set is an intrusive container, that mimics most of
+//! The class template avl_set is an intrusive container, that mimics most of
//! the interface of std::set as described in the C++ standard.
-//!
+//!
//! The template parameter \c T is the type to be managed by the container.
//! The user can specify additional options and if no options are provided
//! default options are used.
@@ -79,30 +79,30 @@ class avl_set_impl
/// @endcond
public:
- //! <b>Effects</b>: Constructs an empty avl_set.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //! <b>Effects</b>: Constructs an empty avl_set.
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor of the value_compare object throws.
+ //! or the copy constructor of the value_compare object throws.
avl_set_impl( const value_compare &cmp = value_compare()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: tree_(cmp, v_traits)
{}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
//! cmp must be a comparison function that induces a strict weak ordering.
- //!
- //! <b>Effects</b>: Constructs an empty avl_set and inserts elements from
+ //!
+ //! <b>Effects</b>: Constructs an empty avl_set and inserts elements from
//! [b, e).
- //!
- //! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
+ //!
+ //! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
//! comp and otherwise N * log N, where N is std::distance(last, first).
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor/operator() of the value_compare object throws.
+ //! or the copy constructor/operator() of the value_compare object throws.
template<class Iterator>
avl_set_impl( Iterator b, Iterator e
, const value_compare &cmp = value_compare()
@@ -111,135 +111,135 @@ class avl_set_impl
{}
//! <b>Effects</b>: to-do
- //!
- avl_set_impl(BOOST_RV_REF(avl_set_impl) x)
+ //!
+ avl_set_impl(BOOST_RV_REF(avl_set_impl) x)
: tree_(::boost::move(x.tree_))
{}
//! <b>Effects</b>: to-do
- //!
- avl_set_impl& operator=(BOOST_RV_REF(avl_set_impl) x)
+ //!
+ avl_set_impl& operator=(BOOST_RV_REF(avl_set_impl) x)
{ tree_ = ::boost::move(x.tree_); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the avl_set
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the avl_set
//! are not deleted (i.e. no destructors are called).
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- ~avl_set_impl()
+ ~avl_set_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the avl_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the avl_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the avl_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return tree_.cbegin(); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the avl_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the avl_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the avl_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return tree_.cend(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
//! reversed avl_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rbegin()
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed avl_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rbegin() const
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed avl_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crbegin() const
{ return tree_.crbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed avl_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rend()
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed avl_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rend() const
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed avl_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crend() const
{ return tree_.crend(); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of avl_set.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the avl_set associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static avl_set_impl &container_from_end_iterator(iterator end_iterator)
{
@@ -250,11 +250,11 @@ class avl_set_impl
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of avl_set.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the set associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const avl_set_impl &container_from_end_iterator(const_iterator end_iterator)
{
@@ -264,11 +264,11 @@ class avl_set_impl
}
//! <b>Precondition</b>: it must be a valid iterator of set.
- //!
+ //!
//! <b>Effects</b>: Returns a reference to the set associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static avl_set_impl &container_from_iterator(iterator it)
{
@@ -278,11 +278,11 @@ class avl_set_impl
}
//! <b>Precondition</b>: it must be a valid const_iterator of set.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the set associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static const avl_set_impl &container_from_iterator(const_iterator it)
{
@@ -292,42 +292,42 @@ class avl_set_impl
}
//! <b>Effects</b>: Returns the key_compare object used by the avl_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If key_compare copy-constructor throws.
key_compare key_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns the value_compare object used by the avl_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If value_compare copy-constructor throws.
value_compare value_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns true is the container is empty.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return tree_.empty(); }
//! <b>Effects</b>: Returns the number of elements stored in the avl_set.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this if,
//! constant-time size option is enabled. Constant-time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{ return tree_.size(); }
//! <b>Effects</b>: Swaps the contents of two sets.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the swap() call for the comparison functor
//! found using ADL throws. Strong guarantee.
void swap(avl_set_impl& other)
@@ -337,22 +337,22 @@ class avl_set_impl
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const avl_set_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Treaps to inserts value into the avl_set.
//!
//! <b>Returns</b>: If the value
@@ -360,39 +360,39 @@ class avl_set_impl
//! iterator to the new value and true. If there is an equivalent value
//! returns a pair containing an iterator to the already present value
//! and false.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
std::pair<iterator, bool> insert(reference value)
{ return tree_.insert_unique(value); }
//! <b>Requires</b>: value must be an lvalue
- //!
- //! <b>Effects</b>: Treaps to to insert x into the avl_set, using "hint"
+ //!
+ //! <b>Effects</b>: Treaps to to insert x into the avl_set, using "hint"
//! as a hint to where it will be inserted.
//!
- //! <b>Returns</b>: An iterator that points to the position where the
+ //! <b>Returns</b>: An iterator that points to the position where the
//! new element was inserted into the avl_set.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it's amortized
//! constant time if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert(const_iterator hint, reference value)
{ return tree_.insert_unique(hint, value); }
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare. The difference is that
//! key_value_comp compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the avl_set, using
//! a user provided key instead of the value itself.
//!
@@ -401,16 +401,16 @@ class avl_set_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic.
//!
//! <b>Throws</b>: If the key_value_comp ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! node that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that
+ //! than the value_type and this function offers the possibility to use that
//! part to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
@@ -424,12 +424,12 @@ class avl_set_impl
(const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data)
{ return tree_.insert_unique_check(key, key_value_comp, commit_data); }
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare. The difference is that
//! key_value_comp compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the avl_set, using
- //! a user provided key instead of the value itself, using "hint"
+ //! a user provided key instead of the value itself, using "hint"
//! as a hint to where it will be inserted.
//!
//! <b>Returns</b>: If there is an equivalent value
@@ -437,23 +437,23 @@ class avl_set_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it's amortized
//! constant time if t is inserted immediately before hint.
//!
//! <b>Throws</b>: If the key_value_comp ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! constructing that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that key
+ //! than the value_type and this function offers the possibility to use that key
//! to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
//! "insert_commit" to insert the object in constant-time. This can give a total
//! constant-time complexity to the insertion: check(O(1)) + commit(O(1)).
- //!
+ //!
//! "commit_data" remains valid for a subsequent "insert_commit" only if no more
//! objects are inserted or erased from the avl_set.
template<class KeyType, class KeyValueCompare>
@@ -466,33 +466,33 @@ class avl_set_impl
//! must have been obtained from a previous call to "insert_check".
//! No objects should have been inserted or erased from the avl_set between
//! the "insert_check" that filled "commit_data" and the call to "insert_commit".
- //!
+ //!
//! <b>Effects</b>: Inserts the value in the avl_set using the information obtained
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Returns</b>: An iterator to the newly inserted object.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function has only sense if a "insert_check" has been
//! previously executed to fill "commit_data". No value should be inserted or
//! erased between the "insert_check" and "insert_commit" calls.
iterator insert_commit(reference value, const insert_commit_data &commit_data)
{ return tree_.insert_unique_commit(value, commit_data); }
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Inserts a range into the avl_set.
- //!
+ //!
//! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
//! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -505,11 +505,11 @@ class avl_set_impl
//! inserted key according to the predicate.
//!
//! <b>Effects</b>: Inserts x into the tree before "pos".
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if "pos" is not
//! the successor of "value" or "value" is not unique tree ordering and uniqueness
//! invariants will be broken respectively.
@@ -522,11 +522,11 @@ class avl_set_impl
//! any inserted key according to the predicate.
//!
//! <b>Effects</b>: Inserts x into the tree in the last position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! less than or equal to the greatest inserted key tree ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -539,11 +539,11 @@ class avl_set_impl
//! than any inserted key according to the predicate.
//!
//! <b>Effects</b>: Inserts x into the tree in the first position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! greater than or equal to the the mimum inserted key tree ordering or uniqueness
//! invariants will be broken.
@@ -553,41 +553,41 @@ class avl_set_impl
void push_front(reference value)
{ tree_.push_front(value); }
- //! <b>Effects</b>: Erases the element pointed to by pos.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by pos.
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Returns</b>: An iterator to the element after the erased element.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator i)
{ return tree_.erase(i); }
- //! <b>Effects</b>: Erases the range pointed to by b end e.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Returns</b>: An iterator to the element after the erased elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator b, const_iterator e)
{ return tree_.erase(b, e); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size()) + this->count(value)).
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
@@ -595,13 +595,13 @@ class avl_set_impl
//! <b>Effects</b>: Erases all the elements that compare equal with
//! the given key and the given comparison functor.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If the comp ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyValueCompare>
@@ -614,16 +614,16 @@ class avl_set_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Erases the element pointed to by pos.
+ //! <b>Effects</b>: Erases the element pointed to by pos.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Returns</b>: An iterator to the element after the erased element.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
@@ -639,14 +639,14 @@ class avl_set_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Returns</b>: An iterator to the element after the erased elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -657,13 +657,13 @@ class avl_set_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(value)). Basic guarantee.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -677,11 +677,11 @@ class avl_set_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyValueCompare, class Disposer>
@@ -693,26 +693,26 @@ class avl_set_impl
{ return tree_.erase_and_dispose(key, comp, disposer); }
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
{ return tree_.clear(); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
- //!
+ //!
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -720,20 +720,20 @@ class avl_set_impl
{ return tree_.clear_and_dispose(disposer); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
size_type count(const_reference value) const
{ return tree_.find(value) != end(); }
//! <b>Effects</b>: Returns the number of contained elements with the same key
//! compared with the given comparison functor.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
template<class KeyType, class KeyValueCompare>
size_type count(const KeyType& key, KeyValueCompare comp) const
@@ -741,9 +741,9 @@ class avl_set_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator lower_bound(const_reference value)
{ return tree_.lower_bound(value); }
@@ -753,13 +753,13 @@ class avl_set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -769,9 +769,9 @@ class avl_set_impl
//! <b>Effects</b>: Returns a const iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator lower_bound(const_reference value) const
{ return tree_.lower_bound(value); }
@@ -781,13 +781,13 @@ class avl_set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -797,9 +797,9 @@ class avl_set_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator upper_bound(const_reference value)
{ return tree_.upper_bound(value); }
@@ -809,11 +809,11 @@ class avl_set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -825,9 +825,9 @@ class avl_set_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator upper_bound(const_reference value) const
{ return tree_.upper_bound(value); }
@@ -837,11 +837,11 @@ class avl_set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -851,11 +851,11 @@ class avl_set_impl
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const
{ return tree_.upper_bound(key, comp); }
- //! <b>Effects</b>: Finds an iterator to the first element whose value is
+ //! <b>Effects</b>: Finds an iterator to the first element whose value is
//! "value" or end() if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator find(const_reference value)
{ return tree_.find(value); }
@@ -864,12 +864,12 @@ class avl_set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -879,11 +879,11 @@ class avl_set_impl
iterator find(const KeyType& key, KeyValueCompare comp)
{ return tree_.find(key, comp); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
//! "value" or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator find(const_reference value) const
{ return tree_.find(value); }
@@ -892,12 +892,12 @@ class avl_set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -910,9 +910,9 @@ class avl_set_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return tree_.equal_range(value); }
@@ -921,13 +921,13 @@ class avl_set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -940,9 +940,9 @@ class avl_set_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<const_iterator, const_iterator>
equal_range(const_reference value) const
@@ -952,13 +952,13 @@ class avl_set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -969,16 +969,101 @@ class avl_set_impl
equal_range(const KeyType& key, KeyValueCompare comp) const
{ return tree_.equal_range(key, comp); }
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator, const_iterator>
+ bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator, const_iterator>
+ bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: value must be an lvalue and shall be in a avl_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the avl_set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
@@ -986,14 +1071,14 @@ class avl_set_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a avl_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! avl_set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static const_iterator s_iterator_to(const_reference value)
@@ -1001,48 +1086,48 @@ class avl_set_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a avl_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the avl_set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator iterator_to(reference value)
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value must be an lvalue and shall be in a avl_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! avl_set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator iterator_to(const_reference value) const
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value shall not be in a avl_set/avl_multiset.
- //!
+ //!
//! <b>Effects</b>: init_node puts the hook of a value in a well-known default
//! state.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This function puts the hook in the well-known default state
//! used by auto_unlink and safe hooks.
static void init_node(reference value)
{ tree_type::init_node(value); }
//! <b>Effects</b>: Unlinks the leftmost node from the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! This function is normally used to achieve a step by step
@@ -1052,14 +1137,14 @@ class avl_set_impl
//! <b>Requires</b>: replace_this must be a valid iterator of *this
//! and with_this must not be inserted in any tree.
- //!
+ //!
//! <b>Effects</b>: Replaces replace_this in its position in the
//! tree with with_this. The tree does not need to be rebalanced.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! with_this is not equivalent to *replace_this according to the
//! ordering rules. This function is faster than erasing and inserting
@@ -1233,9 +1318,9 @@ class avl_set
#endif
-//! The class template avl_multiset is an intrusive container, that mimics most of
+//! The class template avl_multiset is an intrusive container, that mimics most of
//! the interface of std::avl_multiset as described in the C++ standard.
-//!
+//!
//! The template parameter \c T is the type to be managed by the container.
//! The user can specify additional options and if no options are provided
//! default options are used.
@@ -1289,30 +1374,30 @@ class avl_multiset_impl
/// @endcond
public:
- //! <b>Effects</b>: Constructs an empty avl_multiset.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //! <b>Effects</b>: Constructs an empty avl_multiset.
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor/operator() of the value_compare object throws.
+ //! or the copy constructor/operator() of the value_compare object throws.
avl_multiset_impl( const value_compare &cmp = value_compare()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: tree_(cmp, v_traits)
{}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
//! cmp must be a comparison function that induces a strict weak ordering.
- //!
- //! <b>Effects</b>: Constructs an empty avl_multiset and inserts elements from
+ //!
+ //! <b>Effects</b>: Constructs an empty avl_multiset and inserts elements from
//! [b, e).
- //!
+ //!
//! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
//! comp and otherwise N * log N, where N is the distance between first and last
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor/operator() of the value_compare object throws.
+ //! or the copy constructor/operator() of the value_compare object throws.
template<class Iterator>
avl_multiset_impl( Iterator b, Iterator e
, const value_compare &cmp = value_compare()
@@ -1321,135 +1406,135 @@ class avl_multiset_impl
{}
//! <b>Effects</b>: to-do
- //!
- avl_multiset_impl(BOOST_RV_REF(avl_multiset_impl) x)
+ //!
+ avl_multiset_impl(BOOST_RV_REF(avl_multiset_impl) x)
: tree_(::boost::move(x.tree_))
{}
//! <b>Effects</b>: to-do
- //!
- avl_multiset_impl& operator=(BOOST_RV_REF(avl_multiset_impl) x)
+ //!
+ avl_multiset_impl& operator=(BOOST_RV_REF(avl_multiset_impl) x)
{ tree_ = ::boost::move(x.tree_); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the avl_multiset
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the avl_multiset
//! are not deleted (i.e. no destructors are called).
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- ~avl_multiset_impl()
+ ~avl_multiset_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the avl_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the avl_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the avl_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return tree_.cbegin(); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the avl_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the avl_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the avl_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return tree_.cend(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
//! reversed avl_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rbegin()
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed avl_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rbegin() const
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed avl_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crbegin() const
{ return tree_.crbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed avl_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rend()
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed avl_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rend() const
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed avl_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crend() const
{ return tree_.crend(); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of avl_multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the avl_multiset associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static avl_multiset_impl &container_from_end_iterator(iterator end_iterator)
{
@@ -1460,11 +1545,11 @@ class avl_multiset_impl
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of avl_multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the avl_multiset associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const avl_multiset_impl &container_from_end_iterator(const_iterator end_iterator)
{
@@ -1474,11 +1559,11 @@ class avl_multiset_impl
}
//! <b>Precondition</b>: it must be a valid iterator of multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the multiset associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static avl_multiset_impl &container_from_iterator(iterator it)
{
@@ -1488,11 +1573,11 @@ class avl_multiset_impl
}
//! <b>Precondition</b>: it must be a valid const_iterator of multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the multiset associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static const avl_multiset_impl &container_from_iterator(const_iterator it)
{
@@ -1502,42 +1587,42 @@ class avl_multiset_impl
}
//! <b>Effects</b>: Returns the key_compare object used by the avl_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If key_compare copy-constructor throws.
key_compare key_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns the value_compare object used by the avl_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If value_compare copy-constructor throws.
value_compare value_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns true is the container is empty.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return tree_.empty(); }
//! <b>Effects</b>: Returns the number of elements stored in the avl_multiset.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this if,
//! constant-time size option is enabled. Constant-time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{ return tree_.size(); }
//! <b>Effects</b>: Swaps the contents of two avl_multisets.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the swap() call for the comparison functor
//! found using ADL throws. Strong guarantee.
void swap(avl_multiset_impl& other)
@@ -1547,69 +1632,69 @@ class avl_multiset_impl
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const avl_multiset_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts value into the avl_multiset.
- //!
+ //!
//! <b>Returns</b>: An iterator that points to the position where the new
//! element was inserted.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert(reference value)
{ return tree_.insert_equal(value); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts x into the avl_multiset, using pos as a hint to
//! where it will be inserted.
- //!
+ //!
//! <b>Returns</b>: An iterator that points to the position where the new
//! element was inserted.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert(const_iterator hint, reference value)
{ return tree_.insert_equal(hint, value); }
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Inserts a range into the avl_multiset.
- //!
+ //!
//! <b>Returns</b>: An iterator that points to the position where the new
//! element was inserted.
- //!
+ //!
//! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
//! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -1622,11 +1707,11 @@ class avl_multiset_impl
//! inserted key according to the predicate.
//!
//! <b>Effects</b>: Inserts x into the tree before "pos".
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if "pos" is not
//! the successor of "value" or "value" is not unique tree ordering and uniqueness
//! invariants will be broken respectively.
@@ -1639,11 +1724,11 @@ class avl_multiset_impl
//! any inserted key according to the predicate.
//!
//! <b>Effects</b>: Inserts x into the tree in the last position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! less than or equal to the greatest inserted key tree ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -1656,11 +1741,11 @@ class avl_multiset_impl
//! than any inserted key according to the predicate.
//!
//! <b>Effects</b>: Inserts x into the tree in the first position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! greater than or equal to the the mimum inserted key tree ordering or uniqueness
//! invariants will be broken.
@@ -1670,41 +1755,41 @@ class avl_multiset_impl
void push_front(reference value)
{ tree_.push_front(value); }
- //! <b>Effects</b>: Erases the element pointed to by pos.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by pos.
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Returns</b>: An iterator to the element after the erased element.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator i)
{ return tree_.erase(i); }
- //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
//!
//! <b>Returns</b>: An iterator to the element after the erased elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator b, const_iterator e)
{ return tree_.erase(b, e); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(value)).
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
@@ -1712,13 +1797,13 @@ class avl_multiset_impl
//! <b>Effects</b>: Erases all the elements that compare equal with
//! the given key and the given comparison functor.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyValueCompare>
@@ -1733,14 +1818,14 @@ class avl_multiset_impl
//!
//! <b>Returns</b>: An iterator to the element after the erased element.
//!
- //! <b>Effects</b>: Erases the element pointed to by pos.
+ //! <b>Effects</b>: Erases the element pointed to by pos.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
@@ -1758,12 +1843,12 @@ class avl_multiset_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -1774,13 +1859,13 @@ class avl_multiset_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(value)).
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -1794,11 +1879,11 @@ class avl_multiset_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyValueCompare, class Disposer>
@@ -1810,26 +1895,26 @@ class avl_multiset_impl
{ return tree_.erase_and_dispose(key, comp, disposer); }
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
{ return tree_.clear(); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
- //!
+ //!
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -1837,20 +1922,20 @@ class avl_multiset_impl
{ return tree_.clear_and_dispose(disposer); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
size_type count(const_reference value) const
{ return tree_.count(value); }
//! <b>Effects</b>: Returns the number of contained elements with the same key
//! compared with the given comparison functor.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
template<class KeyType, class KeyValueCompare>
size_type count(const KeyType& key, KeyValueCompare comp) const
@@ -1858,9 +1943,9 @@ class avl_multiset_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator lower_bound(const_reference value)
{ return tree_.lower_bound(value); }
@@ -1870,13 +1955,13 @@ class avl_multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -1886,9 +1971,9 @@ class avl_multiset_impl
//! <b>Effects</b>: Returns a const iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator lower_bound(const_reference value) const
{ return tree_.lower_bound(value); }
@@ -1898,13 +1983,13 @@ class avl_multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -1914,9 +1999,9 @@ class avl_multiset_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator upper_bound(const_reference value)
{ return tree_.upper_bound(value); }
@@ -1926,11 +2011,11 @@ class avl_multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1942,9 +2027,9 @@ class avl_multiset_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator upper_bound(const_reference value) const
{ return tree_.upper_bound(value); }
@@ -1954,11 +2039,11 @@ class avl_multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1968,11 +2053,11 @@ class avl_multiset_impl
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const
{ return tree_.upper_bound(key, comp); }
- //! <b>Effects</b>: Finds an iterator to the first element whose value is
+ //! <b>Effects</b>: Finds an iterator to the first element whose value is
//! "value" or end() if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator find(const_reference value)
{ return tree_.find(value); }
@@ -1981,12 +2066,12 @@ class avl_multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1996,11 +2081,11 @@ class avl_multiset_impl
iterator find(const KeyType& key, KeyValueCompare comp)
{ return tree_.find(key, comp); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
//! "value" or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator find(const_reference value) const
{ return tree_.find(value); }
@@ -2009,12 +2094,12 @@ class avl_multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2027,9 +2112,9 @@ class avl_multiset_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return tree_.equal_range(value); }
@@ -2038,13 +2123,13 @@ class avl_multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2057,9 +2142,9 @@ class avl_multiset_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<const_iterator, const_iterator>
equal_range(const_reference value) const
@@ -2069,13 +2154,13 @@ class avl_multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2086,16 +2171,101 @@ class avl_multiset_impl
equal_range(const KeyType& key, KeyValueCompare comp) const
{ return tree_.equal_range(key, comp); }
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator, const_iterator>
+ bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator, const_iterator>
+ bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: value must be an lvalue and shall be in a avl_multiset of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the avl_multiset
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
@@ -2103,14 +2273,14 @@ class avl_multiset_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a avl_multiset of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! avl_multiset that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static const_iterator s_iterator_to(const_reference value)
@@ -2118,48 +2288,48 @@ class avl_multiset_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a avl_multiset of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the avl_multiset
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator iterator_to(reference value)
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value must be an lvalue and shall be in a avl_multiset of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! avl_multiset that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator iterator_to(const_reference value) const
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value shall not be in a avl_multiset/avl_multiset.
- //!
+ //!
//! <b>Effects</b>: init_node puts the hook of a value in a well-known default
//! state.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This function puts the hook in the well-known default state
//! used by auto_unlink and safe hooks.
static void init_node(reference value)
{ tree_type::init_node(value); }
//! <b>Effects</b>: Unlinks the leftmost node from the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! This function is normally used to achieve a step by step
@@ -2169,14 +2339,14 @@ class avl_multiset_impl
//! <b>Requires</b>: replace_this must be a valid iterator of *this
//! and with_this must not be inserted in any tree.
- //!
+ //!
//! <b>Effects</b>: Replaces replace_this in its position in the
//! tree with with_this. The tree does not need to be rebalanced.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! with_this is not equivalent to *replace_this according to the
//! ordering rules. This function is faster than erasing and inserting
@@ -2290,7 +2460,7 @@ template<class T, class O1, class O2, class O3, class O4>
template<class T, class ...Options>
#endif
class avl_multiset
- : public make_avl_multiset<T,
+ : public make_avl_multiset<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -2350,8 +2520,8 @@ class avl_multiset
#endif
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/avl_set_hook.hpp b/boost/intrusive/avl_set_hook.hpp
index 23b1f0bd8f..825921f509 100644
--- a/boost/intrusive/avl_set_hook.hpp
+++ b/boost/intrusive/avl_set_hook.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -61,16 +61,16 @@ struct make_avl_set_base_hook
typedef implementation_defined type;
};
-//! 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
+//! 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
//! 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<>,
//! \c link_mode<> and \c optimize_size<>.
//!
-//! \c tag<> defines a tag to identify the node.
-//! 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
+//! \c tag<> defines a tag to identify the node.
+//! 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
//! unique tag.
//!
//! \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:
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
avl_set_base_hook();
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
- //!
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
//! <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
//! move-semantics.
avl_set_base_hook(const avl_set_base_hook& );
//! <b>Effects</b>: Empty function. The argument is ignored.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Rationale</b>: Providing an assignment operator
- //! makes classes using the hook STL-compliant without forcing the
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Rationale</b>: Providing an assignment operator
+ //! makes classes using the hook STL-compliant without forcing the
//! user to do some additional work. \c swap can be used to emulate
//! move-semantics.
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
//! 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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
~avl_set_base_hook();
- //! <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
- //! 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
- //! 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
- //! after the swap-operation the other element is not in a container.
- //! Iterators to e1 and e2 related to those nodes are invalidated.
+ //! <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
+ //! 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
+ //! 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
+ //! after the swap-operation the other element is not in a container.
+ //! 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);
//! <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
- //! otherwise. This function can be used to test whether \c set::iterator_to
- //! will return a valid iterator.
+ //! otherwise. This function can be used to test whether \c set::iterator_to
+ //! will return a valid iterator.
//!
- //! <b>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
bool is_linked() const;
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
void unlink();
#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
//! 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.
-//!
+//!
//! The hook admits the following options: \c void_pointer<>,
//! \c link_mode<> and \c optimize_size<>.
//!
@@ -225,27 +225,27 @@ class avl_set_member_hook
public:
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
avl_set_member_hook();
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
- //!
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
//! <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
//! move-semantics.
avl_set_member_hook(const avl_set_member_hook& );
//! <b>Effects</b>: Empty function. The argument is ignored.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Rationale</b>: Providing an assignment operator
- //! makes classes using the hook STL-compliant without forcing the
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Rationale</b>: Providing an assignment operator
+ //! makes classes using the hook STL-compliant without forcing the
//! user to do some additional work. \c swap can be used to emulate
//! move-semantics.
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
//! 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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
~avl_set_member_hook();
- //! <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
- //! 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
- //! 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
- //! after the swap-operation the other element is not in a container.
- //! Iterators to e1 and e2 related to those nodes are invalidated.
+ //! <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
+ //! 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
+ //! 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
+ //! after the swap-operation the other element is not in a container.
+ //! 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);
//! <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
- //! otherwise. This function can be used to test whether \c set::iterator_to
- //! will return a valid iterator.
+ //! otherwise. This function can be used to test whether \c set::iterator_to
+ //! will return a valid iterator.
//!
- //! <b>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
bool is_linked() const;
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
void unlink();
#endif
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/avltree.hpp b/boost/intrusive/avltree.hpp
index 20903ddef7..84376a87c7 100644
--- a/boost/intrusive/avltree.hpp
+++ b/boost/intrusive/avltree.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -65,7 +65,7 @@ struct avl_set_defaults
//! The class template avltree is an intrusive AVL tree container, that
//! is used to construct intrusive avl_set and avl_multiset containers.
-//! The no-throw guarantee holds only, if the value_compare object
+//! The no-throw guarantee holds only, if the value_compare object
//! doesn't throw.
//!
//! The template parameter \c T is the type to be managed by the container.
@@ -134,7 +134,7 @@ class avltree_impl
//noncopyable, movable
BOOST_MOVABLE_BUT_NOT_COPYABLE(avltree_impl)
- enum { safemode_or_autounlink =
+ enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
(int)real_value_traits::link_mode == (int)safe_link };
@@ -160,7 +160,7 @@ class avltree_impl
{}
node_plus_pred_t node_plus_pred_;
} data_;
-
+
const value_compare &priv_comp() const
{ return data_.node_plus_pred_.get(); }
@@ -212,18 +212,18 @@ class avltree_impl
typedef typename node_algorithms::insert_commit_data insert_commit_data;
- //! <b>Effects</b>: Constructs an empty tree.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //! <b>Effects</b>: Constructs an empty tree.
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or the copy constructor of the value_compare object throws. Basic guarantee.
avltree_impl( const value_compare &cmp = value_compare()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: data_(cmp, v_traits)
- {
- node_algorithms::init_header(this->priv_header_ptr());
+ {
+ node_algorithms::init_header(this->priv_header_ptr());
this->priv_size_traits().set_size(size_type(0));
}
@@ -235,7 +235,7 @@ class avltree_impl
//!
//! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
//! comp and otherwise N * log N, where N is the distance between first and last.
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or the copy constructor/operator() of the value_compare object throws. Basic guarantee.
@@ -254,58 +254,58 @@ class avltree_impl
}
//! <b>Effects</b>: to-do
- //!
+ //!
avltree_impl(BOOST_RV_REF(avltree_impl) x)
: data_(::boost::move(x.priv_comp()), ::boost::move(x.priv_value_traits()))
{
- node_algorithms::init_header(this->priv_header_ptr());
+ node_algorithms::init_header(this->priv_header_ptr());
this->priv_size_traits().set_size(size_type(0));
this->swap(x);
}
//! <b>Effects</b>: to-do
- //!
- avltree_impl& operator=(BOOST_RV_REF(avltree_impl) x)
+ //!
+ avltree_impl& operator=(BOOST_RV_REF(avltree_impl) x)
{ this->swap(x); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the set
- //! are not deleted (i.e. no destructors are called), but the nodes according to
- //! the value_traits template parameter are reinitialized and thus can be reused.
- //!
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the set
+ //! are not deleted (i.e. no destructors are called), but the nodes according to
+ //! the value_traits template parameter are reinitialized and thus can be reused.
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- ~avltree_impl()
+ ~avltree_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return iterator (node_traits::get_left(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return cbegin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return const_iterator (node_traits::get_left(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return iterator (this->priv_header_ptr(), this); }
@@ -313,138 +313,138 @@ class avltree_impl
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the tree.
//!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return cend(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return const_iterator (uncast(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
//! reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rbegin()
{ return reverse_iterator(end()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rbegin() const
{ return const_reverse_iterator(end()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crbegin() const
{ return const_reverse_iterator(end()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rend()
{ return reverse_iterator(begin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rend() const
{ return const_reverse_iterator(begin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crend() const
{ return const_reverse_iterator(begin()); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of avltree.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the avltree associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static avltree_impl &container_from_end_iterator(iterator end_iterator)
{ return priv_container_from_end_iterator(end_iterator); }
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of avltree.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the avltree associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const avltree_impl &container_from_end_iterator(const_iterator end_iterator)
{ return priv_container_from_end_iterator(end_iterator); }
//! <b>Precondition</b>: it must be a valid iterator
//! of rbtree.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the tree associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static avltree_impl &container_from_iterator(iterator it)
{ return priv_container_from_iterator(it); }
//! <b>Precondition</b>: it must be a valid end const_iterator
//! of rbtree.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the tree associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static const avltree_impl &container_from_iterator(const_iterator it)
{ return priv_container_from_iterator(it); }
//! <b>Effects</b>: Returns the value_compare object used by the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If value_compare copy-constructor throws.
value_compare value_comp() const
{ return priv_comp(); }
//! <b>Effects</b>: Returns true if the container is empty.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return node_algorithms::unique(this->priv_header_ptr()); }
//! <b>Effects</b>: Returns the number of elements stored in the tree.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this
//! if constant-time size option is disabled. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{
@@ -456,9 +456,9 @@ class avltree_impl
}
//! <b>Effects</b>: Swaps the contents of two avltrees.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the comparison functor's swap call throws.
void swap(avltree_impl& other)
{
@@ -475,14 +475,14 @@ class avltree_impl
}
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts value into the tree before the upper bound.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert_equal(reference value)
@@ -500,16 +500,16 @@ class avltree_impl
//! <b>Requires</b>: value must be an lvalue, and "hint" must be
//! a valid iterator.
- //!
+ //!
//! <b>Effects</b>: Inserts x into the tree, using "hint" as a hint to
//! where it will be inserted. If "hint" is the upper_bound
//! the insertion takes constant time (two comparisons in the worst case)
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert_equal(const_iterator hint, reference value)
@@ -525,18 +525,18 @@ class avltree_impl
return ret;
}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Inserts a each element of a range into the tree
//! before the upper bound of the key of each element.
- //!
+ //!
//! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
//! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -548,15 +548,15 @@ class avltree_impl
}
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts value into the tree if the value
//! is not already present.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
std::pair<iterator, bool> insert_unique(reference value)
@@ -570,16 +570,16 @@ class avltree_impl
//! <b>Requires</b>: value must be an lvalue, and "hint" must be
//! a valid iterator
- //!
+ //!
//! <b>Effects</b>: Tries to insert x into the tree, using "hint" as a hint
//! to where it will be inserted.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time (two comparisons in the worst case)
//! if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert_unique(const_iterator hint, reference value)
@@ -591,17 +591,17 @@ class avltree_impl
return insert_unique_commit(value, commit_data);
}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Tries to insert each element of a range into the tree.
- //!
- //! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
- //! size of the range. However, it is linear in N if the range is already sorted
+ //!
+ //! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
+ //! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -618,10 +618,10 @@ class avltree_impl
}
}
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare. The difference is that
//! key_value_comp compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the container, using
//! a user provided key instead of the value itself.
//!
@@ -630,16 +630,16 @@ class avltree_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic.
//!
//! <b>Throws</b>: If the key_value_comp ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! node that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that
+ //! than the value_type and this function offers the possibility to use that
//! part to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
@@ -654,18 +654,18 @@ class avltree_impl
{
detail::key_nodeptr_comp<KeyValueCompare, avltree_impl>
comp(key_value_comp, this);
- std::pair<node_ptr, bool> ret =
+ std::pair<node_ptr, bool> ret =
(node_algorithms::insert_unique_check
(this->priv_header_ptr(), key, comp, commit_data));
return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
}
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare. The difference is that
//! key_value_comp compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the container, using
- //! a user provided key instead of the value itself, using "hint"
+ //! a user provided key instead of the value itself, using "hint"
//! as a hint to where it will be inserted.
//!
//! <b>Returns</b>: If there is an equivalent value
@@ -673,23 +673,23 @@ class avltree_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it's amortized
//! constant time if t is inserted immediately before hint.
//!
//! <b>Throws</b>: If the key_value_comp ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! constructing that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that key
+ //! than the value_type and this function offers the possibility to use that key
//! to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
//! "insert_commit" to insert the object in constant-time. This can give a total
//! constant-time complexity to the insertion: check(O(1)) + commit(O(1)).
- //!
+ //!
//! "commit_data" remains valid for a subsequent "insert_commit" only if no more
//! objects are inserted or erased from the container.
template<class KeyType, class KeyValueCompare>
@@ -699,7 +699,7 @@ class avltree_impl
{
detail::key_nodeptr_comp<KeyValueCompare, avltree_impl>
comp(key_value_comp, this);
- std::pair<node_ptr, bool> ret =
+ std::pair<node_ptr, bool> ret =
(node_algorithms::insert_unique_check
(this->priv_header_ptr(), hint.pointed_node(), key, comp, commit_data));
return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
@@ -709,16 +709,16 @@ class avltree_impl
//! must have been obtained from a previous call to "insert_check".
//! No objects should have been inserted or erased from the container between
//! the "insert_check" that filled "commit_data" and the call to "insert_commit".
- //!
+ //!
//! <b>Effects</b>: Inserts the value in the avl_set using the information obtained
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Returns</b>: An iterator to the newly inserted object.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function has only sense if a "insert_check" has been
//! previously executed to fill "commit_data". No value should be inserted or
//! erased between the "insert_check" and "insert_commit" calls.
@@ -738,11 +738,11 @@ class avltree_impl
//! once inserted according to the predicate
//!
//! <b>Effects</b>: Inserts x into the tree before "pos".
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if "pos" is not
//! the successor of "value" tree ordering invariant will be broken.
//! This is a low-level function to be used only for performance reasons
@@ -762,11 +762,11 @@ class avltree_impl
//! than the greatest inserted key
//!
//! <b>Effects</b>: Inserts x into the tree in the last position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! less than the greatest inserted key tree ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -785,11 +785,11 @@ class avltree_impl
//! than the minimum inserted key
//!
//! <b>Effects</b>: Inserts x into the tree in the first position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! greater than the minimum inserted key tree ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -804,12 +804,12 @@ class avltree_impl
this->priv_size_traits().increment();
}
- //! <b>Effects</b>: Erases the element pointed to by pos.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by pos.
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator i)
@@ -826,26 +826,26 @@ class avltree_impl
return ret.unconst();
}
- //! <b>Effects</b>: Erases the range pointed to by b end e.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator b, const_iterator e)
{ size_type n; return private_erase(b, e, n); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
@@ -855,11 +855,11 @@ class avltree_impl
//! according to the comparison functor "comp".
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyValueCompare>
@@ -877,14 +877,14 @@ class avltree_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Erases the element pointed to by pos.
+ //! <b>Effects</b>: Erases the element pointed to by pos.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
@@ -905,12 +905,12 @@ class avltree_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -921,13 +921,13 @@ class avltree_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -946,11 +946,11 @@ class avltree_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyValueCompare, class Disposer>
@@ -966,13 +966,13 @@ class avltree_impl
return n;
}
- //! <b>Effects</b>: Erases all of the elements.
- //!
+ //! <b>Effects</b>: Erases all of the elements.
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
@@ -990,9 +990,9 @@ class avltree_impl
//! each node to be erased.
//! <b>Complexity</b>: Average complexity for is at most O(log(size() + N)),
//! where N is the number of elements in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. Calls N times to disposer functor.
template<class Disposer>
@@ -1005,19 +1005,19 @@ class avltree_impl
}
//! <b>Effects</b>: Returns the number of contained elements with the given value
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given value.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type count(const_reference value) const
{ return this->count(value, priv_comp()); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
size_type count(const KeyType &key, KeyValueCompare comp) const
@@ -1028,27 +1028,27 @@ class avltree_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator lower_bound(const_reference value)
{ return this->lower_bound(value, priv_comp()); }
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator lower_bound(const_reference value) const
{ return this->lower_bound(value, priv_comp()); }
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
iterator lower_bound(const KeyType &key, KeyValueCompare comp)
@@ -1061,9 +1061,9 @@ class avltree_impl
//! <b>Effects</b>: Returns a const iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
const_iterator lower_bound(const KeyType &key, KeyValueCompare comp) const
@@ -1076,9 +1076,9 @@ class avltree_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator upper_bound(const_reference value)
{ return this->upper_bound(value, priv_comp()); }
@@ -1088,7 +1088,7 @@ class avltree_impl
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
iterator upper_bound(const KeyType &key, KeyValueCompare comp)
@@ -1101,9 +1101,9 @@ class avltree_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator upper_bound(const_reference value) const
{ return this->upper_bound(value, priv_comp()); }
@@ -1113,7 +1113,7 @@ class avltree_impl
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
const_iterator upper_bound(const KeyType &key, KeyValueCompare comp) const
@@ -1124,20 +1124,20 @@ class avltree_impl
(this->priv_header_ptr(), key, key_node_comp), this);
}
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
//! k or end() if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator find(const_reference value)
{ return this->find(value, priv_comp()); }
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
//! k or end() if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
iterator find(const KeyType &key, KeyValueCompare comp)
@@ -1148,20 +1148,20 @@ class avltree_impl
(node_algorithms::find(this->priv_header_ptr(), key, key_node_comp), this);
}
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
//! k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator find(const_reference value) const
{ return this->find(value, priv_comp()); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
//! k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
const_iterator find(const KeyType &key, KeyValueCompare comp) const
@@ -1175,9 +1175,9 @@ class avltree_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return this->equal_range(value, priv_comp()); }
@@ -1185,9 +1185,9 @@ class avltree_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
std::pair<iterator,iterator> equal_range(const KeyType &key, KeyValueCompare comp)
@@ -1202,9 +1202,9 @@ class avltree_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
std::pair<const_iterator, const_iterator>
equal_range(const_reference value) const
@@ -1213,9 +1213,9 @@ class avltree_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
std::pair<const_iterator, const_iterator>
@@ -1228,19 +1228,117 @@ class avltree_impl
return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
}
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ {
+ detail::key_nodeptr_comp<KeyValueCompare, avltree_impl>
+ key_node_comp(comp, this);
+ std::pair<node_ptr, node_ptr> ret
+ (node_algorithms::bounded_range
+ (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed));
+ return std::pair<iterator, iterator>(iterator(ret.first, this), iterator(ret.second, this));
+ }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator,const_iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator,const_iterator> bounded_range
+ (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ {
+ detail::key_nodeptr_comp<KeyValueCompare, avltree_impl>
+ key_node_comp(comp, this);
+ std::pair<node_ptr, node_ptr> ret
+ (node_algorithms::bounded_range
+ (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed));
+ return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
+ }
+
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const avltree_impl &src, Cloner cloner, Disposer disposer)
@@ -1261,11 +1359,11 @@ class avltree_impl
}
//! <b>Effects</b>: Unlinks the leftmost node from the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! This function is normally used to achieve a step by step
@@ -1284,14 +1382,14 @@ class avltree_impl
//! <b>Requires</b>: replace_this must be a valid iterator of *this
//! and with_this must not be inserted in any tree.
- //!
+ //!
//! <b>Effects</b>: Replaces replace_this in its position in the
//! tree with with_this. The tree does not need to be rebalanced.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! with_this is not equivalent to *replace_this according to the
//! ordering rules. This function is faster than erasing and inserting
@@ -1307,14 +1405,14 @@ class avltree_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
@@ -1325,17 +1423,17 @@ class avltree_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
- static const_iterator s_iterator_to(const_reference value)
+ static const_iterator s_iterator_to(const_reference value)
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
return const_iterator (value_traits::to_node_ptr(const_cast<reference> (value)), 0);
@@ -1343,37 +1441,37 @@ class avltree_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator iterator_to(reference value)
{ return iterator (value_traits::to_node_ptr(value), this); }
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator iterator_to(const_reference value) const
{ return const_iterator (value_traits::to_node_ptr(const_cast<reference> (value)), this); }
//! <b>Requires</b>: value shall not be in a tree.
- //!
+ //!
//! <b>Effects</b>: init_node puts the hook of a value in a well-known default
//! state.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This function puts the hook in the well-known default state
//! used by auto_unlink and safe hooks.
static void init_node(reference value)
@@ -1381,12 +1479,12 @@ class avltree_impl
/*
//! <b>Effects</b>: removes x from a tree of the appropriate type. It has no effect,
- //! if x is not in such a tree.
- //!
+ //! if x is not in such a tree.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This static function is only usable with the "safe mode"
//! hook and non-constant time size lists. Otherwise, the user must use
//! the non-static "erase(reference )" member. If the user calls
@@ -1396,7 +1494,7 @@ class avltree_impl
static void remove_node(T& value)
{
//This function is only usable for safe mode hooks and non-constant
- //time lists.
+ //time lists.
//BOOST_STATIC_ASSERT((!(safemode_or_autounlink && constant_time_size)));
BOOST_STATIC_ASSERT((!constant_time_size));
BOOST_STATIC_ASSERT((boost::is_convertible<T, value_type>::value));
@@ -1680,8 +1778,8 @@ class avltree
#endif
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/avltree_algorithms.hpp b/boost/intrusive/avltree_algorithms.hpp
index 9b917c767d..11463c71fb 100644
--- a/boost/intrusive/avltree_algorithms.hpp
+++ b/boost/intrusive/avltree_algorithms.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Daniel K. O. 2005.
-// (C) Copyright Ion Gaztanaga 2007.
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -45,25 +45,25 @@ namespace intrusive {
//! <b>Static functions</b>:
//!
//! <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 node_ptr get_left(const_node_ptr n);</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 void set_right(node_ptr n, node_ptr right);</tt>
-//!
+//!
//! <tt>static balance get_balance(const_node_ptr n);</tt>
-//!
+//!
//! <tt>static void set_balance(node_ptr n, balance b);</tt>
-//!
+//!
//! <tt>static balance negative();</tt>
-//!
+//!
//! <tt>static balance zero();</tt>
-//!
+//!
//! <tt>static balance positive();</tt>
template<class NodeTraits>
class avltree_algorithms
@@ -88,7 +88,7 @@ class avltree_algorithms
avltree_node_cloner(F f)
: base_t(f)
{}
-
+
node_ptr operator()(const node_ptr &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
//! 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.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
{ return tree_algorithms::swap_tree(header1, header2); }
//! <b>Requires</b>: node1 and node2 can't be header nodes
//! of two trees.
- //!
+ //!
//! <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
//! position node1 had before the function.
- //!
- //! <b>Complexity</b>: Logarithmic.
- //!
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! node1 and node2 are not equivalent according to the ordering rules.
//!
@@ -149,22 +149,22 @@ class avltree_algorithms
{
if(node1 == node2)
return;
-
+
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
swap_nodes(node1, header1, node2, header2);
}
//! <b>Requires</b>: node1 and node2 can't be header nodes
//! of two trees with header header1 and header2.
- //!
+ //!
//! <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
//! position node1 had before the function.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! 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);
//Swap balance
balance c = NodeTraits::get_balance(node1);
- NodeTraits::set_balance(node1, NodeTraits::get_balance(node2));
- NodeTraits::set_balance(node2, c);
+ NodeTraits::set_balance(node1, NodeTraits::get_balance(node2));
+ NodeTraits::set_balance(node2, c);
}
//! <b>Requires</b>: node_to_be_replaced must 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
//! 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>Note</b>: This function will break container ordering invariants if
//! new_node is not equivalent to node_to_be_replaced according to the
//! 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
//! 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
//! 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>Note</b>: This function will break container ordering invariants if
//! new_node is not equivalent to node_to_be_replaced according to the
//! 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)
{
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>Effects</b>: Unlinks the node and rebalances the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
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>Effects</b>: Unlinks the leftmost node from the tree, and
//! updates the header link to the new leftmost node.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! 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
//! by init(...).
- //!
+ //!
//! <b>Effects</b>: Returns true if the node is initialized by init().
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static bool unique(const const_node_ptr & node)
{ return tree_algorithms::unique(node); }
//! <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>Complexity</b>: Linear time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static std::size_t count(const const_node_ptr & node)
{ return tree_algorithms::count(node); }
//! <b>Requires</b>: header is the header node of the tree.
- //!
+ //!
//! <b>Effects</b>: Returns the number of nodes above the header.
- //!
+ //!
//! <b>Complexity</b>: Linear time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static std::size_t size(const const_node_ptr & header)
{ return tree_algorithms::size(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>Complexity</b>: Average constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr next_node(const node_ptr & p)
{ return tree_algorithms::next_node(p); }
//! <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>Complexity</b>: Average constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr prev_node(const node_ptr & 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>Effects</b>: After the function unique(node) == true.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <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.
//! unique(header) == true.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
static void init_header(const node_ptr & 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
//! of that tree and z != header.
//!
//! <b>Effects</b>: Erases node "z" from the tree with header "header".
- //!
+ //!
//! <b>Complexity</b>: Amortized constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
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
//! 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
//! except the header.
- //!
+ //!
//! 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
//! 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.
//! 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.
template <class Cloner, class Disposer>
static void clone
@@ -385,13 +385,13 @@ class avltree_algorithms
//! <b>Requires</b>: "disposer" must be an object function
//! 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
//! except the header.
- //!
+ //!
//! <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.
- //!
+ //!
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
template<class Disposer>
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
@@ -407,7 +407,7 @@ class avltree_algorithms
//! not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
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.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr upper_bound
@@ -439,7 +439,7 @@ class avltree_algorithms
//! "key" according to "comp" or "header" if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr find
@@ -457,13 +457,38 @@ class avltree_algorithms
//! if they there are no equivalent elements.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static std::pair<node_ptr, node_ptr> equal_range
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{ return tree_algorithms::equal_range(header, key, comp); }
+ //! <b>Requires</b>: "header" must be the header node of a tree.
+ //! KeyNodePtrCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyNodePtrCompare>
+ static std::pair<node_ptr, node_ptr> bounded_range
+ (const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp
+ , bool left_closed, bool right_closed)
+ { return tree_algorithms::bounded_range(header, lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: "h" must be the header node of a tree.
//! NodePtrCompare is a function object that induces a strict weak
//! ordering compatible with the strict weak ordering used to create the
@@ -471,10 +496,10 @@ class avltree_algorithms
//!
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
//! according to "comp".
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class NodePtrCompare>
static node_ptr insert_equal_upper_bound
@@ -492,10 +517,10 @@ class avltree_algorithms
//!
//! <b>Effects</b>: Inserts new_node into the tree before the lower bound
//! according to "comp".
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class NodePtrCompare>
static node_ptr insert_equal_lower_bound
@@ -511,14 +536,14 @@ class avltree_algorithms
//! ordering compatible with the strict weak ordering used to create the
//! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from
//! the "header"'s tree.
- //!
+ //!
//! <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
//! the insertion takes constant time (two comparisons in the worst case).
//!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time if new_node is inserted immediately before "hint".
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class NodePtrCompare>
static node_ptr insert_equal
@@ -534,13 +559,13 @@ class avltree_algorithms
//! "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
//! check "pos" and this precondition must be guaranteed by the caller.
- //!
+ //!
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
//!
//! <b>Complexity</b>: Constant-time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
//! tree invariants might be broken.
static node_ptr insert_before
@@ -554,13 +579,13 @@ class avltree_algorithms
//! <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
//! greatest inserted key.
- //!
+ //!
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
//!
//! <b>Complexity</b>: Constant-time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
//! tree invariants are broken. This function is slightly faster than
//! using "insert_before".
@@ -573,13 +598,13 @@ class avltree_algorithms
//! <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
//! lowest inserted key.
- //!
+ //!
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
//!
//! <b>Complexity</b>: Constant-time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
//! tree invariants are broken. This function is slightly faster than
//! using "insert_before".
@@ -593,7 +618,7 @@ class avltree_algorithms
//! KeyNodePtrCompare is a function object that induces a strict weak
//! ordering compatible with the strict weak ordering used to create the
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
- //!
+ //!
//! <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
//! a constant-time node insertion if there is no equivalent node.
@@ -604,11 +629,11 @@ class avltree_algorithms
//! 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
//! insertion function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic.
//!
//! <b>Throws</b>: If "comp" throws.
- //!
+ //!
//! <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
//! in the tree: if there is an equivalent value
@@ -634,12 +659,12 @@ class avltree_algorithms
//! ordering compatible with the strict weak ordering used to create the
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
//! "hint" is node from the "header"'s tree.
- //!
+ //!
//! <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
//! inserted and obtains the needed information to realize
- //! a constant-time node insertion if there is no equivalent node.
- //! If "hint" is the upper_bound the function has constant time
+ //! a constant-time node insertion if there is no equivalent node.
+ //! If "hint" is the upper_bound the function has constant time
//! complexity (two comparisons in the worst case).
//!
//! <b>Returns</b>: If there is an equivalent value
@@ -648,12 +673,12 @@ class avltree_algorithms
//! 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
//! insertion function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic, but it is
//! amortized constant time if new_node should be inserted immediately before "hint".
//!
//! <b>Throws</b>: If "comp" throws.
- //!
+ //!
//! <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
//! in the tree: if there is an equivalent value
@@ -678,16 +703,16 @@ class avltree_algorithms
//! "commit_data" must have been obtained from a previous call to
//! "insert_unique_check". No objects should have been inserted or erased
//! 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
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <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
//! erased between the "insert_check" and "insert_commit" calls.
@@ -703,7 +728,7 @@ class avltree_algorithms
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr get_header(const node_ptr & n)
{ return tree_algorithms::get_header(n); }
@@ -712,11 +737,11 @@ class avltree_algorithms
private:
//! <b>Requires</b>: p is a node of a tree.
- //!
+ //!
//! <b>Effects</b>: Returns true if p is the header of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static bool is_header(const const_node_ptr & p)
{ return NodeTraits::get_balance(p) == NodeTraits::zero() && tree_algorithms::is_header(p); }
@@ -727,7 +752,7 @@ class avltree_algorithms
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);
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()));
break; // the height didn't change, let's stop here
}
@@ -935,8 +960,8 @@ class avltree_algorithms
/// @endcond
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/bs_set_hook.hpp b/boost/intrusive/bs_set_hook.hpp
index bf8e2de09a..682426a960 100644
--- a/boost/intrusive/bs_set_hook.hpp
+++ b/boost/intrusive/bs_set_hook.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -63,16 +63,16 @@ struct make_bs_set_base_hook
typedef implementation_defined type;
};
-//! 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
+//! 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
//! 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<>,
//! \c link_mode<>.
//!
-//! \c tag<> defines a tag to identify the node.
-//! 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
+//! \c tag<> defines a tag to identify the node.
+//! 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
//! unique tag.
//!
//! \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:
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
bs_set_base_hook();
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
- //!
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
//! <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
//! move-semantics.
bs_set_base_hook(const bs_set_base_hook& );
//! <b>Effects</b>: Empty function. The argument is ignored.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Rationale</b>: Providing an assignment operator
- //! makes classes using the hook STL-compliant without forcing the
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Rationale</b>: Providing an assignment operator
+ //! makes classes using the hook STL-compliant without forcing the
//! user to do some additional work. \c swap can be used to emulate
//! move-semantics.
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
//! 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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
~bs_set_base_hook();
- //! <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
- //! 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
- //! 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
- //! after the swap-operation the other element is not in a container.
- //! Iterators to e1 and e2 related to those nodes are invalidated.
+ //! <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
+ //! 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
+ //! 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
+ //! after the swap-operation the other element is not in a container.
+ //! 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);
//! <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
- //! otherwise. This function can be used to test whether \c set::iterator_to
- //! will return a valid iterator.
+ //! otherwise. This function can be used to test whether \c set::iterator_to
+ //! will return a valid iterator.
//!
- //! <b>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
bool is_linked() const;
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
void unlink();
#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
//! 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.
-//!
+//!
//! 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
@@ -224,27 +224,27 @@ class bs_set_member_hook
public:
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
bs_set_member_hook();
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
- //!
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
//! <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
//! move-semantics.
bs_set_member_hook(const bs_set_member_hook& );
//! <b>Effects</b>: Empty function. The argument is ignored.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Rationale</b>: Providing an assignment operator
- //! makes classes using the hook STL-compliant without forcing the
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Rationale</b>: Providing an assignment operator
+ //! makes classes using the hook STL-compliant without forcing the
//! user to do some additional work. \c swap can be used to emulate
//! move-semantics.
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
//! 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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
~bs_set_member_hook();
- //! <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
- //! 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
- //! 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
- //! after the swap-operation the other element is not in a container.
- //! Iterators to e1 and e2 related to those nodes are invalidated.
+ //! <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
+ //! 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
+ //! 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
+ //! after the swap-operation the other element is not in a container.
+ //! 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);
//! <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
- //! otherwise. This function can be used to test whether \c set::iterator_to
- //! will return a valid iterator.
+ //! otherwise. This function can be used to test whether \c set::iterator_to
+ //! will return a valid iterator.
//!
- //! <b>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
bool is_linked() const;
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
void unlink();
#endif
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/circular_list_algorithms.hpp b/boost/intrusive/circular_list_algorithms.hpp
index c5de423b62..282f4741a1 100644
--- a/boost/intrusive/circular_list_algorithms.hpp
+++ b/boost/intrusive/circular_list_algorithms.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -40,11 +40,11 @@ namespace intrusive {
//! <b>Static functions</b>:
//!
//! <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 node_ptr get_next(const_node_ptr n);</tt>
-//!
+//!
//! <tt>static void set_next(node_ptr n, node_ptr next);</tt>
template<class NodeTraits>
class circular_list_algorithms
@@ -57,9 +57,9 @@ class circular_list_algorithms
//! <b>Effects</b>: Constructs an non-used list element, so that
//! inited(this_node) == true
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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
//! as if it was initialized by the "init" function.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <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); }
//! <b>Effects</b>: Constructs an empty list, making this_node the only
//! node of the circular list:
//! <tt>NodeTraits::get_next(this_node) == NodeTraits::get_previous(this_node)
//! == this_node</tt>.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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>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>
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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>Effects</b>: Returns the number of nodes in a circular list. If the circular list
//! is empty, returns 1.
- //!
- //! <b>Complexity</b>: Linear
- //!
+ //!
+ //! <b>Complexity</b>: Linear
+ //!
//! <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;
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>Effects</b>: Unlinks the node from the circular list.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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>Effects</b>: Unlinks the node [b, e) from the circular list.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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>Effects</b>: Links this_node before nxt_node in the circular list.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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>Effects</b>: Links this_node after prev_node in the circular list.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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
//! in circular lists or be empty circular lists.
- //!
+ //!
//! <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
//! in this_node's position in the first circular list.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
/*
static void swap_nodes(const node_ptr &this_node, const node_ptr &other_node)
@@ -248,22 +248,22 @@ class circular_list_algorithms
*/
//Watanabe version
- private:
- static void swap_prev(const node_ptr &this_node, const node_ptr &other_node)
- {
- node_ptr temp(NodeTraits::get_previous(this_node));
- NodeTraits::set_previous(this_node, NodeTraits::get_previous(other_node));
- NodeTraits::set_previous(other_node, temp);
- }
- static void swap_next(const node_ptr &this_node, const node_ptr &other_node)
- {
- node_ptr temp(NodeTraits::get_next(this_node));
- NodeTraits::set_next(this_node, NodeTraits::get_next(other_node));
- NodeTraits::set_next(other_node, temp);
- }
-
- public:
- static void swap_nodes(const node_ptr &this_node, const node_ptr &other_node)
+ private:
+ static void swap_prev(const node_ptr &this_node, const node_ptr &other_node)
+ {
+ node_ptr temp(NodeTraits::get_previous(this_node));
+ NodeTraits::set_previous(this_node, NodeTraits::get_previous(other_node));
+ NodeTraits::set_previous(other_node, temp);
+ }
+ static void swap_next(const node_ptr &this_node, const node_ptr &other_node)
+ {
+ node_ptr temp(NodeTraits::get_next(this_node));
+ NodeTraits::set_next(this_node, NodeTraits::get_next(other_node));
+ NodeTraits::set_next(other_node, temp);
+ }
+
+ public:
+ static void swap_nodes(const node_ptr &this_node, const node_ptr &other_node)
{
if (other_node == this_node)
return;
@@ -276,15 +276,15 @@ class circular_list_algorithms
init_header(other_node);
}
- node_ptr next_this(NodeTraits::get_next(this_node));
- node_ptr prev_this(NodeTraits::get_previous(this_node));
- node_ptr next_other(NodeTraits::get_next(other_node));
- node_ptr prev_other(NodeTraits::get_previous(other_node));
- //these first two swaps must happen before the other two
- swap_prev(next_this, next_other);
- swap_next(prev_this, prev_other);
- swap_next(this_node, other_node);
- swap_prev(this_node, other_node);
+ node_ptr next_this(NodeTraits::get_next(this_node));
+ node_ptr prev_this(NodeTraits::get_previous(this_node));
+ node_ptr next_other(NodeTraits::get_next(other_node));
+ node_ptr prev_other(NodeTraits::get_previous(other_node));
+ //these first two swaps must happen before the other two
+ swap_prev(next_this, next_other);
+ swap_next(prev_this, prev_other);
+ swap_next(this_node, other_node);
+ swap_prev(this_node, other_node);
if(this_inited){
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.
- //! 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>Effects</b>: Removes the nodes from [b, e) range from their circular list and inserts
//! them before p in p's circular list.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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
//! and p must be a node of a different circular list.
- //!
+ //!
//! <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.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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>Complexity</b>: This function is linear time.
static void reverse(const node_ptr &p)
{
node_ptr f(NodeTraits::get_next(p));
node_ptr i(NodeTraits::get_next(f)), e(p);
-
+
while(i != e) {
node_ptr n = 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>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of moved positions.
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>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of moved positions.
static void move_forward(const node_ptr &p, std::size_t n)
{
@@ -405,8 +405,8 @@ class circular_list_algorithms
}
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/circular_slist_algorithms.hpp b/boost/intrusive/circular_slist_algorithms.hpp
index b843590c15..c39b3d0c5a 100644
--- a/boost/intrusive/circular_slist_algorithms.hpp
+++ b/boost/intrusive/circular_slist_algorithms.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -42,7 +42,7 @@ namespace intrusive {
//! <b>Static functions</b>:
//!
//! <tt>static node_ptr get_next(const_node_ptr n);</tt>
-//!
+//!
//! <tt>static void set_next(node_ptr n, node_ptr next);</tt>
template<class NodeTraits>
class circular_slist_algorithms
@@ -64,37 +64,37 @@ class circular_slist_algorithms
//! <b>Effects</b>: Constructs an non-used list element, putting the next
//! pointer to null:
//! <tt>NodeTraits::get_next(this_node) == node_ptr()</tt>
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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>Effects</b>: Returns true is "this_node" is the only node of a circular list:
//! or it's a not inserted node:
//! <tt>return node_ptr() == NodeTraits::get_next(this_node) || NodeTraits::get_next(this_node) == this_node</tt>
- //!
+ //!
//! <b>Complexity</b>: Constant
- //!
+ //!
//! <b>Throws</b>: Nothing.
static bool unique(const_node_ptr this_node);
//! <b>Effects</b>: Returns true is "this_node" has the same state as
//! if it was inited using "init(node_ptr)"
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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>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.
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>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
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>Effects</b>: Links this_node after prev_node in the circular list.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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.
//! 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
//! them after p in p's circular list.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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
//! node of the circular list:
//! <tt>NodeTraits::get_next(this_node) == this_node</tt>.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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>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
//! is NodeTraits::get_next(prev_init_node).
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements between prev_init_node and this_node.
- //!
+ //!
//! <b>Throws</b>: Nothing.
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); }
//! <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>Complexity</b>: Linear to the number of elements in the circular list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr get_previous_node(const node_ptr & 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>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>Throws</b>: Nothing.
static node_ptr get_previous_previous_node(const node_ptr & 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>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
//! 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>Throws</b>: Nothing.
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>Effects</b>: Returns the number of nodes in a circular list. If the circular list
//! is empty, returns 1.
- //!
- //! <b>Complexity</b>: Linear
- //!
+ //!
+ //! <b>Complexity</b>: Linear
+ //!
//! <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;
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>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.
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>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.
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); }
//! <b>Requires</b>: this_node and other_node must be nodes inserted
//! in circular lists or be empty circular lists.
- //!
+ //!
//! <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
//! 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.
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>Complexity</b>: This function is linear to the contained elements.
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 (;;) {
node_ptr nxt(NodeTraits::get_next(i));
if (nxt == e)
@@ -301,7 +301,7 @@ class circular_slist_algorithms
//! Null if n leads to no movement.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <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)
{
@@ -348,12 +348,12 @@ class circular_slist_algorithms
}
//! <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,
//! Null if n leads equals to no movement.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <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)
{
@@ -382,7 +382,7 @@ class circular_slist_algorithms
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(!new_before_last_pos) return node_ptr();
-
+
for( new_last = p
; new_before_last_pos--
; new_last = node_traits::get_next(new_last)){
@@ -397,8 +397,8 @@ class circular_slist_algorithms
}
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/derivation_value_traits.hpp b/boost/intrusive/derivation_value_traits.hpp
index 38c5aa57cf..0aae01b619 100644
--- a/boost/intrusive/derivation_value_traits.hpp
+++ b/boost/intrusive/derivation_value_traits.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -47,7 +47,7 @@ struct derivation_value_traits
static const_node_ptr to_node_ptr(const_reference 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
// using ::boost::static_pointer_cast;
@@ -64,7 +64,7 @@ struct derivation_value_traits
}
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#endif //BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP
diff --git a/boost/intrusive/detail/any_node_and_algorithms.hpp b/boost/intrusive/detail/any_node_and_algorithms.hpp
index bda9ad3c45..b274135a90 100644
--- a/boost/intrusive/detail/any_node_and_algorithms.hpp
+++ b/boost/intrusive/detail/any_node_and_algorithms.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -18,7 +18,7 @@
#include <boost/intrusive/detail/assert.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <cstddef>
-#include <boost/intrusive/detail/mpl.hpp>
+#include <boost/intrusive/detail/mpl.hpp>
#include <boost/pointer_cast.hpp>
namespace boost {
@@ -100,10 +100,10 @@ struct any_unordered_node_traits
{ n->node_ptr_2 = prev; }
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)
- { 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>Effects</b>: After the function unique(node) == true.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <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; };
//! <b>Effects</b>: Returns true if node is in the same state as if called init(node)
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static bool inited(const const_node_ptr & node)
{ return !node->node_ptr_1; };
@@ -289,8 +289,8 @@ class any_algorithms
}
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/detail/assert.hpp b/boost/intrusive/detail/assert.hpp
index cfe392bfb0..33de97f701 100644
--- a/boost/intrusive/detail/assert.hpp
+++ b/boost/intrusive/detail/assert.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -11,7 +11,7 @@
/////////////////////////////////////////////////////////////////////////////
#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)
#pragma once
diff --git a/boost/intrusive/detail/avltree_node.hpp b/boost/intrusive/detail/avltree_node.hpp
index dc600e6695..aec0dabd4b 100644
--- a/boost/intrusive/detail/avltree_node.hpp
+++ b/boost/intrusive/detail/avltree_node.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007.
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -172,13 +172,13 @@ struct avltree_node_traits
, OptimizeSize &&
max_pointer_plus_bits
< VoidPointer
- , detail::alignment_of<compact_avltree_node<VoidPointer> >::value
+ , detail::alignment_of<compact_avltree_node<VoidPointer> >::value
>::value >= 2u
>
{};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/detail/clear_on_destructor_base.hpp b/boost/intrusive/detail/clear_on_destructor_base.hpp
index 6765dfa05d..1b5c27fff4 100644
--- a/boost/intrusive/detail/clear_on_destructor_base.hpp
+++ b/boost/intrusive/detail/clear_on_destructor_base.hpp
@@ -1,6 +1,6 @@
//////} // ///////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
diff --git a/boost/intrusive/detail/common_slist_algorithms.hpp b/boost/intrusive/detail/common_slist_algorithms.hpp
index 15d6b3ff29..942b35a3f4 100644
--- a/boost/intrusive/detail/common_slist_algorithms.hpp
+++ b/boost/intrusive/detail/common_slist_algorithms.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -44,11 +44,11 @@ class common_slist_algorithms
return p;
}
- static void init_header(const node_ptr & this_node)
- { NodeTraits::set_next(this_node, this_node); }
+ static void init_header(const node_ptr & this_node)
+ { NodeTraits::set_next(this_node, this_node); }
- static void init(const node_ptr & this_node)
- { NodeTraits::set_next(this_node, node_ptr()); }
+ static void init(const node_ptr & this_node)
+ { NodeTraits::set_next(this_node, node_ptr()); }
static bool unique(const const_node_ptr & this_node)
{
@@ -56,7 +56,7 @@ class common_slist_algorithms
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); }
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(be, p);
}
-
+
static void transfer_after(const node_ptr & bp, const node_ptr & bb, const node_ptr & be)
{
if (bp != bb && bp != be && bb != be) {
@@ -95,8 +95,8 @@ class common_slist_algorithms
};
} //namespace detail
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/detail/config_begin.hpp b/boost/intrusive/detail/config_begin.hpp
index bb126fcdf0..7d153368a5 100644
--- a/boost/intrusive/detail/config_begin.hpp
+++ b/boost/intrusive/detail/config_begin.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -20,10 +20,10 @@
#pragma warning (push)
//
//'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.
//
- //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.
//
diff --git a/boost/intrusive/detail/config_end.hpp b/boost/intrusive/detail/config_end.hpp
index 4277cb576f..d653030daa 100644
--- a/boost/intrusive/detail/config_end.hpp
+++ b/boost/intrusive/detail/config_end.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
diff --git a/boost/intrusive/detail/ebo_functor_holder.hpp b/boost/intrusive/detail/ebo_functor_holder.hpp
index d4c2d1593b..850d074326 100644
--- a/boost/intrusive/detail/ebo_functor_holder.hpp
+++ b/boost/intrusive/detail/ebo_functor_holder.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Joaquin M Lopez Munoz 2006-2009
+// (C) Copyright Joaquin M Lopez Munoz 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
diff --git a/boost/intrusive/detail/function_detector.hpp b/boost/intrusive/detail/function_detector.hpp
index e00a7efcf2..08cee2d561 100644
--- a/boost/intrusive/detail/function_detector.hpp
+++ b/boost/intrusive/detail/function_detector.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2009-2009.
+// (C) Copyright Ion Gaztanaga 2009-2012.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,7 +15,7 @@
///////////////////////////////////////////////////////////////////////////////
// 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.
///////////////////////////////////////////////////////////////////////////////
@@ -74,7 +74,7 @@ namespace function_detector {
public : \
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) \
::boost::intrusive::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\
diff --git a/boost/intrusive/detail/generic_hook.hpp b/boost/intrusive/detail/generic_hook.hpp
index fc35610b8d..5ddd52074e 100644
--- a/boost/intrusive/detail/generic_hook.hpp
+++ b/boost/intrusive/detail/generic_hook.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -143,7 +143,7 @@ class generic_hook
typedef Tag tag;
typedef typename GetNodeAlgorithms::type::node_traits node_traits;
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;
};
@@ -163,14 +163,14 @@ class generic_hook
}
}
- generic_hook(const generic_hook& )
+ generic_hook(const generic_hook& )
{
if(boost_intrusive_tags::safemode_or_autounlink){
node_algorithms::init(this->this_ptr());
}
}
- generic_hook& operator=(const generic_hook& )
+ generic_hook& operator=(const generic_hook& )
{ return *this; }
~generic_hook()
@@ -179,13 +179,13 @@ class generic_hook
(*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
(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
BOOST_STATIC_ASSERT(( boost_intrusive_tags::safemode_or_autounlink ));
@@ -201,8 +201,8 @@ class generic_hook
};
} //namespace detail
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/detail/has_member_function_callable_with.hpp b/boost/intrusive/detail/has_member_function_callable_with.hpp
index 33811e3210..6516e28067 100644
--- a/boost/intrusive/detail/has_member_function_callable_with.hpp
+++ b/boost/intrusive/detail/has_member_function_callable_with.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
@@ -10,7 +10,7 @@
// sample.h
-#if !BOOST_PP_IS_ITERATING
+#if !defined(BOOST_PP_IS_ITERATING)
#ifndef BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED
#define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED
@@ -21,7 +21,7 @@
#include <boost/static_assert.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
#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
@@ -113,7 +113,7 @@
};
//!
- #if !defined(_MSC_VER) || (_MSC_VER != 1600)
+ #if !defined(_MSC_VER) || (_MSC_VER < 1600)
#if defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED)
@@ -121,16 +121,16 @@
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)>
{
- //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
static const bool value = true;
};
- #else
+ #else //defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED)
//Special case for 0 args
template< class F
- , std::size_t N =
+ , std::size_t N =
sizeof((boost::move_detail::declval<F>().
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))>
struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)
@@ -156,15 +156,15 @@
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>*);
- template <class U>
+ template <class U>
static boost_intrusive_has_member_function_callable_with::no_type Test(...);
-
+
static const bool value = sizeof(Test< Fun >(0))
== sizeof(boost_intrusive_has_member_function_callable_with::yes_type);
};
- #endif
+ #endif //defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED)
- #else //#if !defined(_MSC_VER) || (_MSC_VER != 1600)
+ #else //#if !defined(_MSC_VER) || (_MSC_VER < 1600)
template<typename Fun>
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)>
@@ -180,7 +180,7 @@
static const bool value = sizeof(Test<Fun>(0))
== sizeof(boost_intrusive_has_member_function_callable_with::yes_type);
};
- #endif //#if !defined(_MSC_VER) || (_MSC_VER != 1600)
+ #endif //#if !defined(_MSC_VER) || (_MSC_VER < 1600)
#else //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
@@ -196,7 +196,7 @@
//Special case for 0 args
template< class F
- , std::size_t N =
+ , std::size_t N =
sizeof((boost::move_detail::declval<F>().
BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))>
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)
<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 const bool value = sizeof(Test< Fun >(0))
== sizeof(boost_intrusive_has_member_function_callable_with::yes_type);
};
diff --git a/boost/intrusive/detail/hashtable_node.hpp b/boost/intrusive/detail/hashtable_node.hpp
index ac6ab81948..86e607460c 100644
--- a/boost/intrusive/detail/hashtable_node.hpp
+++ b/boost/intrusive/detail/hashtable_node.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -40,7 +40,7 @@ struct prime_list_holder
template<int Dummy>
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,
1543ul, 3079ul, 6151ul, 12289ul, 24593ul,
49157ul, 98317ul, 196613ul, 393241ul, 786433ul,
@@ -180,9 +180,9 @@ class hashtable_iterator
{ return hashtable_iterator<Container, false>(this->slist_it(), this->get_container()); }
public:
- hashtable_iterator& operator++()
+ hashtable_iterator& operator++()
{ this->increment(); return *this; }
-
+
hashtable_iterator operator++(int)
{
hashtable_iterator result (*this);
@@ -219,7 +219,7 @@ class hashtable_iterator
size_type buckets_len = cont->bucket_count();
++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() ){
//Now get the bucket_impl from the iterator
const bucket_type &b = static_cast<const bucket_type&>
diff --git a/boost/intrusive/detail/is_stateful_value_traits.hpp b/boost/intrusive/detail/is_stateful_value_traits.hpp
index e38f4de459..8677c666d4 100644
--- a/boost/intrusive/detail/is_stateful_value_traits.hpp
+++ b/boost/intrusive/detail/is_stateful_value_traits.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2009-2009.
+// (C) Copyright Ion Gaztanaga 2009-2012.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
diff --git a/boost/intrusive/detail/list_node.hpp b/boost/intrusive/detail/list_node.hpp
index df99912dd2..d406af60e4 100644
--- a/boost/intrusive/detail/list_node.hpp
+++ b/boost/intrusive/detail/list_node.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -57,7 +57,7 @@ struct list_node_traits
{ n->next_ = next; }
};
-// list_iterator provides some basic functions for a
+// list_iterator provides some basic functions for a
// node oriented bidirectional iterator:
template<class Container, bool IsConst>
class list_iterator
@@ -76,7 +76,7 @@ class list_iterator
typedef typename node_traits::node_ptr node_ptr;
typedef typename pointer_traits<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;
public:
@@ -103,14 +103,14 @@ class list_iterator
{ members_.nodeptr_ = node; return static_cast<list_iterator&>(*this); }
public:
- list_iterator& operator++()
+ list_iterator& operator++()
{
node_ptr p = node_traits::get_next(members_.nodeptr_);
members_.nodeptr_ = p;
- //members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
- return static_cast<list_iterator&> (*this);
+ //members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
+ return static_cast<list_iterator&> (*this);
}
-
+
list_iterator operator++(int)
{
list_iterator result (*this);
@@ -118,12 +118,12 @@ class list_iterator
return result;
}
- list_iterator& operator--()
- {
- members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_);
- return static_cast<list_iterator&> (*this);
+ list_iterator& operator--()
+ {
+ members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_);
+ return static_cast<list_iterator&> (*this);
}
-
+
list_iterator operator--(int)
{
list_iterator result (*this);
@@ -182,8 +182,8 @@ class list_iterator
} members_;
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/detail/memory_util.hpp b/boost/intrusive/detail/memory_util.hpp
index ad026c6d61..1a6431b078 100644
--- a/boost/intrusive/detail/memory_util.hpp
+++ b/boost/intrusive/detail/memory_util.hpp
@@ -6,7 +6,7 @@
//
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
@@ -182,7 +182,11 @@ template <typename Ptr, typename T>
struct type_has_rebind
{
template <typename X>
+ #if !defined (__SUNPRO_CC)
static char test(int, typename X::template rebind<T>*);
+ #else
+ static char test(int, typename X::rebind<T>*);
+ #endif
template <typename X>
static int test(boost::intrusive::detail::LowPriorityConversion<int>, void*);
@@ -194,7 +198,11 @@ template <typename Ptr, typename T>
struct type_has_rebind_other
{
template <typename X>
+ #if !defined (__SUNPRO_CC)
static char test(int, typename X::template rebind<T>::other*);
+ #else
+ static char test(int, typename X::rebind<T>::other*);
+ #endif
template <typename X>
static int test(boost::intrusive::detail::LowPriorityConversion<int>, void*);
@@ -205,12 +213,6 @@ struct type_has_rebind_other
template <typename Ptr, typename T>
struct type_rebind_mode
{
- template <typename X>
- static char test(int, typename X::template rebind<T>::other*);
-
- template <typename X>
- static int test(boost::intrusive::detail::LowPriorityConversion<int>, void*);
-
static const unsigned int rebind = (unsigned int)type_has_rebind<Ptr, T>::value;
static const unsigned int rebind_other = (unsigned int)type_has_rebind_other<Ptr, T>::value;
static const unsigned int mode = rebind + rebind*rebind_other;
@@ -251,6 +253,13 @@ struct type_rebinder<Ptr<T, Tn...>, U, 0u >
typedef Ptr<U, Tn...> type;
};
+//Needed for non-conforming compilers like GCC 4.3
+template <template <class> class Ptr, typename T, class U>
+struct type_rebinder<Ptr<T>, U, 0u >
+{
+ typedef Ptr<U> type;
+};
+
#else //C++03 compilers
#define BOOST_PP_LOCAL_MACRO(n) \
diff --git a/boost/intrusive/detail/mpl.hpp b/boost/intrusive/detail/mpl.hpp
index 075381cae2..02b1361d2a 100644
--- a/boost/intrusive/detail/mpl.hpp
+++ b/boost/intrusive/detail/mpl.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -127,10 +127,10 @@ struct identity
#if defined(BOOST_MSVC) || defined(__BORLANDC_)
#define BOOST_INTRUSIVE_TT_DECL __cdecl
#else
-#define BOOST_INTRUSIVE_TT_DECL
+#define BOOST_INTRUSIVE_TT_DECL
#endif
-#if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64)
+#if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64) && !defined(UNDER_CE)
#define BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
#endif
@@ -156,10 +156,14 @@ template <typename R>
struct is_unary_or_binary_function_impl<R (__stdcall*)()>
{ static const bool value = true; };
+#ifndef _MANAGED
+
template <typename R>
struct is_unary_or_binary_function_impl<R (__fastcall*)()>
{ static const bool value = true; };
+#endif
+
template <typename R>
struct is_unary_or_binary_function_impl<R (__cdecl*)()>
{ static const bool value = true; };
@@ -188,10 +192,14 @@ template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__stdcall*)(T0)>
{ static const bool value = true; };
+#ifndef _MANAGED
+
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__fastcall*)(T0)>
{ static const bool value = true; };
+#endif
+
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0)>
{ static const bool value = true; };
@@ -220,10 +228,14 @@ template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (__stdcall*)(T0, T1)>
{ static const bool value = true; };
+#ifndef _MANAGED
+
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (__fastcall*)(T0, T1)>
{ static const bool value = true; };
+#endif
+
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1)>
{ static const bool value = true; };
@@ -346,9 +358,9 @@ struct ls_zeros<1>
static const std::size_t value = 0;
};
-} //namespace detail
-} //namespace intrusive
-} //namespace boost
+} //namespace detail
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/detail/parent_from_member.hpp b/boost/intrusive/detail/parent_from_member.hpp
index c06d932a70..2afffb47bc 100644
--- a/boost/intrusive/detail/parent_from_member.hpp
+++ b/boost/intrusive/detail/parent_from_member.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -31,29 +31,53 @@ inline std::ptrdiff_t offset_from_pointer_to_member(const Member Parent::* ptr_t
//The implementation of a pointer to member is compiler dependent.
#if defined(BOOST_INTRUSIVE_MSVC_COMPLIANT_PTR_TO_MEMBER)
//msvc compliant compilers use their the first 32 bits as offset (even in 64 bit mode)
- return *(const boost::int32_t*)(void*)&ptr_to_member;
+ union caster_union
+ {
+ const Member Parent::* ptr_to_member;
+ boost::int32_t offset;
+ } caster;
+ caster.ptr_to_member = ptr_to_member;
+ return std::ptrdiff_t(caster.offset);
//This works with gcc, msvc, ac++, ibmcpp
#elif defined(__GNUC__) || defined(__HP_aCC) || defined(BOOST_INTEL) || \
defined(__IBMCPP__) || defined(__DECCXX)
const Parent * const parent = 0;
- const char *const member = reinterpret_cast<const char*>(&(parent->*ptr_to_member));
- return std::ptrdiff_t(member - reinterpret_cast<const char*>(parent));
+ const char *const member = static_cast<const char*>(static_cast<const void*>(&(parent->*ptr_to_member)));
+ return std::ptrdiff_t(member - static_cast<const char*>(static_cast<const void*>(parent)));
#else
//This is the traditional C-front approach: __MWERKS__, __DMC__, __SUNPRO_CC
- return (*(const std::ptrdiff_t*)(void*)&ptr_to_member) - 1;
+ union caster_union
+ {
+ const Member Parent::* ptr_to_member;
+ std::ptrdiff_t offset;
+ } caster;
+ caster.ptr_to_member = ptr_to_member;
+ return caster.offset - 1;
#endif
}
template<class Parent, class Member>
inline Parent *parent_from_member(Member *member, const Member Parent::* ptr_to_member)
{
- return (Parent*)((char*)member - offset_from_pointer_to_member(ptr_to_member));
+ return static_cast<Parent*>
+ (
+ static_cast<void*>
+ (
+ static_cast<char*>(static_cast<void*>(member)) - offset_from_pointer_to_member(ptr_to_member)
+ )
+ );
}
template<class Parent, class Member>
inline const Parent *parent_from_member(const Member *member, const Member Parent::* ptr_to_member)
{
- return (const Parent*)((const char*)member - offset_from_pointer_to_member(ptr_to_member));
+ return static_cast<const Parent*>
+ (
+ static_cast<const void*>
+ (
+ static_cast<const char*>(static_cast<const void*>(member)) - offset_from_pointer_to_member(ptr_to_member)
+ )
+ );
}
} //namespace detail {
diff --git a/boost/intrusive/detail/preprocessor.hpp b/boost/intrusive/detail/preprocessor.hpp
index de662809e3..348b104bb0 100644
--- a/boost/intrusive/detail/preprocessor.hpp
+++ b/boost/intrusive/detail/preprocessor.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
@@ -18,7 +18,7 @@
#include <boost/intrusive/detail/config_begin.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/comma_if.hpp>
#include <boost/preprocessor/control/expr_if.hpp>
diff --git a/boost/intrusive/detail/rbtree_node.hpp b/boost/intrusive/detail/rbtree_node.hpp
index dbe0130024..b76582bb61 100644
--- a/boost/intrusive/detail/rbtree_node.hpp
+++ b/boost/intrusive/detail/rbtree_node.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009.
+// (C) Copyright Ion Gaztanaga 2006-2012.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -164,13 +164,13 @@ struct rbtree_node_traits
, OptimizeSize &&
(max_pointer_plus_bits
< VoidPointer
- , detail::alignment_of<compact_rbtree_node<VoidPointer> >::value
+ , detail::alignment_of<compact_rbtree_node<VoidPointer> >::value
>::value >= 1)
>
{};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/detail/slist_node.hpp b/boost/intrusive/detail/slist_node.hpp
index 5b96c09742..0eddbcd69a 100644
--- a/boost/intrusive/detail/slist_node.hpp
+++ b/boost/intrusive/detail/slist_node.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -43,13 +43,13 @@ struct slist_node_traits
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
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)
- { 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:
template<class Container, bool IsConst>
class slist_iterator
@@ -68,7 +68,7 @@ class slist_iterator
typedef typename node_traits::node_ptr node_ptr;
typedef typename pointer_traits
<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;
public:
@@ -95,12 +95,12 @@ class slist_iterator
{ members_.nodeptr_ = node; return static_cast<slist_iterator&>(*this); }
public:
- slist_iterator& operator++()
- {
- members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
- return static_cast<slist_iterator&> (*this);
+ slist_iterator& operator++()
+ {
+ members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
+ return static_cast<slist_iterator&> (*this);
}
-
+
slist_iterator operator++(int)
{
slist_iterator result (*this);
@@ -155,8 +155,8 @@ class slist_iterator
} members_;
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/detail/transform_iterator.hpp b/boost/intrusive/detail/transform_iterator.hpp
index 15ef3ab2c9..488db9ade8 100644
--- a/boost/intrusive/detail/transform_iterator.hpp
+++ b/boost/intrusive/detail/transform_iterator.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -71,7 +71,7 @@ class transform_iterator
{ return members_.m_it; }
//Constructors
- transform_iterator& operator++()
+ transform_iterator& operator++()
{ increment(); return *this; }
transform_iterator operator++(int)
diff --git a/boost/intrusive/detail/tree_algorithms.hpp b/boost/intrusive/detail/tree_algorithms.hpp
index 8d31d9d710..c92d39b3b9 100644
--- a/boost/intrusive/detail/tree_algorithms.hpp
+++ b/boost/intrusive/detail/tree_algorithms.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007.
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -25,20 +25,20 @@ namespace intrusive {
namespace detail {
//! This is an implementation of a binary search tree.
-//! 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
+//! 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
//! implementation of iterator a pointer to a node.
-//! 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
+//! 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
//! leftmost node in the tree and the right pointer to the rightmost one.
//! This node is used to represent the end-iterator.
//!
-//! +---------+
-//! header------------------------------>| |
-//! | |
-//! +----------(left)--------| |--------(right)---------+
-//! | +---------+ |
-//! | | |
+//! +---------+
+//! header------------------------------>| |
+//! | |
+//! +----------(left)--------| |--------(right)---------+
+//! | +---------+ |
+//! | | |
//! | | (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
@@ -82,15 +82,15 @@ namespace detail {
//! <b>Static functions</b>:
//!
//! <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 node_ptr get_left(const_node_ptr n);</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 void set_right(node_ptr n, node_ptr right);</tt>
template<class NodeTraits>
class tree_algorithms
@@ -153,11 +153,11 @@ class tree_algorithms
//! <b>Requires</b>: 'node' is a node of the tree or an node 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>Throws</b>: Nothing.
static bool unique(const const_node_ptr & node)
{ return !NodeTraits::get_parent(node); }
@@ -175,15 +175,15 @@ class tree_algorithms
//! <b>Requires</b>: node1 and node2 can't be header nodes
//! of two trees.
- //!
+ //!
//! <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
//! position node1 had before the function.
- //!
- //! <b>Complexity</b>: Logarithmic.
- //!
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! node1 and node2 are not equivalent according to the ordering rules.
//!
@@ -192,22 +192,22 @@ class tree_algorithms
{
if(node1 == node2)
return;
-
+
node_ptr header1(get_header(node1)), header2(get_header(node2));
swap_nodes(node1, header1, node2, header2);
}
//! <b>Requires</b>: node1 and node2 can't be header nodes
//! of two trees with header header1 and header2.
- //!
+ //!
//! <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
//! position node1 had before the function.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! node1 and node2 are not equivalent according to the ordering rules.
//!
@@ -216,8 +216,8 @@ class tree_algorithms
{
if(node1 == node2)
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));
if(header1 != header2){
//Update header1 if necessary
@@ -347,14 +347,14 @@ class tree_algorithms
//! <b>Requires</b>: node_to_be_replaced must 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
//! 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>Note</b>: This function will break container ordering invariants if
//! new_node is not equivalent to node_to_be_replaced according to the
//! 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
//! 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
//! 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>Note</b>: This function will break container ordering invariants if
//! new_node is not equivalent to node_to_be_replaced according to the
//! ordering rules. This function is faster than erasing and inserting
@@ -388,7 +388,7 @@ class tree_algorithms
{
if(node_to_be_replaced == new_node)
return;
-
+
//Update header if necessary
if(node_to_be_replaced == NodeTraits::get_left(header)){
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>Effects</b>: Returns the next node of the tree.
- //!
+ //!
//! <b>Complexity</b>: Average constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
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>Effects</b>: Returns the previous node of the tree.
- //!
+ //!
//! <b>Complexity</b>: Average constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
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>Effects</b>: Returns the minimum node of the subtree starting at p.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the size of the subtree.
- //!
+ //!
//! <b>Throws</b>: Nothing.
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>Effects</b>: Returns the maximum node of the subtree starting at p.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the size of the subtree.
- //!
+ //!
//! <b>Throws</b>: Nothing.
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>Effects</b>: After the function unique(node) == true.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <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_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>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static bool inited(const const_node_ptr & node)
{
- return !NodeTraits::get_parent(node) &&
+ return !NodeTraits::get_parent(node) &&
!NodeTraits::get_left(node) &&
!NodeTraits::get_right(node) ;
};
@@ -546,9 +546,9 @@ class tree_algorithms
//!
//! <b>Effects</b>: Initializes the header to represent an empty tree.
//! unique(header) == true.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <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_left(header, header);
- NodeTraits::set_right(header, header);
+ NodeTraits::set_right(header, header);
}
//! <b>Requires</b>: "disposer" must be an object function
//! 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
//! except the header.
- //!
+ //!
//! <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.
- //!
+ //!
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
template<class 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>Effects</b>: Unlinks the leftmost node from the tree, and
//! updates the header link to the new leftmost node.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! 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>Effects</b>: Returns the number of nodes of the subtree.
- //!
+ //!
//! <b>Complexity</b>: Linear time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
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>Effects</b>: Returns the number of nodes of the subtree.
- //!
+ //!
//! <b>Complexity</b>: Linear time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
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
//! 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.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
{
if(header1 == header2)
return;
-
+
node_ptr tmp;
//Parent swap
@@ -734,7 +734,7 @@ class tree_algorithms
(NodeTraits::get_parent(p_left) != p ||
NodeTraits::get_parent(p_right) != p ))
//When tree size > 1 headers can't be leftmost's
- //and rightmost's parent
+ //and rightmost's parent
)){
return true;
}
@@ -750,7 +750,7 @@ class tree_algorithms
//! "key" according to "comp" or "header" if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr find
@@ -765,55 +765,73 @@ class tree_algorithms
//! KeyNodePtrCompare is a function object that induces a strict weak
//! ordering compatible with the strict weak ordering used to create the
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
//!
- //! <b>Effects</b>: Returns an a pair of node_ptr delimiting a range containing
- //! all elements that are equivalent to "key" according to "comp" or an
- //! empty range that indicates the position where those elements would be
- //! if they there are no equivalent elements.
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
- template<class KeyType, class KeyNodePtrCompare>
- static std::pair<node_ptr, node_ptr> equal_range
- (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template< class KeyType, class KeyNodePtrCompare>
+ static std::pair<node_ptr, node_ptr> bounded_range
+ ( const const_node_ptr & header
+ , const KeyType &lower_key
+ , const KeyType &upper_key
+ , KeyNodePtrCompare comp
+ , bool left_closed
+ , bool right_closed)
{
node_ptr y = uncast(header);
node_ptr x = NodeTraits::get_parent(header);
while(x){
- if(comp(x, key)){
+ //If x is less than lower_key the target
+ //range is on the right part
+ if(comp(x, lower_key)){
+ //Check for invalid input range
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(comp(x, upper_key));
x = NodeTraits::get_right(x);
}
- else if(comp(key, x)){
+ //If the upper_key is less than x, the target
+ //range is on the left part
+ else if(comp(upper_key, x)){
+ //y > upper_key
y = x;
x = NodeTraits::get_left(x);
}
else{
- node_ptr xu(x), yu(y);
- y = x, x = NodeTraits::get_left(x);
- xu = NodeTraits::get_right(xu);
-
- while(x){
- if(comp(x, key)){
- x = NodeTraits::get_right(x);
- }
- else {
- y = x;
- x = NodeTraits::get_left(x);
- }
- }
-
- while(xu){
- if(comp(key, xu)){
- yu = xu;
- xu = NodeTraits::get_left(xu);
- }
- else {
- xu = NodeTraits::get_right(xu);
- }
- }
- return std::pair<node_ptr,node_ptr> (y, yu);
+ //x is inside the bounded range( x >= lower_key && x <= upper_key),
+ //so we must split lower and upper searches
+ //
+ //Sanity check: if lower_key and upper_key are equal, then both left_closed and right_closed can't be false
+ BOOST_INTRUSIVE_INVARIANT_ASSERT(left_closed || right_closed || comp(lower_key, x) || comp(x, upper_key));
+ return std::pair<node_ptr,node_ptr>(
+ left_closed
+ //If left_closed, then comp(x, lower_key) is already the lower_bound
+ //condition so we save one comparison and go to the next level
+ //following traditional lower_bound algo
+ ? lower_bound_loop(NodeTraits::get_left(x), x, lower_key, comp)
+ //If left-open, comp(x, lower_key) is not the upper_bound algo
+ //condition so we must recheck current 'x' node with upper_bound algo
+ : upper_bound_loop(x, y, lower_key, comp)
+ ,
+ right_closed
+ //If right_closed, then comp(upper_key, x) is already the upper_bound
+ //condition so we can save one comparison and go to the next level
+ //following lower_bound algo
+ ? upper_bound_loop(NodeTraits::get_right(x), y, upper_key, comp)
+ //If right-open, comp(upper_key, x) is not the lower_bound algo
+ //condition so we must recheck current 'x' node with lower_bound algo
+ : lower_bound_loop(x, y, upper_key, comp)
+ );
}
}
return std::pair<node_ptr,node_ptr> (y, y);
@@ -824,29 +842,38 @@ class tree_algorithms
//! ordering compatible with the strict weak ordering used to create the
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
//!
+ //! <b>Effects</b>: Returns an a pair of node_ptr delimiting a range containing
+ //! all elements that are equivalent to "key" according to "comp" or an
+ //! empty range that indicates the position where those elements would be
+ //! if there are no equivalent elements.
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ template<class KeyType, class KeyNodePtrCompare>
+ static std::pair<node_ptr, node_ptr> equal_range
+ (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
+ {
+ return bounded_range(header, key, key, comp, true, true);
+ }
+
+ //! <b>Requires</b>: "header" must be the header node of a tree.
+ //! KeyNodePtrCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
+ //!
//! <b>Effects</b>: Returns an node_ptr to the first element that is
//! not less than "key" according to "comp" or "header" if that element does
//! not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr lower_bound
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{
- node_ptr y = uncast(header);
- node_ptr x = NodeTraits::get_parent(header);
- while(x){
- if(comp(x, key)){
- x = NodeTraits::get_right(x);
- }
- else {
- y = x;
- x = NodeTraits::get_left(x);
- }
- }
- return y;
+ return lower_bound_loop(NodeTraits::get_parent(header), uncast(header), key, comp);
}
//! <b>Requires</b>: "header" must be the header node of a tree.
@@ -858,40 +885,29 @@ class tree_algorithms
//! than "key" according to "comp" or "header" if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr upper_bound
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{
- node_ptr y = uncast(header);
- node_ptr x = NodeTraits::get_parent(header);
- while(x){
- if(comp(key, x)){
- y = x;
- x = NodeTraits::get_left(x);
- }
- else {
- x = NodeTraits::get_right(x);
- }
- }
- return y;
+ return upper_bound_loop(NodeTraits::get_parent(header), uncast(header), key, comp);
}
//! <b>Requires</b>: "header" must be the header node of a tree.
//! "commit_data" must have been obtained from a previous call to
//! "insert_unique_check". No objects should have been inserted or erased
//! 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
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <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
//! erased between the "insert_check" and "insert_commit" calls.
@@ -929,7 +945,7 @@ class tree_algorithms
//! KeyNodePtrCompare is a function object that induces a strict weak
//! ordering compatible with the strict weak ordering used to create the
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
- //!
+ //!
//! <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
//! a constant-time node insertion if there is no equivalent node.
@@ -940,11 +956,11 @@ class tree_algorithms
//! 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
//! insertion function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic.
//!
//! <b>Throws</b>: If "comp" throws.
- //!
+ //!
//! <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
//! in the tree: if there is an equivalent value
@@ -976,7 +992,7 @@ class tree_algorithms
while(x){
++depth;
y = x;
- x = (left_child = comp(key, x)) ?
+ x = (left_child = comp(key, x)) ?
NodeTraits::get_left(x) : (prev = y, NodeTraits::get_right(x));
}
@@ -1026,7 +1042,7 @@ class tree_algorithms
{
if(hint == header || !comp(hint, new_node)){
node_ptr prev(hint);
- if(hint == NodeTraits::get_left(header) ||
+ if(hint == NodeTraits::get_left(header) ||
!comp(new_node, (prev = prev_node(hint)))){
bool link_left = unique(header) || !NodeTraits::get_left(hint);
commit_data.link_left = link_left;
@@ -1147,13 +1163,13 @@ class tree_algorithms
}
//! <b>Requires</b>: 'node' can't be a header node.
- //!
+ //!
//! <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
//! 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.
static std::size_t depth(const const_node_ptr & node)
{
@@ -1171,18 +1187,18 @@ class tree_algorithms
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
//! 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
//! except the header.
- //!
+ //!
//! 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
//! 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.
//! 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.
template <class Cloner, class Disposer>
static void clone
@@ -1247,7 +1263,7 @@ class tree_algorithms
leftmost = insertion_point;
}
//Then clone right nodes
- else if( NodeTraits::get_right(current) &&
+ else if( NodeTraits::get_right(current) &&
!NodeTraits::get_right(insertion_point)){
current = NodeTraits::get_right(current);
node_ptr temp = insertion_point;
@@ -1300,21 +1316,21 @@ class tree_algorithms
}
//! <b>Requires</b>: p is a node of a tree.
- //!
+ //!
//! <b>Effects</b>: Returns true if p is a left child.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static bool is_left_child(const node_ptr & p)
{ return NodeTraits::get_left(NodeTraits::get_parent(p)) == p; }
//! <b>Requires</b>: p is a node of a tree.
- //!
+ //!
//! <b>Effects</b>: Returns true if p is a right child.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static bool is_right_child(const node_ptr & p)
{ return NodeTraits::get_right(NodeTraits::get_parent(p)) == p; }
@@ -1449,7 +1465,7 @@ class tree_algorithms
if(!old_root) return node_ptr();
//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
//information to restore the original relationship after
//the algorithm is applied.
@@ -1521,7 +1537,7 @@ class tree_algorithms
if(!old_root) return old_root;
//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
//information to restore the original relationship after
//the algorithm is applied.
@@ -1536,7 +1552,7 @@ class tree_algorithms
//Put old_root as right child
NodeTraits::set_right(super_root, old_root);
- //Start the compression algorithm
+ //Start the compression algorithm
node_ptr even_parent = super_root;
node_ptr new_root = old_root;
@@ -1578,7 +1594,7 @@ class tree_algorithms
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr get_root(const node_ptr & node)
{
@@ -1596,6 +1612,40 @@ class tree_algorithms
}
private:
+
+ template<class KeyType, class KeyNodePtrCompare>
+ static node_ptr lower_bound_loop
+ (node_ptr x, node_ptr y, const KeyType &key, KeyNodePtrCompare comp)
+ {
+ while(x){
+ if(comp(x, key)){
+ x = NodeTraits::get_right(x);
+ }
+ else{
+ y = x;
+ x = NodeTraits::get_left(x);
+ }
+ }
+ return y;
+ }
+
+ template<class KeyType, class KeyNodePtrCompare>
+ static node_ptr upper_bound_loop
+ (node_ptr x, node_ptr y, const KeyType &key, KeyNodePtrCompare comp)
+ {
+ while(x){
+ if(comp(key, x)){
+ y = x;
+ x = NodeTraits::get_left(x);
+ }
+ else{
+ x = NodeTraits::get_right(x);
+ }
+ }
+ return y;
+ }
+
+
template<class NodePtrCompare>
static void insert_equal_check_impl
(bool upper, const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp, insert_commit_data & commit_data, std::size_t *pdepth = 0)
@@ -1609,7 +1659,7 @@ class tree_algorithms
while(x){
++depth;
y = x;
- x = comp(new_node, x) ?
+ x = comp(new_node, x) ?
NodeTraits::get_left(x) : NodeTraits::get_right(x);
}
link_left = (y == h) || comp(new_node, y);
@@ -1618,7 +1668,7 @@ class tree_algorithms
while(x){
++depth;
y = x;
- x = !comp(x, new_node) ?
+ x = !comp(x, new_node) ?
NodeTraits::get_left(x) : NodeTraits::get_right(x);
}
link_left = (y == h) || !comp(y, new_node);
@@ -1689,8 +1739,8 @@ class tree_algorithms
};
} //namespace detail {
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/detail/tree_node.hpp b/boost/intrusive/detail/tree_node.hpp
index ccbe70caf1..09fa7a4562 100644
--- a/boost/intrusive/detail/tree_node.hpp
+++ b/boost/intrusive/detail/tree_node.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007.
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -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:
template<class Container, bool IsConst>
class tree_iterator
@@ -86,7 +86,7 @@ class tree_iterator
typedef typename node_traits::node_ptr node_ptr;
typedef typename pointer_traits<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;
public:
@@ -114,12 +114,12 @@ class tree_iterator
{ members_.nodeptr_ = nodeptr; return static_cast<tree_iterator&>(*this); }
public:
- tree_iterator& operator++()
- {
- members_.nodeptr_ = node_algorithms::next_node(members_.nodeptr_);
- return static_cast<tree_iterator&> (*this);
+ tree_iterator& operator++()
+ {
+ members_.nodeptr_ = node_algorithms::next_node(members_.nodeptr_);
+ return static_cast<tree_iterator&> (*this);
}
-
+
tree_iterator operator++(int)
{
tree_iterator result (*this);
@@ -127,12 +127,12 @@ class tree_iterator
return result;
}
- tree_iterator& operator--()
- {
- members_.nodeptr_ = node_algorithms::prev_node(members_.nodeptr_);
- return static_cast<tree_iterator&> (*this);
+ tree_iterator& operator--()
+ {
+ members_.nodeptr_ = node_algorithms::prev_node(members_.nodeptr_);
+ return static_cast<tree_iterator&> (*this);
}
-
+
tree_iterator operator--(int)
{
tree_iterator result (*this);
@@ -182,8 +182,8 @@ class tree_iterator
} members_;
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/detail/utilities.hpp b/boost/intrusive/detail/utilities.hpp
index c0416203ff..c6bc798994 100644
--- a/boost/intrusive/detail/utilities.hpp
+++ b/boost/intrusive/detail/utilities.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -200,7 +200,7 @@ struct key_nodeptr_comp
key_nodeptr_comp(KeyValueCompare kcomp, const Container *cont)
: base_t(kcomp), cont_(cont)
{}
-
+
template<class T>
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::const_node_ptr const_node_ptr;
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)safe_link };
@@ -270,7 +270,7 @@ struct node_disposer
typedef typename real_value_traits::node_ptr node_ptr;
typedef detail::ebo_functor_holder<F> base_t;
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)safe_link };
@@ -378,7 +378,7 @@ struct base_hook_traits
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
(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 log2 = 0;
-
+
for(std::size_t shift = Bits >> 1; shift; shift >>= 1){
std::size_t tmp = n >> shift;
if (tmp)
@@ -529,7 +529,7 @@ inline float fast_log2 (float val)
x += 127 << 23;
caster.x = x;
val = caster.val;
- val = ((-1.0f/3) * val + 2) * val - 2.0f/3;
+ val = ((-1.0f/3.f) * val + 2.f) * val - (2.0f/3.f);
return (val + log_2);
}
@@ -655,7 +655,7 @@ struct node_to_value
, detail::store_cont_ptr_on_it<Container>::value
>::type
{
- static const bool store_container_ptr =
+ static const bool store_container_ptr =
detail::store_cont_ptr_on_it<Container>::value;
typedef typename Container::real_value_traits real_value_traits;
@@ -871,8 +871,8 @@ class reverse_iterator
};
} //namespace detail
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/detail/workaround.hpp b/boost/intrusive/detail/workaround.hpp
index 5de529fb66..87cab4befc 100644
--- a/boost/intrusive/detail/workaround.hpp
+++ b/boost/intrusive/detail/workaround.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
diff --git a/boost/intrusive/hashtable.hpp b/boost/intrusive/hashtable.hpp
index bade5cb507..2435a083c3 100644
--- a/boost/intrusive/hashtable.hpp
+++ b/boost/intrusive/hashtable.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -57,7 +57,7 @@ struct hash_bool_flags
static const std::size_t incremental_pos = 32u;
};
-template
+template
< class ValueTraits
, class Hash
, class Equal
@@ -161,7 +161,7 @@ struct get_slist_impl_from_supposed_value_traits
template<class SupposedValueTraits>
struct unordered_bucket_impl
{
- typedef typename
+ typedef typename
get_slist_impl_from_supposed_value_traits
<SupposedValueTraits>::type slist_impl;
typedef detail::bucket_impl<slist_impl> implementation_defined;
@@ -490,7 +490,7 @@ struct group_functions
//itself, as group list does not link bucket
node_ptr prev_in_group(group_traits::get_next(elem));
bool first_in_group = node_traits::get_next(prev_in_group) != elem;
-
+
if(first_in_group){
node_ptr start_pos;
if(last_in_group){
@@ -810,7 +810,7 @@ class hashtable_impl
node_cast_adaptor(const ConvertibleToF &c2f, const hashtable_impl *cont)
: base_t(base_t(c2f, cont))
{}
-
+
typename base_t::node_ptr operator()(const typename slist_impl::node &to_clone)
{ return base_t::operator()(static_cast<const node &>(to_clone)); }
@@ -824,7 +824,7 @@ class hashtable_impl
//noncopyable, movable
BOOST_MOVABLE_BUT_NOT_COPYABLE(hashtable_impl)
- enum { safemode_or_autounlink =
+ enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
(int)real_value_traits::link_mode == (int)safe_link };
@@ -879,19 +879,19 @@ class hashtable_impl
//!
//! <b>Effects</b>: Constructs an empty unordered_set, storing a reference
//! to the bucket array and copies of the key_hasher and equal_func functors.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor or invocation of hash_func or equal_func throws.
+ //! or the copy constructor or invocation of hash_func or equal_func throws.
//!
//! <b>Notes</b>: buckets array must be disposed only after
//! *this is disposed.
hashtable_impl ( const bucket_traits &b_traits
, const hasher & hash_func = hasher()
, const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: data_(b_traits, hash_func, equal_func, v_traits)
{
priv_initialize_buckets();
@@ -905,7 +905,7 @@ class hashtable_impl
}
//! <b>Effects</b>: to-do
- //!
+ //!
hashtable_impl(BOOST_RV_REF(hashtable_impl) x)
: data_( ::boost::move(x.priv_bucket_traits())
, ::boost::move(x.priv_hasher())
@@ -927,25 +927,25 @@ class hashtable_impl
}
//! <b>Effects</b>: to-do
- //!
- hashtable_impl& operator=(BOOST_RV_REF(hashtable_impl) x)
+ //!
+ hashtable_impl& operator=(BOOST_RV_REF(hashtable_impl) x)
{ this->swap(x); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_set
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_set
//! are not deleted (i.e. no destructors are called).
- //!
- //! <b>Complexity</b>: Linear to the number of elements in the unordered_set, if
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in the unordered_set, if
//! it's a safe-mode or auto-unlink value. Otherwise constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- ~hashtable_impl()
+ ~hashtable_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the unordered_set.
- //!
+ //!
//! <b>Complexity</b>: Amortized constant time.
//! Worst case (empty unordered_set): O(this->bucket_count())
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return iterator(this->priv_begin(), this); }
@@ -955,7 +955,7 @@ class hashtable_impl
//!
//! <b>Complexity</b>: Amortized constant time.
//! Worst case (empty unordered_set): O(this->bucket_count())
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return this->cbegin(); }
@@ -965,57 +965,57 @@ class hashtable_impl
//!
//! <b>Complexity</b>: Amortized constant time.
//! Worst case (empty unordered_set): O(this->bucket_count())
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return const_iterator(this->priv_begin(), this); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the unordered_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return iterator(priv_invalid_local_it(), 0); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the unordered_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return this->cend(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the unordered_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return const_iterator(priv_invalid_local_it(), 0); }
//! <b>Effects</b>: Returns the hasher object used by the unordered_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If hasher copy-constructor throws.
hasher hash_function() const
{ return this->priv_hasher(); }
//! <b>Effects</b>: Returns the key_equal object used by the unordered_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If key_equal copy-constructor throws.
key_equal key_eq() const
{ return this->priv_equal(); }
//! <b>Effects</b>: Returns true if the container is empty.
- //!
+ //!
//! <b>Complexity</b>: if constant-time size and cache_begin options are disabled,
//! average constant time (worst case, with empty() == true: O(this->bucket_count()).
//! Otherwise constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{
@@ -1038,10 +1038,10 @@ class hashtable_impl
}
//! <b>Effects</b>: Returns the number of elements stored in the unordered_set.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this if
//! constant_time_size is false. Constant-time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{
@@ -1060,10 +1060,10 @@ class hashtable_impl
//! <b>Requires</b>: the hasher and the equality function unqualified swap
//! call should not throw.
- //!
+ //!
//! <b>Effects</b>: Swaps the contents of two unordered_sets.
//! Swaps also the contained bucket array and equality and hasher functors.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If the swap() call for the comparison or hash functors
@@ -1095,7 +1095,7 @@ class hashtable_impl
//! hash than the original node.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. The hash function and the equality
//! predicate are copied from the source.
@@ -1106,7 +1106,7 @@ class hashtable_impl
//! calling Disposer::operator()(pointer).
//!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner or hasher throw or hash or equality predicate copying
//! throws. Basic guarantee.
template <class Cloner, class Disposer>
@@ -1131,7 +1131,7 @@ class hashtable_impl
typedef node_cast_adaptor<detail::node_disposer<Disposer, hashtable_impl> > NodeDisposer;
typedef node_cast_adaptor<detail::node_cloner<Cloner, hashtable_impl> > NodeCloner;
NodeDisposer node_disp(disposer, this);
-
+
detail::exception_array_disposer<bucket_type, NodeDisposer, size_type>
rollback(dst_buckets[0], node_disp, constructed);
for( constructed = 0
@@ -1191,15 +1191,15 @@ class hashtable_impl
}
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts the value into the unordered_set.
//!
//! <b>Returns</b>: An iterator to the inserted value.
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert_equal(reference value)
@@ -1212,16 +1212,16 @@ class hashtable_impl
return priv_insert_equal_find(value, bucket_num, hash_value, it);
}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Equivalent to this->insert_equal(t) for each element in [b, e).
- //!
+ //!
//! <b>Complexity</b>: Average case O(N), where N is std::distance(b, e).
//! Worst case O(N*this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -1232,7 +1232,7 @@ class hashtable_impl
}
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Tries to inserts value into the unordered_set.
//!
//! <b>Returns</b>: If the value
@@ -1240,11 +1240,11 @@ class hashtable_impl
//! iterator to the new value and true. If there is an equivalent value
//! returns a pair containing an iterator to the already present value
//! and false.
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
std::pair<iterator, bool> insert_unique(reference value)
@@ -1254,20 +1254,20 @@ class hashtable_impl
(value, this->priv_hasher(), this->priv_equal(), commit_data);
if(!ret.second)
return ret;
- return std::pair<iterator, bool>
+ return std::pair<iterator, bool>
(this->insert_unique_commit(value, commit_data), true);
}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Equivalent to this->insert_unique(t) for each element in [b, e).
- //!
+ //!
//! <b>Complexity</b>: Average case O(N), where N is std::distance(b, e).
//! Worst case O(N*this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -1277,14 +1277,14 @@ class hashtable_impl
this->insert_unique(*b);
}
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "equal_func" must be a equality function that induces
+ //! "equal_func" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "equal_func" compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the unordered_set, using
//! a user provided key instead of the value itself.
//!
@@ -1293,11 +1293,11 @@ class hashtable_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
//!
//! <b>Throws</b>: If hash_func or equal_func throw. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
@@ -1334,16 +1334,16 @@ class hashtable_impl
//! must have been obtained from a previous call to "insert_check".
//! No objects should have been inserted or erased from the unordered_set between
//! the "insert_check" that filled "commit_data" and the call to "insert_commit".
- //!
+ //!
//! <b>Effects</b>: Inserts the value in the unordered_set using the information obtained
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Returns</b>: An iterator to the newly inserted object.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function has only sense if a "insert_check" has been
//! previously executed to fill "commit_data". No value should be inserted or
//! erased between the "insert_check" and "insert_commit" calls.
@@ -1363,62 +1363,62 @@ class hashtable_impl
return iterator(b.insert_after(b.before_begin(), *n), this);
}
- //! <b>Effects</b>: Erases the element pointed to by i.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by i.
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased element. No destructors are called.
void erase(const_iterator i)
{ this->erase_and_dispose(i, detail::null_disposer()); }
- //! <b>Effects</b>: Erases the range pointed to by b end e.
- //!
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //!
//! <b>Complexity</b>: Average case O(std::distance(b, e)),
//! worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void erase(const_iterator b, const_iterator e)
{ this->erase_and_dispose(b, e, detail::null_disposer()); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)).
//! Worst case O(this->size()).
- //!
- //! <b>Throws</b>: If the internal hasher or the equality functor throws.
+ //!
+ //! <b>Throws</b>: If the internal hasher or the equality functor throws.
//! Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
{ return this->erase(value, this->priv_hasher(), this->priv_equal()); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "equal_func" must be a equality function that induces
+ //! "equal_func" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "equal_func" compares an arbitrary key with the contained values.
//!
//! <b>Effects</b>: Erases all the elements that have the same hash and
//! compare equal with the given key.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If hash_func or equal_func throw. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyHasher, class KeyValueEqual>
@@ -1427,14 +1427,14 @@ class hashtable_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Erases the element pointed to by i.
+ //! <b>Effects</b>: Erases the element pointed to by i.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
void erase_and_dispose(const_iterator i, Disposer disposer
@@ -1452,12 +1452,12 @@ class hashtable_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Complexity</b>: Average case O(std::distance(b, e)),
//! worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -1492,15 +1492,15 @@ class hashtable_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
//! Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -1514,12 +1514,12 @@ class hashtable_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If hash_func or equal_func throw. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyHasher, class KeyValueEqual, class Disposer>
@@ -1565,13 +1565,13 @@ class hashtable_impl
return count;
}
- //! <b>Effects</b>: Erases all of the elements.
- //!
+ //! <b>Effects</b>: Erases all of the elements.
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
@@ -1581,14 +1581,14 @@ class hashtable_impl
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
- //!
- //! <b>Effects</b>: Erases all of the elements.
- //!
+ //!
+ //! <b>Effects</b>: Erases all of the elements.
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -1606,25 +1606,25 @@ class hashtable_impl
}
//! <b>Effects</b>: Returns the number of contained elements with the given value
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
size_type count(const_reference value) const
{ return this->count(value, this->priv_hasher(), this->priv_equal()); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "equal_func" must be a equality function that induces
+ //! "equal_func" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "equal_func" compares an arbitrary key with the contained values.
//!
//! <b>Effects</b>: Returns the number of contained elements with the given key
//!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If hash_func or equal throw.
template<class KeyType, class KeyHasher, class KeyValueEqual>
size_type count(const KeyType &key, const KeyHasher &hash_func, const KeyValueEqual &equal_func) const
@@ -1638,25 +1638,25 @@ class hashtable_impl
//! "value" or end() if that element does not exist.
//!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
iterator find(const_reference value)
{ return this->find(value, this->priv_hasher(), this->priv_equal()); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "equal_func" must be a equality function that induces
+ //! "equal_func" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "equal_func" compares an arbitrary key with the contained values.
//!
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
//! "key" according to the given hash and equality functor or end() if
//! that element does not exist.
//!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If hash_func or equal_func throw.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1672,29 +1672,29 @@ class hashtable_impl
return iterator(local_it, this);
}
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
//! "key" or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
const_iterator find(const_reference value) const
{ return this->find(value, this->priv_hasher(), this->priv_equal()); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "equal_func" must be a equality function that induces
+ //! "equal_func" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "equal_func" compares an arbitrary key with the contained values.
//!
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
//! "key" according to the given hasher and equality functor or end() if
//! that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If hash_func or equal_func throw.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1712,30 +1712,30 @@ class hashtable_impl
}
//! <b>Effects</b>: Returns a range containing all elements with values equivalent
- //! to value. Returns std::make_pair(this->end(), this->end()) if no such
+ //! to value. Returns std::make_pair(this->end(), this->end()) if no such
//! elements exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)). Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return this->equal_range(value, this->priv_hasher(), this->priv_equal()); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "equal_func" must be a equality function that induces
+ //! "equal_func" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "equal_func" compares an arbitrary key with the contained values.
//!
//! <b>Effects</b>: Returns a range containing all elements with equivalent
- //! keys. Returns std::make_pair(this->end(), this->end()) if no such
+ //! keys. Returns std::make_pair(this->end(), this->end()) if no such
//! elements exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(key, hash_func, equal_func)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If hash_func or the equal_func throw.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1753,31 +1753,31 @@ class hashtable_impl
}
//! <b>Effects</b>: Returns a range containing all elements with values equivalent
- //! to value. Returns std::make_pair(this->end(), this->end()) if no such
+ //! to value. Returns std::make_pair(this->end(), this->end()) if no such
//! elements exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)). Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
std::pair<const_iterator, const_iterator>
equal_range(const_reference value) const
{ return this->equal_range(value, this->priv_hasher(), this->priv_equal()); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "equal_func" must be a equality function that induces
+ //! "equal_func" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "equal_func" compares an arbitrary key with the contained values.
//!
//! <b>Effects</b>: Returns a range containing all elements with equivalent
- //! keys. Returns std::make_pair(this->end(), this->end()) if no such
+ //! keys. Returns std::make_pair(this->end(), this->end()) if no such
//! elements exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(key, hash_func, equal_func)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the hasher or equal_func throw.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1796,12 +1796,12 @@ class hashtable_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator belonging to the unordered_set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the internal hash function throws.
iterator iterator_to(reference value)
{
@@ -1810,12 +1810,12 @@ class hashtable_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator belonging to the
//! unordered_set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the internal hash function throws.
const_iterator iterator_to(const_reference value) const
{
@@ -1825,78 +1825,78 @@ class hashtable_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid local_iterator belonging to the unordered_set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static local_iterator s_local_iterator_to(reference value)
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
siterator sit = bucket_type::s_iterator_to(((hashtable_impl*)0)->priv_value_to_node(value));
- return local_iterator(sit, (hashtable_impl*)0);
+ return local_iterator(sit, (hashtable_impl*)0);
}
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_local_iterator belonging to
//! the unordered_set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static const_local_iterator s_local_iterator_to(const_reference value)
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
siterator sit = bucket_type::s_iterator_to(((hashtable_impl*)0)->priv_value_to_node(const_cast<value_type&>(value)));
- return const_local_iterator(sit, (hashtable_impl*)0);
+ return const_local_iterator(sit, (hashtable_impl*)0);
}
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid local_iterator belonging to the unordered_set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
local_iterator local_iterator_to(reference value)
{
siterator sit = bucket_type::s_iterator_to(this->priv_value_to_node(value));
- return local_iterator(sit, this);
+ return local_iterator(sit, this);
}
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_local_iterator belonging to
//! the unordered_set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_local_iterator local_iterator_to(const_reference value) const
{
siterator sit = bucket_type::s_iterator_to
(const_cast<node &>(this->priv_value_to_node(value)));
- return const_local_iterator(sit, this);
+ return const_local_iterator(sit, this);
}
//! <b>Effects</b>: Returns the number of buckets passed in the constructor
//! or the last rehash function.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type bucket_count() const
{ return this->priv_buckets_len(); }
@@ -1904,33 +1904,33 @@ class hashtable_impl
//! <b>Requires</b>: n is in the range [0, this->bucket_count()).
//!
//! <b>Effects</b>: Returns the number of elements in the nth bucket.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type bucket_size(size_type n) const
{ return this->priv_buckets()[n].size(); }
//! <b>Effects</b>: Returns the index of the bucket in which elements
//! with keys equivalent to k would be found, if any such element existed.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the hash functor throws.
//!
//! <b>Note</b>: the return value is in the range [0, this->bucket_count()).
size_type bucket(const key_type& k) const
{ return this->bucket(k, this->priv_hasher()); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
//! <b>Effects</b>: Returns the index of the bucket in which elements
//! with keys equivalent to k would be found, if any such element existed.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If hash_func throws.
//!
//! <b>Note</b>: the return value is in the range [0, this->bucket_count()).
@@ -1940,9 +1940,9 @@ class hashtable_impl
//! <b>Effects</b>: Returns the bucket array pointer passed in the constructor
//! or the last rehash function.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bucket_ptr bucket_pointer() const
{ return this->priv_buckets(); }
@@ -1951,13 +1951,13 @@ class hashtable_impl
//!
//! <b>Effects</b>: Returns a local_iterator pointing to the beginning
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
local_iterator begin(size_type n)
{ return local_iterator(this->priv_buckets()[n].begin(), this); }
@@ -1965,13 +1965,13 @@ class hashtable_impl
//!
//! <b>Effects</b>: Returns a const_local_iterator pointing to the beginning
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
const_local_iterator begin(size_type n) const
{ return this->cbegin(n); }
@@ -1979,13 +1979,13 @@ class hashtable_impl
//!
//! <b>Effects</b>: Returns a const_local_iterator pointing to the beginning
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
const_local_iterator cbegin(size_type n) const
{
siterator sit = const_cast<bucket_type&>(this->priv_buckets()[n]).begin();
@@ -1996,13 +1996,13 @@ class hashtable_impl
//!
//! <b>Effects</b>: Returns a local_iterator pointing to the end
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
local_iterator end(size_type n)
{ return local_iterator(this->priv_buckets()[n].end(), this); }
@@ -2010,11 +2010,11 @@ class hashtable_impl
//!
//! <b>Effects</b>: Returns a const_local_iterator pointing to the end
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
//! containing all of the elements in the nth bucket.
const_local_iterator end(size_type n) const
@@ -2024,13 +2024,13 @@ class hashtable_impl
//!
//! <b>Effects</b>: Returns a const_local_iterator pointing to the end
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
const_local_iterator cend(size_type n) const
{ return const_local_iterator(const_cast<bucket_type&>(this->priv_buckets()[n]).end(), this); }
@@ -2044,12 +2044,12 @@ class hashtable_impl
//! the values from the old bucket and inserts then in the new one.
//! Bucket traits hold by *this is assigned from new_bucket_traits.
//! If the container is configured as incremental<>, the split bucket is set
- //! to the new bucket_len().
+ //! to the new bucket_len().
//!
//! If store_hash option is true, this method does not use the hash function.
- //!
+ //!
//! <b>Complexity</b>: Average case linear in this->size(), worst case quadratic.
- //!
+ //!
//! <b>Throws</b>: If the hasher functor throws. Basic guarantee.
void rehash(const bucket_traits &new_bucket_traits)
{
@@ -2058,7 +2058,7 @@ class hashtable_impl
bucket_ptr old_buckets = this->priv_buckets();
size_type old_buckets_len = this->priv_buckets_len();
- //Check power of two bucket array if the option is activated
+ //Check power of two bucket array if the option is activated
BOOST_INTRUSIVE_INVARIANT_ASSERT
(!power_2_buckets || (0 == (new_buckets_len & (new_buckets_len-1u))));
@@ -2066,7 +2066,7 @@ class hashtable_impl
const bool same_buffer = old_buckets == new_buckets;
//If the new bucket length is a common factor
//of the old one we can avoid hash calculations.
- const bool fast_shrink = (!incremental) && (old_buckets_len > new_buckets_len) &&
+ const bool fast_shrink = (!incremental) && (old_buckets_len > new_buckets_len) &&
(power_2_buckets ||(old_buckets_len % new_buckets_len) == 0);
//If we are shrinking the same bucket array and it's
//is a fast shrink, just rehash the last nodes
@@ -2147,11 +2147,11 @@ class hashtable_impl
//! <b>Requires</b>:
//!
- //! <b>Effects</b>:
- //!
- //! <b>Complexity</b>:
- //!
- //! <b>Throws</b>:
+ //! <b>Effects</b>:
+ //!
+ //! <b>Complexity</b>:
+ //!
+ //! <b>Throws</b>:
//!
//! <b>Note</b>: this method is only available if incremental<true> option is activated.
bool incremental_rehash(bool grow = true)
@@ -2214,15 +2214,15 @@ class hashtable_impl
}
//! <b>Effects</b>: If new_bucket_traits.bucket_count() is not
- //! this->bucket_count()/2 or this->bucket_count()*2, or
+ //! this->bucket_count()/2 or this->bucket_count()*2, or
//! this->split_bucket() != new_bucket_traits.bucket_count() returns false
//! and does nothing.
//!
//! Otherwise, copy assigns new_bucket_traits to the internal bucket_traits
//! and transfers all the objects from old buckets to the new ones.
- //!
+ //!
//! <b>Complexity</b>: Linear to size().
- //!
+ //!
//! <b>Throws</b>: Nothing
//!
//! <b>Note</b>: this method is only available if incremental<true> option is activated.
@@ -2267,11 +2267,11 @@ class hashtable_impl
//! <b>Requires</b>:
//!
- //! <b>Effects</b>:
- //!
- //! <b>Complexity</b>:
- //!
- //! <b>Throws</b>:
+ //! <b>Effects</b>:
+ //!
+ //! <b>Complexity</b>:
+ //!
+ //! <b>Throws</b>:
size_type split_count() const
{
//This function is only available if incremental hashing is activated
@@ -2282,11 +2282,11 @@ class hashtable_impl
//! <b>Effects</b>: Returns the nearest new bucket count optimized for
//! the container that is bigger or equal than n. This suggestion can be
//! used to create bucket arrays with a size that will usually improve
- //! container's performance. If such value does not exist, the
+ //! container's performance. If such value does not exist, the
//! higher possible value is returned.
- //!
+ //!
//! <b>Complexity</b>: Amortized constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static size_type suggested_upper_bucket_count(size_type n)
{
@@ -2301,11 +2301,11 @@ class hashtable_impl
//! <b>Effects</b>: Returns the nearest new bucket count optimized for
//! the container that is smaller or equal than n. This suggestion can be
//! used to create bucket arrays with a size that will usually improve
- //! container's performance. If such value does not exist, the
+ //! container's performance. If such value does not exist, the
//! lowest possible value is returned.
- //!
+ //!
//! <b>Complexity</b>: Amortized constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static size_type suggested_lower_bucket_count(size_type n)
{
@@ -2613,7 +2613,7 @@ class hashtable_impl
bool last_in_group = (first_end_ptr <= nxt && nxt <= last_end_ptr) ||
(group_traits::get_next(nxt) != elem);
bool first_in_group = node_traits::get_next(prev_in_group) != elem;
-
+
if(first_in_group){
node_ptr start_pos;
if(last_in_group){
@@ -2684,7 +2684,7 @@ class hashtable_impl
slist_node_ptr elem(i.slist_it().pointed_node());
slist_node_ptr f_bucket_end, l_bucket_end;
if(store_hash){
- f_bucket_end = l_bucket_end =
+ f_bucket_end = l_bucket_end =
(this->priv_buckets()
[this->priv_hash_to_bucket
(this->priv_stored_hash(elem, store_hash_t()))
@@ -2720,7 +2720,7 @@ class hashtable_impl
const real_bucket_traits &rbt = this->priv_real_bucket_traits();
return rbt.bucket_begin() + rbt.bucket_count();
}
-
+
siterator priv_invalid_local_it() const
{ return priv_invalid_bucket()->end(); }
@@ -2887,7 +2887,7 @@ class hashtable_impl
if(constant_time_size && this->empty()){
return priv_invalid_local_it();
}
-
+
siterator it = previt;
++it;
@@ -3008,7 +3008,7 @@ class hashtable_impl
++count;
}
}
-
+
//If we reached the end, find the first, non-empty bucket
for(bucket_number_second = bucket_number_first+1
; bucket_number_second != this->priv_buckets_len()
@@ -3043,7 +3043,7 @@ template <class T, bool UniqueKeys, class ...Options>
struct make_hashtable_opt
{
typedef typename pack_options
- < uset_defaults<T>,
+ < uset_defaults<T>,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
#else
@@ -3061,7 +3061,7 @@ struct make_hashtable_opt
, detail::eval_value_traits<value_traits>
, detail::identity<value_traits>
>::type real_value_traits;
- typedef typename packed_options::bucket_traits specified_bucket_traits;
+ typedef typename packed_options::bucket_traits specified_bucket_traits;
//Real bucket traits must be calculated from options and calculated value_traits
typedef typename detail::get_slist_impl
@@ -3111,7 +3111,7 @@ struct make_hashtable
/// @cond
typedef hashtable_impl
< typename make_hashtable_opt
- <T, false,
+ <T, false,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
#else
@@ -3132,7 +3132,7 @@ template<class T, class ...Options>
template<class T, class O1, class O2, class O3, class O4, class O5, class O6, class O7, class O8, class O9, class O10>
#endif
class hashtable
- : public make_hashtable<T,
+ : public make_hashtable<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
#else
@@ -3140,7 +3140,7 @@ class hashtable
#endif
>::type
{
- typedef typename make_hashtable<T,
+ typedef typename make_hashtable<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
#else
@@ -3180,8 +3180,8 @@ class hashtable
#endif
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/intrusive_fwd.hpp b/boost/intrusive/intrusive_fwd.hpp
index dc185667e0..c95767ef35 100644
--- a/boost/intrusive/intrusive_fwd.hpp
+++ b/boost/intrusive/intrusive_fwd.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
diff --git a/boost/intrusive/linear_slist_algorithms.hpp b/boost/intrusive/linear_slist_algorithms.hpp
index f33565528e..db4092d2c9 100644
--- a/boost/intrusive/linear_slist_algorithms.hpp
+++ b/boost/intrusive/linear_slist_algorithms.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -41,7 +41,7 @@ namespace intrusive {
//! <b>Static functions</b>:
//!
//! <tt>static node_ptr get_next(const_node_ptr n);</tt>
-//!
+//!
//! <tt>static void set_next(node_ptr n, node_ptr next);</tt>
template<class NodeTraits>
class linear_slist_algorithms
@@ -63,37 +63,37 @@ class linear_slist_algorithms
//! <b>Effects</b>: Constructs an non-used list element, putting the next
//! pointer to null:
//! <tt>NodeTraits::get_next(this_node) == node_ptr()</tt>
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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>Effects</b>: Returns true is "this_node" is the only node of a circular list:
//! or it's a not inserted node:
//! <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.
static bool unique(const_node_ptr this_node);
//! <b>Effects</b>: Returns true is "this_node" has the same state as if
//! it was inited using "init(node_ptr)"
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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>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.
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>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
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>Effects</b>: Links this_node after prev_node in the linear list.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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.
//! 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
//! them after p in p's linear list.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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
//! node of the circular list:
//! <tt>NodeTraits::get_next(this_node) == this_node</tt>.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
static void init_header(const node_ptr & this_node)
{ NodeTraits::set_next(this_node, node_ptr ()); }
//! <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.
//! the search from prev_init_node. The first node checked for equality
//! is NodeTraits::get_next(prev_init_node).
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements between prev_init_node and this_node.
- //!
+ //!
//! <b>Throws</b>: Nothing.
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); }
//! <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
//! is empty, returns 1.
- //!
- //! <b>Complexity</b>: Linear
- //!
+ //!
+ //! <b>Complexity</b>: Linear
+ //!
//! <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;
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
//! in linear lists or be empty linear lists.
- //!
+ //!
//! <b>Effects</b>: Moves all the nodes previously chained after this_node after other_node
//! and vice-versa.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: Nothing.
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);
}
- //! <b>Effects</b>: Reverses the order of elements in the list.
- //!
- //! <b>Returns</b>: The new first node of the list.
- //!
+ //! <b>Effects</b>: Reverses the order of elements in the list.
+ //!
+ //! <b>Returns</b>: The new first node of the list.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: This function is linear to the contained elements.
static node_ptr reverse(const node_ptr & p)
{
if(!p) return node_ptr();
- node_ptr i = NodeTraits::get_next(p);
+ node_ptr i = NodeTraits::get_next(p);
node_ptr first(p);
while(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
//! if there has been any movement, a null pair if n leads to no movement.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <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)
{
@@ -255,7 +255,7 @@ class linear_slist_algorithms
if(!end_found){
old_last = base_t::get_previous_node(first, node_ptr());
}
-
+
//Now link p after the new last node
NodeTraits::set_next(old_last, p);
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
//! if there has been any movement, a null pair if n leads to no movement.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <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)
{
@@ -300,7 +300,7 @@ class linear_slist_algorithms
//If the shift is a multiple of the size there is nothing to do
if(!new_before_last_pos)
return ret;
-
+
for( new_last = p
; --new_before_last_pos
; new_last = node_traits::get_next(new_last)){
@@ -319,8 +319,8 @@ class linear_slist_algorithms
}
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/link_mode.hpp b/boost/intrusive/link_mode.hpp
index 17012c93cb..c04f77526e 100644
--- a/boost/intrusive/link_mode.hpp
+++ b/boost/intrusive/link_mode.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -40,7 +40,7 @@ enum link_mode_type{
//!the container without using any function provided by the containers.
auto_unlink
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#endif //BOOST_INTRUSIVE_VALUE_LINK_TYPE_HPP
diff --git a/boost/intrusive/list.hpp b/boost/intrusive/list.hpp
index dbbf7c93f5..5450bc5d81 100644
--- a/boost/intrusive/list.hpp
+++ b/boost/intrusive/list.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -59,7 +59,7 @@ struct list_defaults
/// @endcond
-//! The class template list is an intrusive container that mimics most of the
+//! The class template list is an intrusive container that mimics most of the
//! interface of std::list as described in the C++ standard.
//!
//! The template parameter \c T is the type to be managed by the container.
@@ -118,12 +118,12 @@ class list_impl
//noncopyable
BOOST_MOVABLE_BUT_NOT_COPYABLE(list_impl)
- enum { safemode_or_autounlink =
+ enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
(int)real_value_traits::link_mode == (int)safe_link };
//Constant-time size is incompatible with auto-unlink hooks!
- BOOST_STATIC_ASSERT(!(constant_time_size &&
+ BOOST_STATIC_ASSERT(!(constant_time_size &&
((int)real_value_traits::link_mode == (int)auto_unlink)
));
@@ -196,25 +196,25 @@ class list_impl
real_value_traits &get_real_value_traits()
{ return this->get_real_value_traits(detail::bool_<external_value_traits>()); }
- //! <b>Effects</b>: constructs an empty list.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //! <b>Effects</b>: constructs an empty list.
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: If real_value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks).
list_impl(const value_traits &v_traits = value_traits())
: data_(v_traits)
- {
+ {
this->priv_size_traits().set_size(size_type(0));
- node_algorithms::init_header(this->get_root_node());
+ node_algorithms::init_header(this->get_root_node());
}
//! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
- //!
+ //!
//! <b>Effects</b>: Constructs a list equal to the range [first,last).
- //!
- //! <b>Complexity</b>: Linear in std::distance(b, e). No copy constructors are called.
- //!
+ //!
+ //! <b>Complexity</b>: Linear in std::distance(b, e). No copy constructors are called.
+ //!
//! <b>Throws</b>: If real_value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks).
template<class Iterator>
@@ -227,43 +227,43 @@ class list_impl
}
//! <b>Effects</b>: to-do
- //!
+ //!
list_impl(BOOST_RV_REF(list_impl) x)
: data_(::boost::move(x.priv_value_traits()))
{
this->priv_size_traits().set_size(size_type(0));
- node_algorithms::init_header(this->get_root_node());
+ node_algorithms::init_header(this->get_root_node());
this->swap(x);
}
//! <b>Effects</b>: to-do
- //!
- list_impl& operator=(BOOST_RV_REF(list_impl) x)
+ //!
+ list_impl& operator=(BOOST_RV_REF(list_impl) x)
{ this->swap(x); return *this; }
- //! <b>Effects</b>: If it's not a safe-mode or an auto-unlink value_type
+ //! <b>Effects</b>: If it's not a safe-mode or an auto-unlink value_type
//! the destructor does nothing
- //! (ie. no code is generated). Otherwise it detaches all elements from this.
- //! In this case the objects in the list are not deleted (i.e. no destructors
+ //! (ie. no code is generated). Otherwise it detaches all elements from this.
+ //! In this case the objects in the list are not deleted (i.e. no destructors
//! are called), but the hooks according to the ValueTraits template parameter
//! are set to their default value.
- //!
- //! <b>Complexity</b>: Linear to the number of elements in the list, if
- //! it's a safe-mode or auto-unlink value . Otherwise constant.
- ~list_impl()
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in the list, if
+ //! it's a safe-mode or auto-unlink value . Otherwise constant.
+ ~list_impl()
{}
//! <b>Requires</b>: value must be an lvalue.
- //!
+ //!
//! <b>Effects</b>: Inserts the value in the back of the list.
//! No copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
- void push_back(reference value)
+ void push_back(reference value)
{
node_ptr to_insert = get_real_value_traits().to_node_ptr(value);
if(safemode_or_autounlink)
@@ -273,31 +273,31 @@ class list_impl
}
//! <b>Requires</b>: value must be an lvalue.
- //!
+ //!
//! <b>Effects</b>: Inserts the value in the front of the list.
//! No copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
- void push_front(reference value)
+ void push_front(reference value)
{
node_ptr to_insert = get_real_value_traits().to_node_ptr(value);
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(to_insert));
- node_algorithms::link_before(node_traits::get_next(this->get_root_node()), to_insert);
+ node_algorithms::link_before(node_traits::get_next(this->get_root_node()), to_insert);
this->priv_size_traits().increment();
}
//! <b>Effects</b>: Erases the last element of the list.
//! No destructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the erased element.
void pop_back()
{ return this->pop_back_and_dispose(detail::null_disposer()); }
@@ -307,11 +307,11 @@ class list_impl
//! <b>Effects</b>: Erases the last element of the list.
//! No destructors are called.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
void pop_back_and_dispose(Disposer disposer)
@@ -326,11 +326,11 @@ class list_impl
//! <b>Effects</b>: Erases the first element of the list.
//! No destructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the erased element.
void pop_front()
{ return this->pop_front_and_dispose(detail::null_disposer()); }
@@ -340,15 +340,15 @@ class list_impl
//! <b>Effects</b>: Erases the first element of the list.
//! No destructors are called.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
void pop_front_and_dispose(Disposer disposer)
- {
+ {
node_ptr to_erase = node_traits::get_next(this->get_root_node());
node_algorithms::unlink(to_erase);
this->priv_size_traits().decrement();
@@ -358,197 +358,197 @@ class list_impl
}
//! <b>Effects</b>: Returns a reference to the first element of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reference front()
+ reference front()
{ return *get_real_value_traits().to_value_ptr(node_traits::get_next(this->get_root_node())); }
//! <b>Effects</b>: Returns a const_reference to the first element of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reference front() const
+ const_reference front() const
{ return *get_real_value_traits().to_value_ptr(uncast(node_traits::get_next(this->get_root_node()))); }
//! <b>Effects</b>: Returns a reference to the last element of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reference back()
+ reference back()
{ return *get_real_value_traits().to_value_ptr(node_traits::get_previous(this->get_root_node())); }
//! <b>Effects</b>: Returns a const_reference to the last element of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reference back() const
+ const_reference back() const
{ return *get_real_value_traits().to_value_ptr(uncast(node_traits::get_previous(this->get_root_node()))); }
//! <b>Effects</b>: Returns an iterator to the first element contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator begin()
+ iterator begin()
{ return iterator(node_traits::get_next(this->get_root_node()), this); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator begin() const
+ const_iterator begin() const
{ return this->cbegin(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cbegin() const
+ const_iterator cbegin() const
{ return const_iterator(node_traits::get_next(this->get_root_node()), this); }
//! <b>Effects</b>: Returns an iterator to the end of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator end()
+ iterator end()
{ return iterator(this->get_root_node(), this); }
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator end() const
+ const_iterator end() const
{ return this->cend(); }
//! <b>Effects</b>: Returns a constant iterator to the end of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_iterator cend() const
{ return const_iterator(uncast(this->get_root_node()), this); }
- //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
- //! of the reversed list.
- //!
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
+ //! of the reversed list.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
reverse_iterator rbegin()
{ return reverse_iterator(this->end()); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed list.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed list.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rbegin() const
+ const_reverse_iterator rbegin() const
{ return this->crbegin(); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed list.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed list.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crbegin() const
+ const_reverse_iterator crbegin() const
{ return const_reverse_iterator(end()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
- //! of the reversed list.
- //!
+ //! of the reversed list.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rend()
+ reverse_iterator rend()
{ return reverse_iterator(begin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed list.
- //!
+ //! of the reversed list.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rend() const
+ const_reverse_iterator rend() const
{ return this->crend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed list.
- //!
+ //! of the reversed list.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crend() const
+ const_reverse_iterator crend() const
{ return const_reverse_iterator(this->begin()); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of list.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the list associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static list_impl &container_from_end_iterator(iterator end_iterator)
{ return list_impl::priv_container_from_end_iterator(end_iterator); }
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of list.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the list associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const list_impl &container_from_end_iterator(const_iterator end_iterator)
{ return list_impl::priv_container_from_end_iterator(end_iterator); }
//! <b>Effects</b>: Returns the number of the elements contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements contained in the list.
//! if constant-time size option is disabled. Constant time otherwise.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
size_type size() const
{
if(constant_time_size)
return this->priv_size_traits().get_size();
else
- return node_algorithms::count(this->get_root_node()) - 1;
+ return node_algorithms::count(this->get_root_node()) - 1;
}
//! <b>Effects</b>: Returns true if the list contains no elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
bool empty() const
{ return node_algorithms::unique(this->get_root_node()); }
//! <b>Effects</b>: Swaps the elements of x and *this.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
void swap(list_impl& other)
{
- node_algorithms::swap_nodes(this->get_root_node(), other.get_root_node());
+ node_algorithms::swap_nodes(this->get_root_node(), other.get_root_node());
if(constant_time_size){
size_type backup = this->priv_size_traits().get_size();
this->priv_size_traits().set_size(other.priv_size_traits().get_size());
@@ -559,11 +559,11 @@ class list_impl
//! <b>Effects</b>: Moves backwards all the elements, so that the first
//! element becomes the second, the second becomes the third...
//! the last element becomes the first one.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of shifts.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
void shift_backwards(size_type n = 1)
{ node_algorithms::move_forward(this->get_root_node(), n); }
@@ -571,11 +571,11 @@ class list_impl
//! <b>Effects</b>: Moves forward all the elements, so that the second
//! element becomes the first, the third becomes the second...
//! the first element becomes the last one.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of shifts.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
void shift_forward(size_type n = 1)
{ node_algorithms::move_backwards(this->get_root_node(), n); }
@@ -587,9 +587,9 @@ class list_impl
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
iterator erase(const_iterator i)
@@ -602,13 +602,13 @@ class list_impl
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of erased elements if it's a safe-mode
//! or auto-unlink value, or constant-time size is enabled. Constant-time otherwise.
- //!
- //! <b>Note</b>: Invalidates the iterators (but not the references) to the
+ //!
+ //! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements.
iterator erase(const_iterator b, const_iterator e)
{
@@ -629,13 +629,13 @@ class list_impl
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of erased elements if it's a safe-mode
//! or auto-unlink value is enabled. Constant-time otherwise.
- //!
- //! <b>Note</b>: Invalidates the iterators (but not the references) to the
+ //!
+ //! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements.
iterator erase(const_iterator b, const_iterator e, difference_type n)
{
@@ -662,9 +662,9 @@ class list_impl
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template <class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
@@ -693,11 +693,11 @@ class list_impl
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements erased.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators to the erased elements.
template <class Disposer>
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer)
@@ -717,17 +717,17 @@ class list_impl
//! <b>Effects</b>: Erases all the elements of the container.
//! No destructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements of the list.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the erased elements.
void clear()
{
if(safemode_or_autounlink){
- this->clear_and_dispose(detail::null_disposer());
+ this->clear_and_dispose(detail::null_disposer());
}
else{
node_algorithms::init_header(this->get_root_node());
@@ -740,11 +740,11 @@ class list_impl
//! <b>Effects</b>: Erases all the elements of the container.
//! No destructors are called.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements of the list.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators to the erased elements.
template <class Disposer>
void clear_and_dispose(Disposer disposer)
@@ -765,15 +765,15 @@ class list_impl
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const list_impl &src, Cloner cloner, Disposer disposer)
@@ -793,11 +793,11 @@ class list_impl
//! <b>Effects</b>: Inserts the value before the position pointed by p.
//!
//! <b>Returns</b>: An iterator to the inserted element.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time. No copy constructors are called.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
iterator insert(const_iterator p, reference value)
{
@@ -809,16 +809,16 @@ class list_impl
return iterator(to_insert, this);
}
- //! <b>Requires</b>: Dereferencing iterator must yield
+ //! <b>Requires</b>: Dereferencing iterator must yield
//! an lvalue of type value_type and p must be a valid iterator of *this.
- //!
+ //!
//! <b>Effects</b>: Inserts the range pointed by b and e before the position p.
//! No copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements inserted.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
template<class Iterator>
void insert(const_iterator p, Iterator b, Iterator e)
@@ -827,19 +827,19 @@ class list_impl
this->insert(p, *b);
}
- //! <b>Requires</b>: Dereferencing iterator must yield
+ //! <b>Requires</b>: Dereferencing iterator must yield
//! an lvalue of type value_type.
- //!
+ //!
//! <b>Effects</b>: Clears the list and inserts the range pointed by b and e.
//! No destructors or copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements inserted plus
//! linear to the elements contained in the list if it's a safe-mode
//! or auto-unlink value.
//! Linear to the number of elements inserted in the list otherwise.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements.
template<class Iterator>
@@ -851,18 +851,18 @@ class list_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Requires</b>: Dereferencing iterator must yield
+ //! <b>Requires</b>: Dereferencing iterator must yield
//! an lvalue of type value_type.
- //!
+ //!
//! <b>Effects</b>: Clears the list and inserts the range pointed by b and e.
//! No destructors or copy constructors are called.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements inserted plus
//! linear to the elements contained in the list.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements.
template<class Iterator, class Disposer>
@@ -880,7 +880,7 @@ class list_impl
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of
//! this list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, list_impl& x)
@@ -897,15 +897,15 @@ class list_impl
//! <b>Requires</b>: p must be a valid iterator of *this.
//! new_ele must point to an element contained in list x.
- //!
- //! <b>Effects</b>: Transfers the value pointed by new_ele, from list x to this list,
+ //!
+ //! <b>Effects</b>: Transfers the value pointed by new_ele, from list x to this list,
//! before the the element pointed by p. No destructors or copy constructors are called.
- //! If p == new_ele or p == ++new_ele, this function is a null operation.
- //!
+ //! If p == new_ele or p == ++new_ele, this function is a null operation.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, list_impl&x, const_iterator new_ele)
@@ -917,15 +917,15 @@ class list_impl
//! <b>Requires</b>: p must be a valid iterator of *this.
//! start and end must point to elements contained in list x.
- //!
- //! <b>Effects</b>: Transfers the range pointed by start and end from list x to this list,
+ //!
+ //! <b>Effects</b>: Transfers the range pointed by start and end from list x to this list,
//! before the the element pointed by p. No destructors or copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements transferred
//! if constant-time size option is enabled. Constant-time otherwise.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, list_impl&x, const_iterator start, const_iterator end)
@@ -939,14 +939,14 @@ class list_impl
//! <b>Requires</b>: p must be a valid iterator of *this.
//! start and end must point to elements contained in list x.
//! n == std::distance(start, end)
- //!
- //! <b>Effects</b>: Transfers the range pointed by start and end from list x to this list,
+ //!
+ //! <b>Effects</b>: Transfers the range pointed by start and end from list x to this list,
//! before the the element pointed by p. No destructors or copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, list_impl&x, const_iterator start, const_iterator end, difference_type n)
@@ -966,25 +966,25 @@ class list_impl
}
}
- //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
+ //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
- //!
+ //!
//! <b>Throws</b>: If real_value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or std::less<value_type> throws. Basic guarantee.
//!
//! <b>Notes</b>: Iterators and references are not invalidated.
- //!
+ //!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
- void sort()
+ void sort()
{ this->sort(std::less<value_type>()); }
//! <b>Requires</b>: p must be a comparison function that induces a strict weak ordering
- //!
- //! <b>Effects</b>: This function sorts the list *this according to p. The sort is
+ //!
+ //! <b>Effects</b>: This function sorts the list *this according to p. The sort is
//! stable, that is, the relative order of equivalent elements is preserved.
- //!
+ //!
//! <b>Throws</b>: If real_value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or the predicate throws. Basic guarantee.
@@ -992,13 +992,13 @@ class list_impl
//! <b>Notes</b>: This won't throw if list_base_hook<> or
//! list_member_hook are used.
//! Iterators and references are not invalidated.
- //!
+ //!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
template<class Predicate>
void sort(Predicate p)
{
- if(node_traits::get_next(this->get_root_node())
+ if(node_traits::get_next(this->get_root_node())
!= node_traits::get_previous(this->get_root_node())){
list_impl carry(this->priv_value_traits());
detail::array_initializer<list_impl, 64> counter(this->priv_value_traits());
@@ -1021,32 +1021,32 @@ class list_impl
}
//! <b>Effects</b>: This function removes all of x's elements and inserts them
- //! in order into *this according to std::less<value_type>. The merge is stable;
- //! that is, if an element from *this is equivalent to one from x, then the element
- //! from *this will precede the one from x.
- //!
+ //! in order into *this according to std::less<value_type>. The merge is stable;
+ //! that is, if an element from *this is equivalent to one from x, then the element
+ //! from *this will precede the one from x.
+ //!
//! <b>Throws</b>: If std::less<value_type> throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated
void merge(list_impl& x)
{ this->merge(x, std::less<value_type>()); }
//! <b>Requires</b>: p must be a comparison function that induces a strict weak
//! ordering and both *this and x must be sorted according to that ordering
- //! The lists x and *this must be distinct.
- //!
+ //! The lists x and *this must be distinct.
+ //!
//! <b>Effects</b>: This function removes all of x's elements and inserts them
- //! in order into *this. The merge is stable; that is, if an element from *this is
- //! equivalent to one from x, then the element from *this will precede the one from x.
- //!
+ //! in order into *this. The merge is stable; that is, if an element from *this is
+ //! equivalent to one from x, then the element from *this will precede the one from x.
+ //!
//! <b>Throws</b>: If the predicate throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated.
template<class Predicate>
void merge(list_impl& x, Predicate p)
@@ -1073,23 +1073,23 @@ class list_impl
}
}
- //! <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>Complexity</b>: This function is linear time.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated
void reverse()
{ node_algorithms::reverse(this->get_root_node()); }
//! <b>Effects</b>: Removes all the elements that compare equal to value.
//! No destructors are called.
- //!
+ //!
//! <b>Throws</b>: If std::equal_to<value_type> throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
void remove(const_reference value)
@@ -1101,9 +1101,9 @@ class list_impl
//! Disposer::operator()(pointer) is called for every removed element.
//!
//! <b>Throws</b>: If std::equal_to<value_type> throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class Disposer>
@@ -1112,11 +1112,11 @@ class list_impl
//! <b>Effects</b>: Removes all the elements for which a specified
//! predicate is satisfied. No destructors are called.
- //!
+ //!
//! <b>Throws</b>: If pred throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: Linear time. It performs exactly size() calls to the predicate.
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class Pred>
@@ -1130,7 +1130,7 @@ class list_impl
//! Disposer::operator()(pointer) is called for every removed element.
//!
//! <b>Throws</b>: If pred throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
//!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
@@ -1150,26 +1150,26 @@ class list_impl
}
}
- //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
+ //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that are equal from the list. No destructors are called.
- //!
+ //!
//! <b>Throws</b>: If std::equal_to<value_type throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: Linear time (size()-1 comparisons calls to pred()).
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
void unique()
{ this->unique_and_dispose(std::equal_to<value_type>(), detail::null_disposer()); }
- //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
+ //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that satisfy some binary predicate from the list.
//! No destructors are called.
- //!
+ //!
//! <b>Throws</b>: If pred throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: Linear time (size()-1 comparisons equality comparisons).
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class BinaryPredicate>
@@ -1178,14 +1178,14 @@ class list_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
+ //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that are equal from the list.
//! Disposer::operator()(pointer) is called for every removed element.
- //!
+ //!
//! <b>Throws</b>: If std::equal_to<value_type throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: Linear time (size()-1) comparisons equality comparisons.
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class Disposer>
@@ -1194,14 +1194,14 @@ class list_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
+ //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that satisfy some binary predicate from the list.
//! Disposer::operator()(pointer) is called for every removed element.
- //!
+ //!
//! <b>Throws</b>: If pred throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: Linear time (size()-1) comparisons equality comparisons.
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class BinaryPredicate, class Disposer>
@@ -1226,13 +1226,13 @@ class list_impl
}
//! <b>Requires</b>: value must be a reference to a value inserted in a list.
- //!
+ //!
//! <b>Effects</b>: This function returns a const_iterator pointing to the element
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated.
//! This static function is available only if the <i>value traits</i>
//! is stateless.
@@ -1244,17 +1244,17 @@ class list_impl
}
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
- //!
+ //!
//! <b>Effects</b>: This function returns an iterator pointing to the element.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated.
//! This static function is available only if the <i>value traits</i>
//! is stateless.
- static const_iterator s_iterator_to(const_reference value)
+ static const_iterator s_iterator_to(const_reference value)
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(const_cast<reference> (value))));
@@ -1262,13 +1262,13 @@ class list_impl
}
//! <b>Requires</b>: value must be a reference to a value inserted in a list.
- //!
+ //!
//! <b>Effects</b>: This function returns a const_iterator pointing to the element
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated.
iterator iterator_to(reference value)
{
@@ -1277,13 +1277,13 @@ class list_impl
}
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
- //!
+ //!
//! <b>Effects</b>: This function returns an iterator pointing to the element.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated.
const_iterator iterator_to(const_reference value) const
{
@@ -1434,7 +1434,7 @@ struct make_list
{
/// @cond
typedef typename pack_options
- < list_defaults<T>,
+ < list_defaults<T>,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3
#else
@@ -1466,7 +1466,7 @@ template<class T, class O1, class O2, class O3>
template<class T, class ...Options>
#endif
class list
- : public make_list<T,
+ : public make_list<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3
#else
@@ -1475,7 +1475,7 @@ class list
>::type
{
typedef typename make_list
- <T,
+ <T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3
#else
@@ -1517,8 +1517,8 @@ class list
#endif
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/list_hook.hpp b/boost/intrusive/list_hook.hpp
index ed93434a3f..b674868242 100644
--- a/boost/intrusive/list_hook.hpp
+++ b/boost/intrusive/list_hook.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -44,7 +44,7 @@ struct make_list_base_hook
{
/// @cond
typedef typename pack_options
- < hook_defaults,
+ < hook_defaults,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3
#else
@@ -64,13 +64,13 @@ struct make_list_base_hook
//! Derive a class from this hook in order to store objects of that class
//! in an list.
-//!
+//!
//! The hook admits the following options: \c tag<>, \c void_pointer<> and
//! \c link_mode<>.
//!
-//! \c tag<> defines a tag to identify the node.
-//! 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
+//! \c tag<> defines a tag to identify the node.
+//! 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
//! unique tag.
//!
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
@@ -96,27 +96,27 @@ class list_base_hook
public:
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
list_base_hook();
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
- //!
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
//! <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
//! move-semantics.
list_base_hook(const list_base_hook& );
//! <b>Effects</b>: Empty function. The argument is ignored.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Rationale</b>: Providing an assignment operator
- //! makes classes using the hook STL-compliant without forcing the
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Rationale</b>: Providing an assignment operator
+ //! makes classes using the hook STL-compliant without forcing the
//! user to do some additional work. \c swap can be used to emulate
//! move-semantics.
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
//! 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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
~list_base_hook();
- //! <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
- //! 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
- //! 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
- //! after the swap-operation the other element is not in a container.
- //! Iterators to e1 and e2 related to those nodes are invalidated.
+ //! <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
+ //! 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
+ //! 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
+ //! after the swap-operation the other element is not in a container.
+ //! 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);
//! <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
- //! otherwise. This function can be used to test whether \c list::iterator_to
- //! will return a valid iterator.
+ //! otherwise. This function can be used to test whether \c list::iterator_to
+ //! will return a valid iterator.
//!
- //! <b>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
bool is_linked() const;
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
void unlink();
#endif
};
@@ -171,7 +171,7 @@ struct make_list_member_hook
{
/// @cond
typedef typename pack_options
- < hook_defaults,
+ < hook_defaults,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3
#else
@@ -191,10 +191,10 @@ struct make_list_member_hook
//! Store this hook in a class to be inserted
//! in an list.
-//!
+//!
//! The hook admits the following options: \c void_pointer<> and
//! \c link_mode<>.
-//!
+//!
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
//! \c auto_unlink or \c safe_link).
//!
@@ -218,27 +218,27 @@ class list_member_hook
public:
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
list_member_hook();
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
- //!
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
//! <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
//! move-semantics.
list_member_hook(const list_member_hook& );
//! <b>Effects</b>: Empty function. The argument is ignored.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Rationale</b>: Providing an assignment operator
- //! makes classes using the hook STL-compliant without forcing the
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Rationale</b>: Providing an assignment operator
+ //! makes classes using the hook STL-compliant without forcing the
//! user to do some additional work. \c swap can be used to emulate
//! move-semantics.
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
//! 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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
~list_member_hook();
- //! <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
- //! 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
- //! 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
- //! after the swap-operation the other element is not in a container.
- //! Iterators to e1 and e2 related to those nodes are invalidated.
+ //! <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
+ //! 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
+ //! 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
+ //! after the swap-operation the other element is not in a container.
+ //! 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);
//! <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
- //! otherwise. This function can be used to test whether \c list::iterator_to
- //! will return a valid iterator.
+ //! otherwise. This function can be used to test whether \c list::iterator_to
+ //! will return a valid iterator.
//!
- //! <b>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
bool is_linked() const;
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
void unlink();
#endif
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/member_value_traits.hpp b/boost/intrusive/member_value_traits.hpp
index 378c4e05b8..0462dbd65d 100644
--- a/boost/intrusive/member_value_traits.hpp
+++ b/boost/intrusive/member_value_traits.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -54,17 +54,17 @@ struct member_value_traits
static pointer to_value_ptr(const node_ptr &n)
{
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)
{
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 boost
+} //namespace intrusive
+} //namespace boost
#endif //BOOST_INTRUSIVE_MEMBER_VALUE_TRAITS_HPP
diff --git a/boost/intrusive/options.hpp b/boost/intrusive/options.hpp
index 4cdeccdeaa..e657438836 100644
--- a/boost/intrusive/options.hpp
+++ b/boost/intrusive/options.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -245,7 +245,7 @@ struct compare
//!alpha value that does not need floating-point operations.
//!
//!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
//!to be stored in the container.
//!
@@ -567,7 +567,7 @@ struct compare_hash
//!This option setter specifies if the hash container will use incremental
//!hashing. With incremental hashing the cost of hash table expansion is spread
-//!out across each hash table insertion operation, as opposed to be incurred all at once.
+//!out across each hash table insertion operation, as opposed to be incurred all at once.
//!Therefore linear hashing is well suited for interactive applications or real-time
//!appplications where the worst-case insertion time of non-incremental hash containers
//!(rehashing the whole bucket array) is not admisible.
@@ -651,9 +651,9 @@ struct pack_options
, O9
>::type
, O10
- >::type
+ >::type
, O11
- >::type
+ >::type
type;
};
#else
@@ -666,7 +666,7 @@ struct index_tuple{};
template<std::size_t Num, typename Tuple = index_tuple<> >
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...> >
: build_number_seq<Num - 1, index_tuple<Indexes..., sizeof...(Indexes)> >
{};
diff --git a/boost/intrusive/parent_from_member.hpp b/boost/intrusive/parent_from_member.hpp
index 882c073531..f4658e5c5c 100644
--- a/boost/intrusive/parent_from_member.hpp
+++ b/boost/intrusive/parent_from_member.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2010-2010
+// (C) Copyright Ion Gaztanaga 2010-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -20,7 +20,7 @@ namespace intrusive {
//! Given a pointer to a member and its corresponding pointer to data 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.
template<class Parent, class 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,
//! 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.
template<class Parent, class Member>
inline const Parent *get_parent_from_member(const Member *member, const Member Parent::* ptr_to_member)
diff --git a/boost/intrusive/pointer_plus_bits.hpp b/boost/intrusive/pointer_plus_bits.hpp
index 10b2fe0eb9..a2a9f1bf72 100644
--- a/boost/intrusive/pointer_plus_bits.hpp
+++ b/boost/intrusive/pointer_plus_bits.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -63,7 +63,7 @@ struct pointer_plus_bits<T*, NumBits>
static void set_pointer(pointer &n, pointer p)
{
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)
@@ -76,7 +76,7 @@ struct pointer_plus_bits<T*, NumBits>
}
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#endif //BOOST_INTRUSIVE_POINTER_PLUS_BITS_HPP
diff --git a/boost/intrusive/pointer_traits.hpp b/boost/intrusive/pointer_traits.hpp
index 9f7d2fa443..3ed1afb032 100644
--- a/boost/intrusive/pointer_traits.hpp
+++ b/boost/intrusive/pointer_traits.hpp
@@ -6,7 +6,7 @@
//
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
@@ -52,7 +52,7 @@ struct pointer_traits
typedef unspecified_type difference_type;
//!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.
//!
//!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;
//!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.
//!
typedef element_type &reference;
@@ -232,7 +232,7 @@ struct pointer_traits<T*>
template <class U> struct rebind_pointer
{ typedef U* type; };
-
+
//! <b>Returns</b>: addressof(r)
//!
static pointer pointer_to(reference r)
diff --git a/boost/intrusive/rbtree.hpp b/boost/intrusive/rbtree.hpp
index 26dfb4d890..1c0c30edcb 100644
--- a/boost/intrusive/rbtree.hpp
+++ b/boost/intrusive/rbtree.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -64,8 +64,8 @@ struct set_defaults
/// @endcond
//! The class template rbtree is an intrusive red-black tree container, that
-//! is used to construct intrusive set and multiset containers. The no-throw
-//! guarantee holds only, if the value_compare object
+//! is used to construct intrusive set and multiset containers. The no-throw
+//! guarantee holds only, if the value_compare object
//! doesn't throw.
//!
//! The template parameter \c T is the type to be managed by the container.
@@ -126,7 +126,7 @@ class rbtree_impl
//noncopyable
BOOST_MOVABLE_BUT_NOT_COPYABLE(rbtree_impl)
- enum { safemode_or_autounlink =
+ enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
(int)real_value_traits::link_mode == (int)safe_link };
@@ -217,18 +217,18 @@ class rbtree_impl
typedef typename node_algorithms::insert_commit_data insert_commit_data;
- //! <b>Effects</b>: Constructs an empty tree.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //! <b>Effects</b>: Constructs an empty tree.
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or the copy constructorof the value_compare object throws. Basic guarantee.
rbtree_impl( const value_compare &cmp = value_compare()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: data_(cmp, v_traits)
- {
- node_algorithms::init_header(this->priv_header_ptr());
+ {
+ node_algorithms::init_header(this->priv_header_ptr());
this->priv_size_traits().set_size(size_type(0));
}
@@ -240,7 +240,7 @@ class rbtree_impl
//!
//! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
//! comp and otherwise N * log N, where N is the distance between first and last.
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or the copy constructor/operator() of the value_compare object throws. Basic guarantee.
@@ -259,58 +259,58 @@ class rbtree_impl
}
//! <b>Effects</b>: to-do
- //!
+ //!
rbtree_impl(BOOST_RV_REF(rbtree_impl) x)
: data_(::boost::move(x.priv_comp()), ::boost::move(x.priv_value_traits()))
{
- node_algorithms::init_header(this->priv_header_ptr());
+ node_algorithms::init_header(this->priv_header_ptr());
this->priv_size_traits().set_size(size_type(0));
this->swap(x);
}
//! <b>Effects</b>: to-do
- //!
- rbtree_impl& operator=(BOOST_RV_REF(rbtree_impl) x)
+ //!
+ rbtree_impl& operator=(BOOST_RV_REF(rbtree_impl) x)
{ this->swap(x); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the set
- //! are not deleted (i.e. no destructors are called), but the nodes according to
- //! the value_traits template parameter are reinitialized and thus can be reused.
- //!
- //! <b>Complexity</b>: Linear to elements contained in *this.
- //!
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the set
+ //! are not deleted (i.e. no destructors are called), but the nodes according to
+ //! the value_traits template parameter are reinitialized and thus can be reused.
+ //!
+ //! <b>Complexity</b>: Linear to elements contained in *this.
+ //!
//! <b>Throws</b>: Nothing.
- ~rbtree_impl()
+ ~rbtree_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return iterator (node_traits::get_left(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return cbegin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return const_iterator (node_traits::get_left(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return iterator (this->priv_header_ptr(), this); }
@@ -318,138 +318,138 @@ class rbtree_impl
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the tree.
//!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return cend(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return const_iterator (uncast(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
//! reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rbegin()
{ return reverse_iterator(end()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rbegin() const
{ return const_reverse_iterator(end()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crbegin() const
{ return const_reverse_iterator(end()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rend()
{ return reverse_iterator(begin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rend() const
{ return const_reverse_iterator(begin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crend() const
{ return const_reverse_iterator(begin()); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of rbtree.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the rbtree associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static rbtree_impl &container_from_end_iterator(iterator end_iterator)
{ return priv_container_from_end_iterator(end_iterator); }
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of rbtree.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the rbtree associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const rbtree_impl &container_from_end_iterator(const_iterator end_iterator)
{ return priv_container_from_end_iterator(end_iterator); }
//! <b>Precondition</b>: it must be a valid iterator
//! of rbtree.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the tree associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static rbtree_impl &container_from_iterator(iterator it)
{ return priv_container_from_iterator(it); }
//! <b>Precondition</b>: it must be a valid end const_iterator
//! of rbtree.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the tree associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static const rbtree_impl &container_from_iterator(const_iterator it)
{ return priv_container_from_iterator(it); }
//! <b>Effects</b>: Returns the value_compare object used by the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If value_compare copy-constructor throws.
value_compare value_comp() const
{ return priv_comp(); }
//! <b>Effects</b>: Returns true if the container is empty.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return node_algorithms::unique(this->priv_header_ptr()); }
//! <b>Effects</b>: Returns the number of elements stored in the tree.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this
//! if constant-time size option is disabled. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{
@@ -461,9 +461,9 @@ class rbtree_impl
}
//! <b>Effects</b>: Swaps the contents of two rbtrees.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the comparison functor's swap call throws.
void swap(rbtree_impl& other)
{
@@ -480,14 +480,14 @@ class rbtree_impl
}
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts value into the tree before the upper bound.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert_equal(reference value)
@@ -505,16 +505,16 @@ class rbtree_impl
//! <b>Requires</b>: value must be an lvalue, and "hint" must be
//! a valid iterator.
- //!
+ //!
//! <b>Effects</b>: Inserts x into the tree, using "hint" as a hint to
//! where it will be inserted. If "hint" is the upper_bound
//! the insertion takes constant time (two comparisons in the worst case)
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert_equal(const_iterator hint, reference value)
@@ -530,18 +530,18 @@ class rbtree_impl
return ret;
}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Inserts a each element of a range into the tree
//! before the upper bound of the key of each element.
- //!
+ //!
//! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
//! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -553,15 +553,15 @@ class rbtree_impl
}
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts value into the tree if the value
//! is not already present.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
std::pair<iterator, bool> insert_unique(reference value)
@@ -575,16 +575,16 @@ class rbtree_impl
//! <b>Requires</b>: value must be an lvalue, and "hint" must be
//! a valid iterator
- //!
+ //!
//! <b>Effects</b>: Tries to insert x into the tree, using "hint" as a hint
//! to where it will be inserted.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time (two comparisons in the worst case)
//! if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert_unique(const_iterator hint, reference value)
@@ -596,17 +596,17 @@ class rbtree_impl
return insert_unique_commit(value, commit_data);
}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Tries to insert each element of a range into the tree.
- //!
- //! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
- //! size of the range. However, it is linear in N if the range is already sorted
+ //!
+ //! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
+ //! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -623,10 +623,10 @@ class rbtree_impl
}
}
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare. The difference is that
//! key_value_comp compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the container, using
//! a user provided key instead of the value itself.
//!
@@ -635,16 +635,16 @@ class rbtree_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic.
//!
//! <b>Throws</b>: If the key_value_comp ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! node that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that
+ //! than the value_type and this function offers the possibility to use that
//! part to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
@@ -659,18 +659,18 @@ class rbtree_impl
{
detail::key_nodeptr_comp<KeyValueCompare, rbtree_impl>
comp(key_value_comp, this);
- std::pair<node_ptr, bool> ret =
+ std::pair<node_ptr, bool> ret =
(node_algorithms::insert_unique_check
(this->priv_header_ptr(), key, comp, commit_data));
return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
}
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare. The difference is that
//! key_value_comp compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the container, using
- //! a user provided key instead of the value itself, using "hint"
+ //! a user provided key instead of the value itself, using "hint"
//! as a hint to where it will be inserted.
//!
//! <b>Returns</b>: If there is an equivalent value
@@ -678,23 +678,23 @@ class rbtree_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it's amortized
//! constant time if t is inserted immediately before hint.
//!
//! <b>Throws</b>: If the key_value_comp ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! constructing that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that key
+ //! than the value_type and this function offers the possibility to use that key
//! to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
//! "insert_commit" to insert the object in constant-time. This can give a total
//! constant-time complexity to the insertion: check(O(1)) + commit(O(1)).
- //!
+ //!
//! "commit_data" remains valid for a subsequent "insert_commit" only if no more
//! objects are inserted or erased from the container.
template<class KeyType, class KeyValueCompare>
@@ -704,7 +704,7 @@ class rbtree_impl
{
detail::key_nodeptr_comp<KeyValueCompare, rbtree_impl>
comp(key_value_comp, this);
- std::pair<node_ptr, bool> ret =
+ std::pair<node_ptr, bool> ret =
(node_algorithms::insert_unique_check
(this->priv_header_ptr(), hint.pointed_node(), key, comp, commit_data));
return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
@@ -714,16 +714,16 @@ class rbtree_impl
//! must have been obtained from a previous call to "insert_check".
//! No objects should have been inserted or erased from the container between
//! the "insert_check" that filled "commit_data" and the call to "insert_commit".
- //!
+ //!
//! <b>Effects</b>: Inserts the value in the avl_set using the information obtained
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Returns</b>: An iterator to the newly inserted object.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function has only sense if a "insert_check" has been
//! previously executed to fill "commit_data". No value should be inserted or
//! erased between the "insert_check" and "insert_commit" calls.
@@ -743,11 +743,11 @@ class rbtree_impl
//! once inserted according to the predicate
//!
//! <b>Effects</b>: Inserts x into the tree before "pos".
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if "pos" is not
//! the successor of "value" tree ordering invariant will be broken.
//! This is a low-level function to be used only for performance reasons
@@ -766,11 +766,11 @@ class rbtree_impl
//! than the greatest inserted key
//!
//! <b>Effects</b>: Inserts x into the tree in the last position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! less than the greatest inserted key tree ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -789,11 +789,11 @@ class rbtree_impl
//! than the minimum inserted key
//!
//! <b>Effects</b>: Inserts x into the tree in the first position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! greater than the minimum inserted key tree ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -808,12 +808,12 @@ class rbtree_impl
node_algorithms::push_front(this->priv_header_ptr(), to_insert);
}
- //! <b>Effects</b>: Erases the element pointed to by pos.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by pos.
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator i)
@@ -830,26 +830,26 @@ class rbtree_impl
return ret.unconst();
}
- //! <b>Effects</b>: Erases the range pointed to by b end e.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator b, const_iterator e)
{ size_type n; return private_erase(b, e, n); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
@@ -859,11 +859,11 @@ class rbtree_impl
//! according to the comparison functor "comp".
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyValueCompare>
@@ -881,14 +881,14 @@ class rbtree_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Erases the element pointed to by pos.
+ //! <b>Effects</b>: Erases the element pointed to by pos.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
@@ -909,13 +909,13 @@ class rbtree_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -931,12 +931,12 @@ class rbtree_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -950,11 +950,11 @@ class rbtree_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyValueCompare, class Disposer>
@@ -970,13 +970,13 @@ class rbtree_impl
return n;
}
- //! <b>Effects</b>: Erases all of the elements.
- //!
+ //! <b>Effects</b>: Erases all of the elements.
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
@@ -994,9 +994,9 @@ class rbtree_impl
//! each node to be erased.
//! <b>Complexity</b>: Average complexity for is at most O(log(size() + N)),
//! where N is the number of elements in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. Calls N times to disposer functor.
template<class Disposer>
@@ -1009,19 +1009,19 @@ class rbtree_impl
}
//! <b>Effects</b>: Returns the number of contained elements with the given value
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given value.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type count(const_reference value) const
{ return this->count(value, priv_comp()); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
size_type count(const KeyType &key, KeyValueCompare comp) const
@@ -1032,27 +1032,27 @@ class rbtree_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator lower_bound(const_reference value)
{ return this->lower_bound(value, priv_comp()); }
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator lower_bound(const_reference value) const
{ return this->lower_bound(value, priv_comp()); }
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
iterator lower_bound(const KeyType &key, KeyValueCompare comp)
@@ -1065,9 +1065,9 @@ class rbtree_impl
//! <b>Effects</b>: Returns a const iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
const_iterator lower_bound(const KeyType &key, KeyValueCompare comp) const
@@ -1080,9 +1080,9 @@ class rbtree_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator upper_bound(const_reference value)
{ return this->upper_bound(value, priv_comp()); }
@@ -1092,7 +1092,7 @@ class rbtree_impl
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
iterator upper_bound(const KeyType &key, KeyValueCompare comp)
@@ -1105,9 +1105,9 @@ class rbtree_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator upper_bound(const_reference value) const
{ return this->upper_bound(value, priv_comp()); }
@@ -1117,7 +1117,7 @@ class rbtree_impl
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
const_iterator upper_bound(const KeyType &key, KeyValueCompare comp) const
@@ -1128,20 +1128,20 @@ class rbtree_impl
(this->priv_header_ptr(), key, key_node_comp), this);
}
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
//! k or end() if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator find(const_reference value)
{ return this->find(value, priv_comp()); }
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
//! k or end() if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
iterator find(const KeyType &key, KeyValueCompare comp)
@@ -1152,20 +1152,20 @@ class rbtree_impl
(node_algorithms::find(this->priv_header_ptr(), key, key_node_comp), this);
}
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
//! k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator find(const_reference value) const
{ return this->find(value, priv_comp()); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
//! k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
const_iterator find(const KeyType &key, KeyValueCompare comp) const
@@ -1179,9 +1179,9 @@ class rbtree_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return this->equal_range(value, priv_comp()); }
@@ -1189,9 +1189,9 @@ class rbtree_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
std::pair<iterator,iterator> equal_range(const KeyType &key, KeyValueCompare comp)
@@ -1206,9 +1206,9 @@ class rbtree_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
std::pair<const_iterator, const_iterator>
equal_range(const_reference value) const
@@ -1217,9 +1217,9 @@ class rbtree_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
std::pair<const_iterator, const_iterator>
@@ -1232,19 +1232,117 @@ class rbtree_impl
return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
}
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ {
+ detail::key_nodeptr_comp<KeyValueCompare, rbtree_impl>
+ key_node_comp(comp, this);
+ std::pair<node_ptr, node_ptr> ret
+ (node_algorithms::bounded_range
+ (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed));
+ return std::pair<iterator, iterator>(iterator(ret.first, this), iterator(ret.second, this));
+ }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator,const_iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator,const_iterator> bounded_range
+ (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ {
+ detail::key_nodeptr_comp<KeyValueCompare, rbtree_impl>
+ key_node_comp(comp, this);
+ std::pair<node_ptr, node_ptr> ret
+ (node_algorithms::bounded_range
+ (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed));
+ return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
+ }
+
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const rbtree_impl &src, Cloner cloner, Disposer disposer)
@@ -1265,11 +1363,11 @@ class rbtree_impl
}
//! <b>Effects</b>: Unlinks the leftmost node from the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! This function is normally used to achieve a step by step
@@ -1288,14 +1386,14 @@ class rbtree_impl
//! <b>Requires</b>: replace_this must be a valid iterator of *this
//! and with_this must not be inserted in any tree.
- //!
+ //!
//! <b>Effects</b>: Replaces replace_this in its position in the
//! tree with with_this. The tree does not need to be rebalanced.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! with_this is not equivalent to *replace_this according to the
//! ordering rules. This function is faster than erasing and inserting
@@ -1311,14 +1409,14 @@ class rbtree_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
@@ -1329,17 +1427,17 @@ class rbtree_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
- static const_iterator s_iterator_to(const_reference value)
+ static const_iterator s_iterator_to(const_reference value)
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
return const_iterator (value_traits::to_node_ptr(const_cast<reference> (value)), 0);
@@ -1347,48 +1445,48 @@ class rbtree_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator iterator_to(reference value)
{ return iterator (value_traits::to_node_ptr(value), this); }
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator iterator_to(const_reference value) const
{ return const_iterator (value_traits::to_node_ptr(const_cast<reference> (value)), this); }
//! <b>Requires</b>: value shall not be in a tree.
- //!
+ //!
//! <b>Effects</b>: init_node puts the hook of a value in a well-known default
//! state.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This function puts the hook in the well-known default state
//! used by auto_unlink and safe hooks.
static void init_node(reference value)
{ node_algorithms::init(value_traits::to_node_ptr(value)); }
//! <b>Effects</b>: removes "value" from the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic time.
- //!
+ //!
//! <b>Note</b>: This static function is only usable with non-constant
//! time size containers that have stateless comparison functors.
//!
@@ -1565,7 +1663,7 @@ template<class T, class ...Options>
struct make_rbtree_opt
{
typedef typename pack_options
- < set_defaults<T>,
+ < set_defaults<T>,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1596,7 +1694,7 @@ struct make_rbtree
{
/// @cond
typedef rbtree_impl
- < typename make_rbtree_opt<T,
+ < typename make_rbtree_opt<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1616,7 +1714,7 @@ template<class T, class O1, class O2, class O3, class O4>
template<class T, class ...Options>
#endif
class rbtree
- : public make_rbtree<T,
+ : public make_rbtree<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1625,7 +1723,7 @@ class rbtree
>::type
{
typedef typename make_rbtree
- <T,
+ <T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1679,8 +1777,8 @@ class rbtree
#endif
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/rbtree_algorithms.hpp b/boost/intrusive/rbtree_algorithms.hpp
index de012c2cad..451a550a84 100644
--- a/boost/intrusive/rbtree_algorithms.hpp
+++ b/boost/intrusive/rbtree_algorithms.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009.
+// (C) Copyright Ion Gaztanaga 2006-2012.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -11,7 +11,7 @@
//
/////////////////////////////////////////////////////////////////////////////
// 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
// Silicon Graphics Computer Systems, Inc.
@@ -36,14 +36,14 @@
// representations about the suitability of this software for any
// 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
// 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
-// 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
#define BOOST_INTRUSIVE_RBTREE_ALGORITHMS_HPP
@@ -61,17 +61,17 @@
namespace boost {
namespace intrusive {
-//! rbtree_algorithms provides basic algorithms to manipulate
-//! nodes forming a red-black tree. The insertion and deletion algorithms are
-//! based on those in Cormen, Leiserson, and Rivest, Introduction to Algorithms
+//! rbtree_algorithms provides basic algorithms to manipulate
+//! nodes forming a red-black tree. The insertion and deletion algorithms are
+//! based on those in Cormen, Leiserson, and Rivest, Introduction to Algorithms
//! (MIT Press, 1990), except that
-//!
+//!
//! (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
//! begin(), and to the rightmost node of the tree, to enable linear time
//! performance when used with the generic set algorithms (set_union,
//! etc.);
-//!
+//!
//! (2) when a node being deleted has two children its successor node is
//! relinked into its place, rather than copied, so that the only
//! pointers invalidated are those referring to the deleted node.
@@ -93,23 +93,23 @@ namespace intrusive {
//! <b>Static functions</b>:
//!
//! <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 node_ptr get_left(const_node_ptr n);</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 void set_right(node_ptr n, node_ptr right);</tt>
-//!
+//!
//! <tt>static color get_color(const_node_ptr n);</tt>
-//!
+//!
//! <tt>static void set_color(node_ptr n, color c);</tt>
-//!
+//!
//! <tt>static color black();</tt>
-//!
+//!
//! <tt>static color red();</tt>
template<class NodeTraits>
class rbtree_algorithms
@@ -135,7 +135,7 @@ class rbtree_algorithms
rbtree_node_cloner(F f)
: base_t(f)
{}
-
+
node_ptr operator()(const node_ptr & 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
//! 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.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
{ return tree_algorithms::swap_tree(header1, header2); }
//! <b>Requires</b>: node1 and node2 can't be header nodes
//! of two trees.
- //!
+ //!
//! <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
//! position node1 had before the function.
- //!
- //! <b>Complexity</b>: Logarithmic.
- //!
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! node1 and node2 are not equivalent according to the ordering rules.
//!
@@ -201,22 +201,22 @@ class rbtree_algorithms
{
if(node1 == node2)
return;
-
+
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
swap_nodes(node1, header1, node2, header2);
}
//! <b>Requires</b>: node1 and node2 can't be header nodes
//! of two trees with header header1 and header2.
- //!
+ //!
//! <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
//! position node1 had before the function.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! 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);
//Swap color
color c = NodeTraits::get_color(node1);
- NodeTraits::set_color(node1, NodeTraits::get_color(node2));
- NodeTraits::set_color(node2, c);
+ NodeTraits::set_color(node1, NodeTraits::get_color(node2));
+ NodeTraits::set_color(node2, c);
}
//! <b>Requires</b>: node_to_be_replaced must 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
//! 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>Note</b>: This function will break container ordering invariants if
//! new_node is not equivalent to node_to_be_replaced according to the
//! 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
//! 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
//! 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>Note</b>: This function will break container ordering invariants if
//! new_node is not equivalent to node_to_be_replaced according to the
//! 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)
{
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>Effects</b>: Unlinks the node and rebalances the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
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>Effects</b>: Unlinks the leftmost node from the tree, and
//! updates the header link to the new leftmost node.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! 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
//! by init(...).
- //!
+ //!
//! <b>Effects</b>: Returns true if the node is initialized by init().
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static bool unique(const const_node_ptr & node)
{ return tree_algorithms::unique(node); }
//! <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>Complexity</b>: Linear time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static std::size_t count(const const_node_ptr & node)
{ return tree_algorithms::count(node); }
//! <b>Requires</b>: header is the header node of the tree.
- //!
+ //!
//! <b>Effects</b>: Returns the number of nodes above the header.
- //!
+ //!
//! <b>Complexity</b>: Linear time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static std::size_t size(const const_node_ptr & header)
{ return tree_algorithms::size(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>Complexity</b>: Average constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr next_node(const node_ptr & p)
{ return tree_algorithms::next_node(p); }
//! <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>Complexity</b>: Average constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr prev_node(const node_ptr & 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>Effects</b>: After the function unique(node) == true.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <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.
//! unique(header) == true.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
static void init_header(const node_ptr & 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
//! of that tree and z != header.
//!
//! <b>Effects</b>: Erases node "z" from the tree with header "header".
- //!
+ //!
//! <b>Complexity</b>: Amortized constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
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
//! 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
//! except the header.
- //!
+ //!
//! 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
//! 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.
//! 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.
template <class Cloner, class Disposer>
static void clone
@@ -439,13 +439,13 @@ class rbtree_algorithms
//! <b>Requires</b>: "disposer" must be an object function
//! 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
//! except the header.
- //!
+ //!
//! <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.
- //!
+ //!
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
template<class Disposer>
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
@@ -461,7 +461,7 @@ class rbtree_algorithms
//! not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
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.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr upper_bound
@@ -493,7 +493,7 @@ class rbtree_algorithms
//! "key" according to "comp" or "header" if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr find
@@ -511,13 +511,38 @@ class rbtree_algorithms
//! if they there are no equivalent elements.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static std::pair<node_ptr, node_ptr> equal_range
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{ return tree_algorithms::equal_range(header, key, comp); }
+ //! <b>Requires</b>: "header" must be the header node of a tree.
+ //! KeyNodePtrCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyNodePtrCompare>
+ static std::pair<node_ptr, node_ptr> bounded_range
+ (const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp
+ , bool left_closed, bool right_closed)
+ { return tree_algorithms::bounded_range(header, lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: "h" must be the header node of a tree.
//! NodePtrCompare is a function object that induces a strict weak
//! ordering compatible with the strict weak ordering used to create the
@@ -525,10 +550,10 @@ class rbtree_algorithms
//!
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
//! according to "comp".
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class NodePtrCompare>
static node_ptr insert_equal_upper_bound
@@ -546,10 +571,10 @@ class rbtree_algorithms
//!
//! <b>Effects</b>: Inserts new_node into the tree before the lower bound
//! according to "comp".
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class NodePtrCompare>
static node_ptr insert_equal_lower_bound
@@ -565,14 +590,14 @@ class rbtree_algorithms
//! ordering compatible with the strict weak ordering used to create the
//! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from
//! the "header"'s tree.
- //!
+ //!
//! <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
//! the insertion takes constant time (two comparisons in the worst case).
//!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time if new_node is inserted immediately before "hint".
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class NodePtrCompare>
static node_ptr insert_equal
@@ -588,13 +613,13 @@ class rbtree_algorithms
//! "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
//! check "pos" and this precondition must be guaranteed by the caller.
- //!
+ //!
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
//!
//! <b>Complexity</b>: Constant-time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
//! tree invariants might be broken.
static node_ptr insert_before
@@ -608,13 +633,13 @@ class rbtree_algorithms
//! <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
//! greatest inserted key.
- //!
+ //!
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
//!
//! <b>Complexity</b>: Constant-time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
//! tree invariants are broken. This function is slightly faster than
//! using "insert_before".
@@ -627,13 +652,13 @@ class rbtree_algorithms
//! <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
//! lowest inserted key.
- //!
+ //!
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
//!
//! <b>Complexity</b>: Constant-time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
//! tree invariants are broken. This function is slightly faster than
//! using "insert_before".
@@ -647,7 +672,7 @@ class rbtree_algorithms
//! KeyNodePtrCompare is a function object that induces a strict weak
//! ordering compatible with the strict weak ordering used to create the
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
- //!
+ //!
//! <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
//! a constant-time node insertion if there is no equivalent node.
@@ -658,11 +683,11 @@ class rbtree_algorithms
//! 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
//! insertion function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic.
//!
//! <b>Throws</b>: If "comp" throws.
- //!
+ //!
//! <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
//! in the tree: if there is an equivalent value
@@ -688,12 +713,12 @@ class rbtree_algorithms
//! ordering compatible with the strict weak ordering used to create the
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
//! "hint" is node from the "header"'s tree.
- //!
+ //!
//! <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
//! inserted and obtains the needed information to realize
- //! a constant-time node insertion if there is no equivalent node.
- //! If "hint" is the upper_bound the function has constant time
+ //! a constant-time node insertion if there is no equivalent node.
+ //! If "hint" is the upper_bound the function has constant time
//! complexity (two comparisons in the worst case).
//!
//! <b>Returns</b>: If there is an equivalent value
@@ -702,12 +727,12 @@ class rbtree_algorithms
//! 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
//! insertion function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic, but it is
//! amortized constant time if new_node should be inserted immediately before "hint".
//!
//! <b>Throws</b>: If "comp" throws.
- //!
+ //!
//! <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
//! in the tree: if there is an equivalent value
@@ -732,16 +757,16 @@ class rbtree_algorithms
//! "commit_data" must have been obtained from a previous call to
//! "insert_unique_check". No objects should have been inserted or erased
//! 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
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <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
//! erased between the "insert_check" and "insert_commit" calls.
@@ -757,7 +782,7 @@ class rbtree_algorithms
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr get_header(const node_ptr & n)
{ return tree_algorithms::get_header(n); }
@@ -766,17 +791,17 @@ class rbtree_algorithms
private:
//! <b>Requires</b>: p is a node of a tree.
- //!
+ //!
//! <b>Effects</b>: Returns true if p is the header of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static bool is_header(const const_node_ptr & p)
{
return NodeTraits::get_color(p) == NodeTraits::red() &&
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;
}
@@ -797,7 +822,7 @@ class rbtree_algorithms
NodeTraits::set_color(w, NodeTraits::red());
x = x_parent;
x_parent = NodeTraits::get_parent(x_parent);
- }
+ }
else {
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());
@@ -902,8 +927,8 @@ class rbtree_algorithms
/// @endcond
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/set.hpp b/boost/intrusive/set.hpp
index 9b0207023d..9a61560d75 100644
--- a/boost/intrusive/set.hpp
+++ b/boost/intrusive/set.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -23,9 +23,9 @@
namespace boost {
namespace intrusive {
-//! The class template set is an intrusive container, that mimics most of
+//! The class template set is an intrusive container, that mimics most of
//! the interface of std::set as described in the C++ standard.
-//!
+//!
//! The template parameter \c T is the type to be managed by the container.
//! The user can specify additional options and if no options are provided
//! default options are used.
@@ -86,30 +86,30 @@ class set_impl
/// @endcond
public:
- //! <b>Effects</b>: Constructs an empty set.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //! <b>Effects</b>: Constructs an empty set.
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor of the value_compare object throws.
+ //! or the copy constructor of the value_compare object throws.
set_impl( const value_compare &cmp = value_compare()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: tree_(cmp, v_traits)
{}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
//! cmp must be a comparison function that induces a strict weak ordering.
- //!
- //! <b>Effects</b>: Constructs an empty set and inserts elements from
+ //!
+ //! <b>Effects</b>: Constructs an empty set and inserts elements from
//! [b, e).
- //!
- //! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
+ //!
+ //! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
//! comp and otherwise N * log N, where N is std::distance(last, first).
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor/operator() of the value_compare object throws.
+ //! or the copy constructor/operator() of the value_compare object throws.
template<class Iterator>
set_impl( Iterator b, Iterator e
, const value_compare &cmp = value_compare()
@@ -118,135 +118,135 @@ class set_impl
{}
//! <b>Effects</b>: to-do
- //!
- set_impl(BOOST_RV_REF(set_impl) x)
+ //!
+ set_impl(BOOST_RV_REF(set_impl) x)
: tree_(::boost::move(x.tree_))
{}
//! <b>Effects</b>: to-do
- //!
- set_impl& operator=(BOOST_RV_REF(set_impl) x)
+ //!
+ set_impl& operator=(BOOST_RV_REF(set_impl) x)
{ tree_ = ::boost::move(x.tree_); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the set
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the set
//! are not deleted (i.e. no destructors are called).
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- ~set_impl()
+ ~set_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return tree_.cbegin(); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return tree_.cend(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
//! reversed set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rbegin()
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rbegin() const
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crbegin() const
{ return tree_.crbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rend()
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rend() const
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crend() const
{ return tree_.crend(); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of set.
- //!
+ //!
//! <b>Effects</b>: Returns a reference to the set associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static set_impl &container_from_end_iterator(iterator end_iterator)
{
@@ -257,11 +257,11 @@ class set_impl
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of set.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the set associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const set_impl &container_from_end_iterator(const_iterator end_iterator)
{
@@ -271,11 +271,11 @@ class set_impl
}
//! <b>Precondition</b>: it must be a valid iterator of set.
- //!
+ //!
//! <b>Effects</b>: Returns a reference to the set associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static set_impl &container_from_iterator(iterator it)
{
@@ -285,11 +285,11 @@ class set_impl
}
//! <b>Precondition</b>: it must be a valid const_iterator of set.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the set associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static const set_impl &container_from_iterator(const_iterator it)
{
@@ -299,42 +299,42 @@ class set_impl
}
//! <b>Effects</b>: Returns the key_compare object used by the set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If key_compare copy-constructor throws.
key_compare key_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns the value_compare object used by the set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If value_compare copy-constructor throws.
value_compare value_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns true if the container is empty.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return tree_.empty(); }
//! <b>Effects</b>: Returns the number of elements stored in the set.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this if,
//! constant-time size option is enabled. Constant-time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{ return tree_.size(); }
//! <b>Effects</b>: Swaps the contents of two sets.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the swap() call for the comparison functor
//! found using ADL throws. Strong guarantee.
void swap(set_impl& other)
@@ -344,22 +344,22 @@ class set_impl
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const set_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Tries to inserts value into the set.
//!
//! <b>Returns</b>: If the value
@@ -367,39 +367,39 @@ class set_impl
//! iterator to the new value and true. If there is an equivalent value
//! returns a pair containing an iterator to the already present value
//! and false.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
std::pair<iterator, bool> insert(reference value)
{ return tree_.insert_unique(value); }
//! <b>Requires</b>: value must be an lvalue
- //!
- //! <b>Effects</b>: Tries to to insert x into the set, using "hint"
+ //!
+ //! <b>Effects</b>: Tries to to insert x into the set, using "hint"
//! as a hint to where it will be inserted.
//!
- //! <b>Returns</b>: An iterator that points to the position where the
+ //! <b>Returns</b>: An iterator that points to the position where the
//! new element was inserted into the set.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it's amortized
//! constant time if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert(const_iterator hint, reference value)
{ return tree_.insert_unique(hint, value); }
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare. The difference is that
//! key_value_comp compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the set, using
//! a user provided key instead of the value itself.
//!
@@ -408,16 +408,16 @@ class set_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic.
//!
//! <b>Throws</b>: If the key_value_comp ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! node that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that
+ //! than the value_type and this function offers the possibility to use that
//! part to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
@@ -431,12 +431,12 @@ class set_impl
(const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data)
{ return tree_.insert_unique_check(key, key_value_comp, commit_data); }
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare. The difference is that
//! key_value_comp compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the set, using
- //! a user provided key instead of the value itself, using "hint"
+ //! a user provided key instead of the value itself, using "hint"
//! as a hint to where it will be inserted.
//!
//! <b>Returns</b>: If there is an equivalent value
@@ -444,23 +444,23 @@ class set_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it's amortized
//! constant time if t is inserted immediately before hint.
//!
//! <b>Throws</b>: If the key_value_comp ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! constructing that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that key
+ //! than the value_type and this function offers the possibility to use that key
//! to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
//! "insert_commit" to insert the object in constant-time. This can give a total
//! constant-time complexity to the insertion: check(O(1)) + commit(O(1)).
- //!
+ //!
//! "commit_data" remains valid for a subsequent "insert_commit" only if no more
//! objects are inserted or erased from the set.
template<class KeyType, class KeyValueCompare>
@@ -473,33 +473,33 @@ class set_impl
//! must have been obtained from a previous call to "insert_check".
//! No objects should have been inserted or erased from the set between
//! the "insert_check" that filled "commit_data" and the call to "insert_commit".
- //!
+ //!
//! <b>Effects</b>: Inserts the value in the set using the information obtained
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Returns</b>: An iterator to the newly inserted object.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function has only sense if a "insert_check" has been
//! previously executed to fill "commit_data". No value should be inserted or
//! erased between the "insert_check" and "insert_commit" calls.
iterator insert_commit(reference value, const insert_commit_data &commit_data)
{ return tree_.insert_unique_commit(value, commit_data); }
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Inserts a range into the set.
- //!
+ //!
//! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
//! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -512,11 +512,11 @@ class set_impl
//! inserted key according to the predicate.
//!
//! <b>Effects</b>: Inserts x into the tree before "pos".
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if "pos" is not
//! the successor of "value" or "value" is not unique tree ordering and uniqueness
//! invariants will be broken respectively.
@@ -529,11 +529,11 @@ class set_impl
//! any inserted key according to the predicate.
//!
//! <b>Effects</b>: Inserts x into the tree in the last position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! less than or equal to the greatest inserted key tree ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -546,11 +546,11 @@ class set_impl
//! than any inserted key according to the predicate.
//!
//! <b>Effects</b>: Inserts x into the tree in the first position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! greater than or equal to the the mimum inserted key tree ordering or uniqueness
//! invariants will be broken.
@@ -560,41 +560,41 @@ class set_impl
void push_front(reference value)
{ tree_.push_front(value); }
- //! <b>Effects</b>: Erases the element pointed to by pos.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by pos.
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Returns</b>: An iterator to the element after the erased element.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator i)
{ return tree_.erase(i); }
- //! <b>Effects</b>: Erases the range pointed to by b end e.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Returns</b>: An iterator to the element after the erased elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator b, const_iterator e)
{ return tree_.erase(b, e); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size()) + this->count(value)).
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
@@ -602,13 +602,13 @@ class set_impl
//! <b>Effects</b>: Erases all the elements that compare equal with
//! the given key and the given comparison functor.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If the comp ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyValueCompare>
@@ -621,16 +621,16 @@ class set_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Erases the element pointed to by pos.
+ //! <b>Effects</b>: Erases the element pointed to by pos.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Returns</b>: An iterator to the element after the erased element.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
@@ -646,14 +646,14 @@ class set_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Returns</b>: An iterator to the element after the erased elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -664,13 +664,13 @@ class set_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(value)). Basic guarantee.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -684,11 +684,11 @@ class set_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyValueCompare, class Disposer>
@@ -700,26 +700,26 @@ class set_impl
{ return tree_.erase_and_dispose(key, comp, disposer); }
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
{ return tree_.clear(); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
- //!
+ //!
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -727,20 +727,20 @@ class set_impl
{ return tree_.clear_and_dispose(disposer); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
size_type count(const_reference value) const
{ return tree_.find(value) != end(); }
//! <b>Effects</b>: Returns the number of contained elements with the same key
//! compared with the given comparison functor.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
template<class KeyType, class KeyValueCompare>
size_type count(const KeyType& key, KeyValueCompare comp) const
@@ -748,9 +748,9 @@ class set_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator lower_bound(const_reference value)
{ return tree_.lower_bound(value); }
@@ -760,13 +760,13 @@ class set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -776,9 +776,9 @@ class set_impl
//! <b>Effects</b>: Returns a const iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator lower_bound(const_reference value) const
{ return tree_.lower_bound(value); }
@@ -788,13 +788,13 @@ class set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -804,9 +804,9 @@ class set_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator upper_bound(const_reference value)
{ return tree_.upper_bound(value); }
@@ -816,11 +816,11 @@ class set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -832,9 +832,9 @@ class set_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator upper_bound(const_reference value) const
{ return tree_.upper_bound(value); }
@@ -844,11 +844,11 @@ class set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -858,11 +858,11 @@ class set_impl
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const
{ return tree_.upper_bound(key, comp); }
- //! <b>Effects</b>: Finds an iterator to the first element whose value is
+ //! <b>Effects</b>: Finds an iterator to the first element whose value is
//! "value" or end() if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator find(const_reference value)
{ return tree_.find(value); }
@@ -871,12 +871,12 @@ class set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -886,11 +886,11 @@ class set_impl
iterator find(const KeyType& key, KeyValueCompare comp)
{ return tree_.find(key, comp); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
//! "value" or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator find(const_reference value) const
{ return tree_.find(value); }
@@ -899,12 +899,12 @@ class set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -917,9 +917,9 @@ class set_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return tree_.equal_range(value); }
@@ -928,13 +928,13 @@ class set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -947,9 +947,9 @@ class set_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<const_iterator, const_iterator>
equal_range(const_reference value) const
@@ -959,13 +959,13 @@ class set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -976,16 +976,101 @@ class set_impl
equal_range(const KeyType& key, KeyValueCompare comp) const
{ return tree_.equal_range(key, comp); }
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator, const_iterator>
+ bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator, const_iterator>
+ bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
@@ -993,14 +1078,14 @@ class set_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static const_iterator s_iterator_to(const_reference value)
@@ -1008,48 +1093,48 @@ class set_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator iterator_to(reference value)
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator iterator_to(const_reference value) const
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value shall not be in a set/multiset.
- //!
+ //!
//! <b>Effects</b>: init_node puts the hook of a value in a well-known default
//! state.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This function puts the hook in the well-known default state
//! used by auto_unlink and safe hooks.
static void init_node(reference value)
{ tree_type::init_node(value); }
//! <b>Effects</b>: Unlinks the leftmost node from the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! This function is normally used to achieve a step by step
@@ -1059,14 +1144,14 @@ class set_impl
//! <b>Requires</b>: replace_this must be a valid iterator of *this
//! and with_this must not be inserted in any tree.
- //!
+ //!
//! <b>Effects</b>: Replaces replace_this in its position in the
//! tree with with_this. The tree does not need to be rebalanced.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! with_this is not equivalent to *replace_this according to the
//! ordering rules. This function is faster than erasing and inserting
@@ -1188,7 +1273,7 @@ class set
>::type
{
typedef typename make_set
- <T,
+ <T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1240,9 +1325,9 @@ class set
#endif
-//! The class template multiset is an intrusive container, that mimics most of
+//! The class template multiset is an intrusive container, that mimics most of
//! the interface of std::multiset as described in the C++ standard.
-//!
+//!
//! The template parameter \c T is the type to be managed by the container.
//! The user can specify additional options and if no options are provided
//! default options are used.
@@ -1302,30 +1387,30 @@ class multiset_impl
/// @endcond
public:
- //! <b>Effects</b>: Constructs an empty multiset.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //! <b>Effects</b>: Constructs an empty multiset.
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor/operator() of the value_compare object throws.
+ //! or the copy constructor/operator() of the value_compare object throws.
multiset_impl( const value_compare &cmp = value_compare()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: tree_(cmp, v_traits)
{}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
//! cmp must be a comparison function that induces a strict weak ordering.
- //!
- //! <b>Effects</b>: Constructs an empty multiset and inserts elements from
+ //!
+ //! <b>Effects</b>: Constructs an empty multiset and inserts elements from
//! [b, e).
- //!
+ //!
//! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
//! comp and otherwise N * log N, where N is the distance between first and last
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor/operator() of the value_compare object throws.
+ //! or the copy constructor/operator() of the value_compare object throws.
template<class Iterator>
multiset_impl( Iterator b, Iterator e
, const value_compare &cmp = value_compare()
@@ -1334,135 +1419,135 @@ class multiset_impl
{}
//! <b>Effects</b>: to-do
- //!
- multiset_impl(BOOST_RV_REF(multiset_impl) x)
+ //!
+ multiset_impl(BOOST_RV_REF(multiset_impl) x)
: tree_(::boost::move(x.tree_))
{}
//! <b>Effects</b>: to-do
- //!
- multiset_impl& operator=(BOOST_RV_REF(multiset_impl) x)
+ //!
+ multiset_impl& operator=(BOOST_RV_REF(multiset_impl) x)
{ tree_ = ::boost::move(x.tree_); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the set
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the set
//! are not deleted (i.e. no destructors are called).
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- ~multiset_impl()
+ ~multiset_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return tree_.cbegin(); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return tree_.cend(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
//! reversed multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rbegin()
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rbegin() const
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crbegin() const
{ return tree_.crbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rend()
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rend() const
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crend() const
{ return tree_.crend(); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the multiset associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static multiset_impl &container_from_end_iterator(iterator end_iterator)
{
@@ -1473,11 +1558,11 @@ class multiset_impl
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the multiset associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const multiset_impl &container_from_end_iterator(const_iterator end_iterator)
{
@@ -1487,11 +1572,11 @@ class multiset_impl
}
//! <b>Precondition</b>: it must be a valid iterator of multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the multiset associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static multiset_impl &container_from_iterator(iterator it)
{
@@ -1501,11 +1586,11 @@ class multiset_impl
}
//! <b>Precondition</b>: it must be a valid const_iterator of multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the multiset associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static const multiset_impl &container_from_iterator(const_iterator it)
{
@@ -1515,42 +1600,42 @@ class multiset_impl
}
//! <b>Effects</b>: Returns the key_compare object used by the multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If key_compare copy-constructor throws.
key_compare key_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns the value_compare object used by the multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If value_compare copy-constructor throws.
value_compare value_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns true if the container is empty.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return tree_.empty(); }
//! <b>Effects</b>: Returns the number of elements stored in the multiset.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this if,
//! constant-time size option is enabled. Constant-time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{ return tree_.size(); }
//! <b>Effects</b>: Swaps the contents of two multisets.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the swap() call for the comparison functor
//! found using ADL throws. Strong guarantee.
void swap(multiset_impl& other)
@@ -1560,69 +1645,69 @@ class multiset_impl
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const multiset_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts value into the multiset.
- //!
+ //!
//! <b>Returns</b>: An iterator that points to the position where the new
//! element was inserted.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert(reference value)
{ return tree_.insert_equal(value); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts x into the multiset, using pos as a hint to
//! where it will be inserted.
- //!
+ //!
//! <b>Returns</b>: An iterator that points to the position where the new
//! element was inserted.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert(const_iterator hint, reference value)
{ return tree_.insert_equal(hint, value); }
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Inserts a range into the multiset.
- //!
+ //!
//! <b>Returns</b>: An iterator that points to the position where the new
//! element was inserted.
- //!
+ //!
//! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
//! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -1634,11 +1719,11 @@ class multiset_impl
//! once inserted according to the predicate
//!
//! <b>Effects</b>: Inserts x into the tree before "pos".
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if "pos" is not
//! the successor of "value" tree ordering invariant will be broken.
//! This is a low-level function to be used only for performance reasons
@@ -1650,11 +1735,11 @@ class multiset_impl
//! than the greatest inserted key
//!
//! <b>Effects</b>: Inserts x into the tree in the last position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! less than the greatest inserted key tree ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -1667,11 +1752,11 @@ class multiset_impl
//! than the minimum inserted key
//!
//! <b>Effects</b>: Inserts x into the tree in the first position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! greater than the minimum inserted key tree ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -1680,41 +1765,41 @@ class multiset_impl
void push_front(reference value)
{ tree_.push_front(value); }
- //! <b>Effects</b>: Erases the element pointed to by pos.
- //!
- //! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by pos.
+ //!
+ //! <b>Complexity</b>: Average complexity is constant time.
+ //!
//! <b>Returns</b>: An iterator to the element after the erased element.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator i)
{ return tree_.erase(i); }
- //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
//!
//! <b>Returns</b>: An iterator to the element after the erased elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator b, iterator e)
{ return tree_.erase(b, e); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(value)).
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
@@ -1722,13 +1807,13 @@ class multiset_impl
//! <b>Effects</b>: Erases all the elements that compare equal with
//! the given key and the given comparison functor.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyValueCompare>
@@ -1743,14 +1828,14 @@ class multiset_impl
//!
//! <b>Returns</b>: An iterator to the element after the erased element.
//!
- //! <b>Effects</b>: Erases the element pointed to by pos.
+ //! <b>Effects</b>: Erases the element pointed to by pos.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
@@ -1768,12 +1853,12 @@ class multiset_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -1784,13 +1869,13 @@ class multiset_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(value)).
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -1804,11 +1889,11 @@ class multiset_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyValueCompare, class Disposer>
@@ -1820,26 +1905,26 @@ class multiset_impl
{ return tree_.erase_and_dispose(key, comp, disposer); }
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
{ return tree_.clear(); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
- //!
+ //!
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -1847,20 +1932,20 @@ class multiset_impl
{ return tree_.clear_and_dispose(disposer); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
size_type count(const_reference value) const
{ return tree_.count(value); }
//! <b>Effects</b>: Returns the number of contained elements with the same key
//! compared with the given comparison functor.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
template<class KeyType, class KeyValueCompare>
size_type count(const KeyType& key, KeyValueCompare comp) const
@@ -1868,9 +1953,9 @@ class multiset_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator lower_bound(const_reference value)
{ return tree_.lower_bound(value); }
@@ -1880,13 +1965,13 @@ class multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -1896,9 +1981,9 @@ class multiset_impl
//! <b>Effects</b>: Returns a const iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator lower_bound(const_reference value) const
{ return tree_.lower_bound(value); }
@@ -1908,13 +1993,13 @@ class multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -1924,9 +2009,9 @@ class multiset_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator upper_bound(const_reference value)
{ return tree_.upper_bound(value); }
@@ -1936,11 +2021,11 @@ class multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1952,9 +2037,9 @@ class multiset_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator upper_bound(const_reference value) const
{ return tree_.upper_bound(value); }
@@ -1964,11 +2049,11 @@ class multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1978,11 +2063,11 @@ class multiset_impl
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const
{ return tree_.upper_bound(key, comp); }
- //! <b>Effects</b>: Finds an iterator to the first element whose value is
+ //! <b>Effects</b>: Finds an iterator to the first element whose value is
//! "value" or end() if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator find(const_reference value)
{ return tree_.find(value); }
@@ -1991,12 +2076,12 @@ class multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2006,11 +2091,11 @@ class multiset_impl
iterator find(const KeyType& key, KeyValueCompare comp)
{ return tree_.find(key, comp); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
//! "value" or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator find(const_reference value) const
{ return tree_.find(value); }
@@ -2019,12 +2104,12 @@ class multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2037,9 +2122,9 @@ class multiset_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return tree_.equal_range(value); }
@@ -2048,13 +2133,13 @@ class multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2067,9 +2152,9 @@ class multiset_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<const_iterator, const_iterator>
equal_range(const_reference value) const
@@ -2079,13 +2164,13 @@ class multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2096,16 +2181,101 @@ class multiset_impl
equal_range(const KeyType& key, KeyValueCompare comp) const
{ return tree_.equal_range(key, comp); }
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator, const_iterator>
+ bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator, const_iterator>
+ bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
@@ -2113,14 +2283,14 @@ class multiset_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static const_iterator s_iterator_to(const_reference value)
@@ -2128,48 +2298,48 @@ class multiset_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator iterator_to(reference value)
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator iterator_to(const_reference value) const
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value shall not be in a set/multiset.
- //!
+ //!
//! <b>Effects</b>: init_node puts the hook of a value in a well-known default
//! state.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This function puts the hook in the well-known default state
//! used by auto_unlink and safe hooks.
static void init_node(reference value)
{ tree_type::init_node(value); }
//! <b>Effects</b>: Unlinks the leftmost node from the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! This function is normally used to achieve a step by step
@@ -2179,14 +2349,14 @@ class multiset_impl
//! <b>Requires</b>: replace_this must be a valid iterator of *this
//! and with_this must not be inserted in any tree.
- //!
+ //!
//! <b>Effects</b>: Replaces replace_this in its position in the
//! tree with with_this. The tree does not need to be rebalanced.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! with_this is not equivalent to *replace_this according to the
//! ordering rules. This function is faster than erasing and inserting
@@ -2195,11 +2365,11 @@ class multiset_impl
{ tree_.replace_node(replace_this, with_this); }
//! <b>Effects</b>: removes "value" from the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic time.
- //!
+ //!
//! <b>Note</b>: This static function is only usable with non-constant
//! time size containers that have stateless comparison functors.
//!
@@ -2323,14 +2493,14 @@ class multiset
#endif
>::type
{
- typedef typename make_multiset<T,
+ typedef typename make_multiset<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
Options...
#endif
>::type Base;
-
+
BOOST_MOVABLE_BUT_NOT_COPYABLE(multiset)
public:
@@ -2376,8 +2546,8 @@ class multiset
#endif
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/set_hook.hpp b/boost/intrusive/set_hook.hpp
index 35746a29a5..2634b42eef 100644
--- a/boost/intrusive/set_hook.hpp
+++ b/boost/intrusive/set_hook.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -44,7 +44,7 @@ struct make_set_base_hook
{
/// @cond
typedef typename pack_options
- < hook_defaults,
+ < hook_defaults,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -63,16 +63,16 @@ struct make_set_base_hook
typedef implementation_defined type;
};
-//! 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
+//! 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
//! the set/multiset and provides an appropriate value_traits class for set/multiset.
-//!
+//!
//! The hook admits the following options: \c tag<>, \c void_pointer<>,
//! \c link_mode<> and \c optimize_size<>.
//!
-//! \c tag<> defines a tag to identify the node.
-//! 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
+//! \c tag<> defines a tag to identify the node.
+//! 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
//! unique tag.
//!
//! \c void_pointer<> is the pointer type that will be used internally in the hook
@@ -101,27 +101,27 @@ class set_base_hook
public:
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
set_base_hook();
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
- //!
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
//! <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
//! move-semantics.
set_base_hook(const set_base_hook& );
//! <b>Effects</b>: Empty function. The argument is ignored.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Rationale</b>: Providing an assignment operator
- //! makes classes using the hook STL-compliant without forcing the
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Rationale</b>: Providing an assignment operator
+ //! makes classes using the hook STL-compliant without forcing the
//! user to do some additional work. \c swap can be used to emulate
//! move-semantics.
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
//! 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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
~set_base_hook();
- //! <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
- //! 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
- //! 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
- //! after the swap-operation the other element is not in a container.
- //! Iterators to e1 and e2 related to those nodes are invalidated.
+ //! <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
+ //! 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
+ //! 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
+ //! after the swap-operation the other element is not in a container.
+ //! 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);
//! <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
- //! otherwise. This function can be used to test whether \c set::iterator_to
- //! will return a valid iterator.
+ //! otherwise. This function can be used to test whether \c set::iterator_to
+ //! will return a valid iterator.
//!
- //! <b>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
bool is_linked() const;
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
void unlink();
#endif
};
@@ -176,7 +176,7 @@ struct make_set_member_hook
{
/// @cond
typedef typename pack_options
- < hook_defaults,
+ < hook_defaults,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#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
//! 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.
-//!
+//!
//! The hook admits the following options: \c void_pointer<>,
//! \c link_mode<> and \c optimize_size<>.
//!
@@ -228,27 +228,27 @@ class set_member_hook
public:
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
set_member_hook();
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
- //!
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
//! <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
//! move-semantics.
set_member_hook(const set_member_hook& );
//! <b>Effects</b>: Empty function. The argument is ignored.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Rationale</b>: Providing an assignment operator
- //! makes classes using the hook STL-compliant without forcing the
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Rationale</b>: Providing an assignment operator
+ //! makes classes using the hook STL-compliant without forcing the
//! user to do some additional work. \c swap can be used to emulate
//! move-semantics.
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
//! 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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
~set_member_hook();
- //! <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
- //! 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
- //! 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
- //! after the swap-operation the other element is not in a container.
- //! Iterators to e1 and e2 related to those nodes are invalidated.
+ //! <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
+ //! 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
+ //! 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
+ //! after the swap-operation the other element is not in a container.
+ //! 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);
//! <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
- //! otherwise. This function can be used to test whether \c set::iterator_to
- //! will return a valid iterator.
+ //! otherwise. This function can be used to test whether \c set::iterator_to
+ //! will return a valid iterator.
//!
- //! <b>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
bool is_linked() const;
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
void unlink();
#endif
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/sg_set.hpp b/boost/intrusive/sg_set.hpp
index fb59496ee1..9b020cc221 100644
--- a/boost/intrusive/sg_set.hpp
+++ b/boost/intrusive/sg_set.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -22,9 +22,9 @@
namespace boost {
namespace intrusive {
-//! The class template sg_set is an intrusive container, that mimics most of
+//! The class template sg_set is an intrusive container, that mimics most of
//! the interface of std::set as described in the C++ standard.
-//!
+//!
//! The template parameter \c T is the type to be managed by the container.
//! The user can specify additional options and if no options are provided
//! default options are used.
@@ -77,30 +77,30 @@ class sg_set_impl
/// @endcond
public:
- //! <b>Effects</b>: Constructs an empty sg_set.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //! <b>Effects</b>: Constructs an empty sg_set.
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor of the value_compare object throws.
+ //! or the copy constructor of the value_compare object throws.
sg_set_impl( const value_compare &cmp = value_compare()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: tree_(cmp, v_traits)
{}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
//! cmp must be a comparison function that induces a strict weak ordering.
- //!
- //! <b>Effects</b>: Constructs an empty sg_set and inserts elements from
+ //!
+ //! <b>Effects</b>: Constructs an empty sg_set and inserts elements from
//! [b, e).
- //!
- //! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
+ //!
+ //! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
//! comp and otherwise N * log N, where N is std::distance(last, first).
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor/operator() of the value_compare object throws.
+ //! or the copy constructor/operator() of the value_compare object throws.
template<class Iterator>
sg_set_impl( Iterator b, Iterator e
, const value_compare &cmp = value_compare()
@@ -109,135 +109,135 @@ class sg_set_impl
{}
//! <b>Effects</b>: to-do
- //!
- sg_set_impl(BOOST_RV_REF(sg_set_impl) x)
+ //!
+ sg_set_impl(BOOST_RV_REF(sg_set_impl) x)
: tree_(::boost::move(x.tree_))
{}
//! <b>Effects</b>: to-do
- //!
- sg_set_impl& operator=(BOOST_RV_REF(sg_set_impl) x)
+ //!
+ sg_set_impl& operator=(BOOST_RV_REF(sg_set_impl) x)
{ tree_ = ::boost::move(x.tree_); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the sg_set
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the sg_set
//! are not deleted (i.e. no destructors are called).
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- ~sg_set_impl()
+ ~sg_set_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the sg_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the sg_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the sg_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return tree_.cbegin(); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the sg_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the sg_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the sg_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return tree_.cend(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
//! reversed sg_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rbegin()
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed sg_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rbegin() const
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed sg_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crbegin() const
{ return tree_.crbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed sg_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rend()
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed sg_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rend() const
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed sg_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crend() const
{ return tree_.crend(); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of sg_set.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the sg_set associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static sg_set_impl &container_from_end_iterator(iterator end_iterator)
{
@@ -248,11 +248,11 @@ class sg_set_impl
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of sg_set.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the sg_set associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const sg_set_impl &container_from_end_iterator(const_iterator end_iterator)
{
@@ -262,11 +262,11 @@ class sg_set_impl
}
//! <b>Precondition</b>: it must be a valid iterator of set.
- //!
+ //!
//! <b>Effects</b>: Returns a reference to the set associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static sg_set_impl &container_from_iterator(iterator it)
{
@@ -276,11 +276,11 @@ class sg_set_impl
}
//! <b>Precondition</b>: it must be a valid const_iterator of set.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the set associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static const sg_set_impl &container_from_iterator(const_iterator it)
{
@@ -290,42 +290,42 @@ class sg_set_impl
}
//! <b>Effects</b>: Returns the key_compare object used by the sg_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If key_compare copy-constructor throws.
key_compare key_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns the value_compare object used by the sg_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If value_compare copy-constructor throws.
value_compare value_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns true if the container is empty.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return tree_.empty(); }
//! <b>Effects</b>: Returns the number of elements stored in the sg_set.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this if,
//! constant-time size option is enabled. Constant-time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{ return tree_.size(); }
//! <b>Effects</b>: Swaps the contents of two sets.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the swap() call for the comparison functor
//! found using ADL throws. Strong guarantee.
void swap(sg_set_impl& other)
@@ -335,22 +335,22 @@ class sg_set_impl
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const sg_set_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Tries to inserts value into the sg_set.
//!
//! <b>Returns</b>: If the value
@@ -358,39 +358,39 @@ class sg_set_impl
//! iterator to the new value and true. If there is an equivalent value
//! returns a pair containing an iterator to the already present value
//! and false.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
std::pair<iterator, bool> insert(reference value)
{ return tree_.insert_unique(value); }
//! <b>Requires</b>: value must be an lvalue
- //!
- //! <b>Effects</b>: Tries to to insert x into the sg_set, using "hint"
+ //!
+ //! <b>Effects</b>: Tries to to insert x into the sg_set, using "hint"
//! as a hint to where it will be inserted.
//!
- //! <b>Returns</b>: An iterator that points to the position where the
+ //! <b>Returns</b>: An iterator that points to the position where the
//! new element was inserted into the sg_set.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it's amortized
//! constant time if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert(const_iterator hint, reference value)
{ return tree_.insert_unique(hint, value); }
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare. The difference is that
//! key_value_comp compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the sg_set, using
//! a user provided key instead of the value itself.
//!
@@ -399,16 +399,16 @@ class sg_set_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic.
//!
//! <b>Throws</b>: If the key_value_comp ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! node that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that
+ //! than the value_type and this function offers the possibility to use that
//! part to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
@@ -422,12 +422,12 @@ class sg_set_impl
(const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data)
{ return tree_.insert_unique_check(key, key_value_comp, commit_data); }
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare. The difference is that
//! key_value_comp compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the sg_set, using
- //! a user provided key instead of the value itself, using "hint"
+ //! a user provided key instead of the value itself, using "hint"
//! as a hint to where it will be inserted.
//!
//! <b>Returns</b>: If there is an equivalent value
@@ -435,23 +435,23 @@ class sg_set_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it's amortized
//! constant time if t is inserted immediately before hint.
//!
//! <b>Throws</b>: If the key_value_comp ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! constructing that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that key
+ //! than the value_type and this function offers the possibility to use that key
//! to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
//! "insert_commit" to insert the object in constant-time. This can give a total
//! constant-time complexity to the insertion: check(O(1)) + commit(O(1)).
- //!
+ //!
//! "commit_data" remains valid for a subsequent "insert_commit" only if no more
//! objects are inserted or erased from the sg_set.
template<class KeyType, class KeyValueCompare>
@@ -464,33 +464,33 @@ class sg_set_impl
//! must have been obtained from a previous call to "insert_check".
//! No objects should have been inserted or erased from the sg_set between
//! the "insert_check" that filled "commit_data" and the call to "insert_commit".
- //!
+ //!
//! <b>Effects</b>: Inserts the value in the sg_set using the information obtained
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Returns</b>: An iterator to the newly inserted object.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function has only sense if a "insert_check" has been
//! previously executed to fill "commit_data". No value should be inserted or
//! erased between the "insert_check" and "insert_commit" calls.
iterator insert_commit(reference value, const insert_commit_data &commit_data)
{ return tree_.insert_unique_commit(value, commit_data); }
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Inserts a range into the sg_set.
- //!
+ //!
//! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
//! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -503,11 +503,11 @@ class sg_set_impl
//! inserted key according to the predicate.
//!
//! <b>Effects</b>: Inserts x into the tree before "pos".
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if "pos" is not
//! the successor of "value" or "value" is not unique tree ordering and uniqueness
//! invariants will be broken respectively.
@@ -520,11 +520,11 @@ class sg_set_impl
//! any inserted key according to the predicate.
//!
//! <b>Effects</b>: Inserts x into the tree in the last position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! less than or equal to the greatest inserted key tree ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -537,11 +537,11 @@ class sg_set_impl
//! than any inserted key according to the predicate.
//!
//! <b>Effects</b>: Inserts x into the tree in the first position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! greater than or equal to the the mimum inserted key tree ordering or uniqueness
//! invariants will be broken.
@@ -551,41 +551,41 @@ class sg_set_impl
void push_front(reference value)
{ tree_.push_front(value); }
- //! <b>Effects</b>: Erases the element pointed to by pos.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by pos.
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Returns</b>: An iterator to the element after the erased element.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator i)
{ return tree_.erase(i); }
- //! <b>Effects</b>: Erases the range pointed to by b end e.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Returns</b>: An iterator to the element after the erased elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator b, const_iterator e)
{ return tree_.erase(b, e); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size()) + this->count(value)).
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
@@ -593,13 +593,13 @@ class sg_set_impl
//! <b>Effects</b>: Erases all the elements that compare equal with
//! the given key and the given comparison functor.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If the comp ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyValueCompare>
@@ -612,16 +612,16 @@ class sg_set_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Erases the element pointed to by pos.
+ //! <b>Effects</b>: Erases the element pointed to by pos.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Returns</b>: An iterator to the element after the erased element.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
@@ -637,14 +637,14 @@ class sg_set_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Returns</b>: An iterator to the element after the erased elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -655,13 +655,13 @@ class sg_set_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(value)). Basic guarantee.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -675,11 +675,11 @@ class sg_set_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyValueCompare, class Disposer>
@@ -691,26 +691,26 @@ class sg_set_impl
{ return tree_.erase_and_dispose(key, comp, disposer); }
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
{ return tree_.clear(); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
- //!
+ //!
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -718,20 +718,20 @@ class sg_set_impl
{ return tree_.clear_and_dispose(disposer); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
size_type count(const_reference value) const
{ return tree_.find(value) != end(); }
//! <b>Effects</b>: Returns the number of contained elements with the same key
//! compared with the given comparison functor.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
template<class KeyType, class KeyValueCompare>
size_type count(const KeyType& key, KeyValueCompare comp) const
@@ -739,9 +739,9 @@ class sg_set_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator lower_bound(const_reference value)
{ return tree_.lower_bound(value); }
@@ -751,13 +751,13 @@ class sg_set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -767,9 +767,9 @@ class sg_set_impl
//! <b>Effects</b>: Returns a const iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator lower_bound(const_reference value) const
{ return tree_.lower_bound(value); }
@@ -779,13 +779,13 @@ class sg_set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -795,9 +795,9 @@ class sg_set_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator upper_bound(const_reference value)
{ return tree_.upper_bound(value); }
@@ -807,11 +807,11 @@ class sg_set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -823,9 +823,9 @@ class sg_set_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator upper_bound(const_reference value) const
{ return tree_.upper_bound(value); }
@@ -835,11 +835,11 @@ class sg_set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -849,11 +849,11 @@ class sg_set_impl
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const
{ return tree_.upper_bound(key, comp); }
- //! <b>Effects</b>: Finds an iterator to the first element whose value is
+ //! <b>Effects</b>: Finds an iterator to the first element whose value is
//! "value" or end() if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator find(const_reference value)
{ return tree_.find(value); }
@@ -862,12 +862,12 @@ class sg_set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -877,11 +877,11 @@ class sg_set_impl
iterator find(const KeyType& key, KeyValueCompare comp)
{ return tree_.find(key, comp); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
//! "value" or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator find(const_reference value) const
{ return tree_.find(value); }
@@ -890,12 +890,12 @@ class sg_set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -908,9 +908,9 @@ class sg_set_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return tree_.equal_range(value); }
@@ -919,13 +919,13 @@ class sg_set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -938,9 +938,9 @@ class sg_set_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<const_iterator, const_iterator>
equal_range(const_reference value) const
@@ -950,13 +950,13 @@ class sg_set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -967,16 +967,101 @@ class sg_set_impl
equal_range(const KeyType& key, KeyValueCompare comp) const
{ return tree_.equal_range(key, comp); }
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator, const_iterator>
+ bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator, const_iterator>
+ bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: value must be an lvalue and shall be in a sg_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the sg_set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
@@ -984,14 +1069,14 @@ class sg_set_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a sg_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! sg_set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static const_iterator s_iterator_to(const_reference value)
@@ -999,48 +1084,48 @@ class sg_set_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a sg_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the sg_set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator iterator_to(reference value)
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value must be an lvalue and shall be in a sg_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! sg_set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator iterator_to(const_reference value) const
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value shall not be in a sg_set/sg_multiset.
- //!
+ //!
//! <b>Effects</b>: init_node puts the hook of a value in a well-known default
//! state.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This function puts the hook in the well-known default state
//! used by auto_unlink and safe hooks.
static void init_node(reference value)
{ tree_type::init_node(value); }
//! <b>Effects</b>: Unlinks the leftmost node from the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! This function is normally used to achieve a step by step
@@ -1050,14 +1135,14 @@ class sg_set_impl
//! <b>Requires</b>: replace_this must be a valid iterator of *this
//! and with_this must not be inserted in any tree.
- //!
+ //!
//! <b>Effects</b>: Replaces replace_this in its position in the
//! tree with with_this. The tree does not need to be rebalanced.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! with_this is not equivalent to *replace_this according to the
//! ordering rules. This function is faster than erasing and inserting
@@ -1066,21 +1151,21 @@ class sg_set_impl
{ tree_.replace_node(replace_this, with_this); }
//! <b>Effects</b>: Rebalances the tree.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear.
void rebalance()
{ tree_.rebalance(); }
//! <b>Requires</b>: old_root is a node of a tree.
- //!
+ //!
//! <b>Effects</b>: Rebalances the subtree rooted at old_root.
//!
//! <b>Returns</b>: The new root of the subtree.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements in the subtree.
iterator rebalance_subtree(iterator root)
{ return tree_.rebalance_subtree(root); }
@@ -1088,18 +1173,18 @@ class sg_set_impl
//! <b>Returns</b>: The balance factor (alpha) used in this tree
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
float balance_factor() const
{ return tree_.balance_factor(); }
//! <b>Requires</b>: new_alpha must be a value between 0.5 and 1.0
- //!
+ //!
//! <b>Effects</b>: Establishes a new balance factor (alpha) and rebalances
//! the tree if the new balance factor is stricter (less) than the old factor.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements in the subtree.
void balance_factor(float new_alpha)
{ tree_.balance_factor(new_alpha); }
@@ -1190,7 +1275,7 @@ struct make_sg_set
{
/// @cond
typedef sg_set_impl
- < typename make_sgtree_opt<T,
+ < typename make_sgtree_opt<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1210,7 +1295,7 @@ template<class T, class O1, class O2, class O3, class O4>
template<class T, class ...Options>
#endif
class sg_set
- : public make_sg_set<T,
+ : public make_sg_set<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1219,7 +1304,7 @@ class sg_set
>::type
{
typedef typename make_sg_set
- <T,
+ <T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1271,9 +1356,9 @@ class sg_set
#endif
-//! The class template sg_multiset is an intrusive container, that mimics most of
+//! The class template sg_multiset is an intrusive container, that mimics most of
//! the interface of std::sg_multiset as described in the C++ standard.
-//!
+//!
//! The template parameter \c T is the type to be managed by the container.
//! The user can specify additional options and if no options are provided
//! default options are used.
@@ -1325,30 +1410,30 @@ class sg_multiset_impl
/// @endcond
public:
- //! <b>Effects</b>: Constructs an empty sg_multiset.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //! <b>Effects</b>: Constructs an empty sg_multiset.
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor/operator() of the value_compare object throws.
+ //! or the copy constructor/operator() of the value_compare object throws.
sg_multiset_impl( const value_compare &cmp = value_compare()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: tree_(cmp, v_traits)
{}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
//! cmp must be a comparison function that induces a strict weak ordering.
- //!
- //! <b>Effects</b>: Constructs an empty sg_multiset and inserts elements from
+ //!
+ //! <b>Effects</b>: Constructs an empty sg_multiset and inserts elements from
//! [b, e).
- //!
+ //!
//! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
//! comp and otherwise N * log N, where N is the distance between first and last
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor/operator() of the value_compare object throws.
+ //! or the copy constructor/operator() of the value_compare object throws.
template<class Iterator>
sg_multiset_impl( Iterator b, Iterator e
, const value_compare &cmp = value_compare()
@@ -1357,135 +1442,135 @@ class sg_multiset_impl
{}
//! <b>Effects</b>: to-do
- //!
- sg_multiset_impl(BOOST_RV_REF(sg_multiset_impl) x)
+ //!
+ sg_multiset_impl(BOOST_RV_REF(sg_multiset_impl) x)
: tree_(::boost::move(x.tree_))
{}
//! <b>Effects</b>: to-do
- //!
- sg_multiset_impl& operator=(BOOST_RV_REF(sg_multiset_impl) x)
+ //!
+ sg_multiset_impl& operator=(BOOST_RV_REF(sg_multiset_impl) x)
{ tree_ = ::boost::move(x.tree_); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the sg_multiset
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the sg_multiset
//! are not deleted (i.e. no destructors are called).
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- ~sg_multiset_impl()
+ ~sg_multiset_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the sg_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the sg_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the sg_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return tree_.cbegin(); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the sg_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the sg_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the sg_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return tree_.cend(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
//! reversed sg_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rbegin()
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed sg_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rbegin() const
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed sg_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crbegin() const
{ return tree_.crbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed sg_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rend()
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed sg_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rend() const
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed sg_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crend() const
{ return tree_.crend(); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of sg_multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the sg_multiset associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static sg_multiset_impl &container_from_end_iterator(iterator end_iterator)
{
@@ -1496,11 +1581,11 @@ class sg_multiset_impl
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of sg_multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the sg_multiset associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const sg_multiset_impl &container_from_end_iterator(const_iterator end_iterator)
{
@@ -1510,11 +1595,11 @@ class sg_multiset_impl
}
//! <b>Precondition</b>: it must be a valid iterator of multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the multiset associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static sg_multiset_impl &container_from_iterator(iterator it)
{
@@ -1524,11 +1609,11 @@ class sg_multiset_impl
}
//! <b>Precondition</b>: it must be a valid const_iterator of multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the multiset associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const sg_multiset_impl &container_from_iterator(const_iterator it)
{
@@ -1538,42 +1623,42 @@ class sg_multiset_impl
}
//! <b>Effects</b>: Returns the key_compare object used by the sg_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If key_compare copy-constructor throws.
key_compare key_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns the value_compare object used by the sg_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If value_compare copy-constructor throws.
value_compare value_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns true if the container is empty.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return tree_.empty(); }
//! <b>Effects</b>: Returns the number of elements stored in the sg_multiset.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this if,
//! constant-time size option is enabled. Constant-time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{ return tree_.size(); }
//! <b>Effects</b>: Swaps the contents of two sg_multisets.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the swap() call for the comparison functor
//! found using ADL throws. Strong guarantee.
void swap(sg_multiset_impl& other)
@@ -1583,69 +1668,69 @@ class sg_multiset_impl
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const sg_multiset_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts value into the sg_multiset.
- //!
+ //!
//! <b>Returns</b>: An iterator that points to the position where the new
//! element was inserted.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert(reference value)
{ return tree_.insert_equal(value); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts x into the sg_multiset, using pos as a hint to
//! where it will be inserted.
- //!
+ //!
//! <b>Returns</b>: An iterator that points to the position where the new
//! element was inserted.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert(const_iterator hint, reference value)
{ return tree_.insert_equal(hint, value); }
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Inserts a range into the sg_multiset.
- //!
+ //!
//! <b>Returns</b>: An iterator that points to the position where the new
//! element was inserted.
- //!
+ //!
//! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
//! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -1657,11 +1742,11 @@ class sg_multiset_impl
//! once inserted according to the predicate
//!
//! <b>Effects</b>: Inserts x into the tree before "pos".
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if "pos" is not
//! the successor of "value" tree ordering invariant will be broken.
//! This is a low-level function to be used only for performance reasons
@@ -1673,11 +1758,11 @@ class sg_multiset_impl
//! than the greatest inserted key
//!
//! <b>Effects</b>: Inserts x into the tree in the last position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! less than the greatest inserted key tree ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -1690,11 +1775,11 @@ class sg_multiset_impl
//! than the minimum inserted key
//!
//! <b>Effects</b>: Inserts x into the tree in the first position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! greater than the minimum inserted key tree ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -1703,41 +1788,41 @@ class sg_multiset_impl
void push_front(reference value)
{ tree_.push_front(value); }
- //! <b>Effects</b>: Erases the element pointed to by pos.
- //!
- //! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by pos.
+ //!
+ //! <b>Complexity</b>: Average complexity is constant time.
+ //!
//! <b>Returns</b>: An iterator to the element after the erased element.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator i)
{ return tree_.erase(i); }
- //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
//!
//! <b>Returns</b>: An iterator to the element after the erased elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator b, const_iterator e)
{ return tree_.erase(b, e); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(value)).
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
@@ -1745,13 +1830,13 @@ class sg_multiset_impl
//! <b>Effects</b>: Erases all the elements that compare equal with
//! the given key and the given comparison functor.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyValueCompare>
@@ -1766,14 +1851,14 @@ class sg_multiset_impl
//!
//! <b>Returns</b>: An iterator to the element after the erased element.
//!
- //! <b>Effects</b>: Erases the element pointed to by pos.
+ //! <b>Effects</b>: Erases the element pointed to by pos.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
@@ -1791,12 +1876,12 @@ class sg_multiset_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -1807,13 +1892,13 @@ class sg_multiset_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(value)).
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -1827,11 +1912,11 @@ class sg_multiset_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyValueCompare, class Disposer>
@@ -1843,26 +1928,26 @@ class sg_multiset_impl
{ return tree_.erase_and_dispose(key, comp, disposer); }
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
{ return tree_.clear(); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
- //!
+ //!
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -1870,20 +1955,20 @@ class sg_multiset_impl
{ return tree_.clear_and_dispose(disposer); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
size_type count(const_reference value) const
{ return tree_.count(value); }
//! <b>Effects</b>: Returns the number of contained elements with the same key
//! compared with the given comparison functor.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
template<class KeyType, class KeyValueCompare>
size_type count(const KeyType& key, KeyValueCompare comp) const
@@ -1891,9 +1976,9 @@ class sg_multiset_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator lower_bound(const_reference value)
{ return tree_.lower_bound(value); }
@@ -1903,13 +1988,13 @@ class sg_multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -1919,9 +2004,9 @@ class sg_multiset_impl
//! <b>Effects</b>: Returns a const iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator lower_bound(const_reference value) const
{ return tree_.lower_bound(value); }
@@ -1931,13 +2016,13 @@ class sg_multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -1947,9 +2032,9 @@ class sg_multiset_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator upper_bound(const_reference value)
{ return tree_.upper_bound(value); }
@@ -1959,11 +2044,11 @@ class sg_multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1975,9 +2060,9 @@ class sg_multiset_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator upper_bound(const_reference value) const
{ return tree_.upper_bound(value); }
@@ -1987,11 +2072,11 @@ class sg_multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2001,11 +2086,11 @@ class sg_multiset_impl
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const
{ return tree_.upper_bound(key, comp); }
- //! <b>Effects</b>: Finds an iterator to the first element whose value is
+ //! <b>Effects</b>: Finds an iterator to the first element whose value is
//! "value" or end() if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator find(const_reference value)
{ return tree_.find(value); }
@@ -2014,12 +2099,12 @@ class sg_multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2029,11 +2114,11 @@ class sg_multiset_impl
iterator find(const KeyType& key, KeyValueCompare comp)
{ return tree_.find(key, comp); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
//! "value" or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator find(const_reference value) const
{ return tree_.find(value); }
@@ -2042,12 +2127,12 @@ class sg_multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2060,9 +2145,9 @@ class sg_multiset_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return tree_.equal_range(value); }
@@ -2071,13 +2156,13 @@ class sg_multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2090,9 +2175,9 @@ class sg_multiset_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<const_iterator, const_iterator>
equal_range(const_reference value) const
@@ -2102,13 +2187,13 @@ class sg_multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2119,16 +2204,101 @@ class sg_multiset_impl
equal_range(const KeyType& key, KeyValueCompare comp) const
{ return tree_.equal_range(key, comp); }
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator, const_iterator>
+ bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator, const_iterator>
+ bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: value must be an lvalue and shall be in a sg_multiset of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the sg_multiset
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
@@ -2136,14 +2306,14 @@ class sg_multiset_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a sg_multiset of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! sg_multiset that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static const_iterator s_iterator_to(const_reference value)
@@ -2151,48 +2321,48 @@ class sg_multiset_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a sg_multiset of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the sg_multiset
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator iterator_to(reference value)
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value must be an lvalue and shall be in a sg_multiset of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! sg_multiset that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator iterator_to(const_reference value) const
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value shall not be in a sg_multiset/sg_multiset.
- //!
+ //!
//! <b>Effects</b>: init_node puts the hook of a value in a well-known default
//! state.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This function puts the hook in the well-known default state
//! used by auto_unlink and safe hooks.
static void init_node(reference value)
{ tree_type::init_node(value); }
//! <b>Effects</b>: Unlinks the leftmost node from the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! This function is normally used to achieve a step by step
@@ -2202,14 +2372,14 @@ class sg_multiset_impl
//! <b>Requires</b>: replace_this must be a valid iterator of *this
//! and with_this must not be inserted in any tree.
- //!
+ //!
//! <b>Effects</b>: Replaces replace_this in its position in the
//! tree with with_this. The tree does not need to be rebalanced.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! with_this is not equivalent to *replace_this according to the
//! ordering rules. This function is faster than erasing and inserting
@@ -2218,21 +2388,21 @@ class sg_multiset_impl
{ tree_.replace_node(replace_this, with_this); }
//! <b>Effects</b>: Rebalances the tree.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear.
void rebalance()
{ tree_.rebalance(); }
//! <b>Requires</b>: old_root is a node of a tree.
- //!
+ //!
//! <b>Effects</b>: Rebalances the subtree rooted at old_root.
//!
//! <b>Returns</b>: The new root of the subtree.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements in the subtree.
iterator rebalance_subtree(iterator root)
{ return tree_.rebalance_subtree(root); }
@@ -2240,18 +2410,18 @@ class sg_multiset_impl
//! <b>Returns</b>: The balance factor (alpha) used in this tree
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
float balance_factor() const
{ return tree_.balance_factor(); }
//! <b>Requires</b>: new_alpha must be a value between 0.5 and 1.0
- //!
+ //!
//! <b>Effects</b>: Establishes a new balance factor (alpha) and rebalances
//! the tree if the new balance factor is stricter (less) than the old factor.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements in the subtree.
void balance_factor(float new_alpha)
{ tree_.balance_factor(new_alpha); }
@@ -2342,7 +2512,7 @@ struct make_sg_multiset
{
/// @cond
typedef sg_multiset_impl
- < typename make_sgtree_opt<T,
+ < typename make_sgtree_opt<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -2362,7 +2532,7 @@ template<class T, class O1, class O2, class O3, class O4>
template<class T, class ...Options>
#endif
class sg_multiset
- : public make_sg_multiset<T,
+ : public make_sg_multiset<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -2371,7 +2541,7 @@ class sg_multiset
>::type
{
typedef typename make_sg_multiset
- <T,
+ <T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -2423,8 +2593,8 @@ class sg_multiset
#endif
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/sgtree.hpp b/boost/intrusive/sgtree.hpp
index 0c4177ba42..f181f54005 100644
--- a/boost/intrusive/sgtree.hpp
+++ b/boost/intrusive/sgtree.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -48,7 +48,7 @@ namespace intrusive {
namespace detail{
-//! Returns floor(log(n)/log(sqrt(2))) -> floor(2*log2(n))
+//! Returns floor(log2(n)/log2(sqrt(2))) -> floor(2*log2(n))
//! Undefined if N is 0.
//!
//! This function does not use float point operations.
@@ -83,9 +83,9 @@ struct h_alpha_t
std::size_t operator()(std::size_t n) const
{
- //Returns floor(log1/alpha(n)) ->
- // floor(log(n)/log(1/alpha)) ->
- // floor(log(n)/(-log(alpha)))
+ //Returns floor(log2(1/alpha(n))) ->
+ // floor(log2(n)/log(1/alpha)) ->
+ // floor(log2(n)/(-log2(alpha)))
//return static_cast<std::size_t>(std::log(float(n))*inv_minus_logalpha_);
return static_cast<std::size_t>(detail::fast_log2(float(n))*inv_minus_logalpha_);
}
@@ -103,7 +103,7 @@ struct alpha_by_max_size_t
alpha_by_max_size_t(float alpha)
: alpha_(alpha)
{}
-
+
float operator()(std::size_t max_tree_size) const
{ return float(max_tree_size)*alpha_; }
@@ -125,7 +125,7 @@ struct alpha_holder
{ return alpha_; }
void set_alpha(float alpha)
- {
+ {
alpha_ = alpha;
inv_minus_logalpha_ = 1/(-detail::fast_log2(alpha));
}
@@ -191,7 +191,7 @@ struct sg_set_defaults
//! The class template sgtree is an intrusive scapegoat tree container, that
//! is used to construct intrusive sg_set and sg_multiset containers.
-//! The no-throw guarantee holds only, if the value_compare object
+//! The no-throw guarantee holds only, if the value_compare object
//! doesn't throw.
//!
//! The template parameter \c T is the type to be managed by the container.
@@ -260,7 +260,7 @@ class sgtree_impl
//noncopyable
BOOST_MOVABLE_BUT_NOT_COPYABLE(sgtree_impl)
- enum { safemode_or_autounlink =
+ enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
(int)real_value_traits::link_mode == (int)safe_link };
@@ -299,7 +299,7 @@ class sgtree_impl
void priv_alpha(float alpha)
{ return this->priv_alpha_traits().set_alpha(alpha); }
-
+
const value_compare &priv_comp() const
{ return data_.node_plus_pred_.get(); }
@@ -363,18 +363,18 @@ class sgtree_impl
typedef typename node_algorithms::insert_commit_data insert_commit_data;
- //! <b>Effects</b>: Constructs an empty tree.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //! <b>Effects</b>: Constructs an empty tree.
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or the copy constructorof the value_compare object throws. Basic guarantee.
sgtree_impl( const value_compare &cmp = value_compare()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: data_(cmp, v_traits)
- {
- node_algorithms::init_header(this->priv_header_ptr());
+ {
+ node_algorithms::init_header(this->priv_header_ptr());
this->priv_size_traits().set_size(size_type(0));
}
@@ -386,7 +386,7 @@ class sgtree_impl
//!
//! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
//! comp and otherwise N * log N, where N is the distance between first and last.
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or the copy constructor/operator() of the value_compare object throws. Basic guarantee.
@@ -405,58 +405,58 @@ class sgtree_impl
}
//! <b>Effects</b>: to-do
- //!
+ //!
sgtree_impl(BOOST_RV_REF(sgtree_impl) x)
: data_(::boost::move(x.priv_comp()), ::boost::move(x.priv_value_traits()))
{
- node_algorithms::init_header(this->priv_header_ptr());
+ node_algorithms::init_header(this->priv_header_ptr());
this->priv_size_traits().set_size(size_type(0));
this->swap(x);
}
//! <b>Effects</b>: to-do
- //!
- sgtree_impl& operator=(BOOST_RV_REF(sgtree_impl) x)
+ //!
+ sgtree_impl& operator=(BOOST_RV_REF(sgtree_impl) x)
{ this->swap(x); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the set
- //! are not deleted (i.e. no destructors are called), but the nodes according to
- //! the value_traits template parameter are reinitialized and thus can be reused.
- //!
- //! <b>Complexity</b>: Linear to elements contained in *this.
- //!
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the set
+ //! are not deleted (i.e. no destructors are called), but the nodes according to
+ //! the value_traits template parameter are reinitialized and thus can be reused.
+ //!
+ //! <b>Complexity</b>: Linear to elements contained in *this.
+ //!
//! <b>Throws</b>: Nothing.
- ~sgtree_impl()
+ ~sgtree_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return iterator (node_traits::get_left(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return cbegin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return const_iterator (node_traits::get_left(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return iterator (this->priv_header_ptr(), this); }
@@ -464,138 +464,138 @@ class sgtree_impl
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the tree.
//!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return cend(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return const_iterator (uncast(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
//! reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rbegin()
{ return reverse_iterator(end()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rbegin() const
{ return const_reverse_iterator(end()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crbegin() const
{ return const_reverse_iterator(end()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rend()
{ return reverse_iterator(begin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rend() const
{ return const_reverse_iterator(begin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crend() const
{ return const_reverse_iterator(begin()); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of sgtree.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the sgtree associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static sgtree_impl &container_from_end_iterator(iterator end_iterator)
{ return priv_container_from_end_iterator(end_iterator); }
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of sgtree.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the sgtree associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const sgtree_impl &container_from_end_iterator(const_iterator end_iterator)
{ return priv_container_from_end_iterator(end_iterator); }
//! <b>Precondition</b>: it must be a valid iterator
//! of rbtree.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the tree associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static sgtree_impl &container_from_iterator(iterator it)
{ return priv_container_from_iterator(it); }
//! <b>Precondition</b>: it must be a valid end const_iterator
//! of rbtree.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the tree associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static const sgtree_impl &container_from_iterator(const_iterator it)
{ return priv_container_from_iterator(it); }
//! <b>Effects</b>: Returns the value_compare object used by the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If value_compare copy-constructor throws.
value_compare value_comp() const
{ return priv_comp(); }
//! <b>Effects</b>: Returns true if the container is empty.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return node_algorithms::unique(this->priv_header_ptr()); }
//! <b>Effects</b>: Returns the number of elements stored in the tree.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this
//! if constant-time size option is disabled. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{
@@ -607,9 +607,9 @@ class sgtree_impl
}
//! <b>Effects</b>: Swaps the contents of two sgtrees.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the comparison functor's swap call throws.
void swap(sgtree_impl& other)
{
@@ -628,14 +628,14 @@ class sgtree_impl
}
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts value into the tree before the upper bound.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert_equal(reference value)
@@ -656,16 +656,16 @@ class sgtree_impl
//! <b>Requires</b>: value must be an lvalue, and "hint" must be
//! a valid iterator.
- //!
+ //!
//! <b>Effects</b>: Inserts x into the tree, using "hint" as a hint to
//! where it will be inserted. If "hint" is the upper_bound
//! the insertion takes constant time (two comparisons in the worst case)
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert_equal(const_iterator hint, reference value)
@@ -684,18 +684,18 @@ class sgtree_impl
return iterator(p, this);
}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Inserts a each element of a range into the tree
//! before the upper bound of the key of each element.
- //!
+ //!
//! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
//! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -707,15 +707,15 @@ class sgtree_impl
}
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts value into the tree if the value
//! is not already present.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
std::pair<iterator, bool> insert_unique(reference value)
@@ -729,16 +729,16 @@ class sgtree_impl
//! <b>Requires</b>: value must be an lvalue, and "hint" must be
//! a valid iterator
- //!
+ //!
//! <b>Effects</b>: Tries to insert x into the tree, using "hint" as a hint
//! to where it will be inserted.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time (two comparisons in the worst case)
//! if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert_unique(const_iterator hint, reference value)
@@ -750,17 +750,17 @@ class sgtree_impl
return insert_unique_commit(value, commit_data);
}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Tries to insert each element of a range into the tree.
- //!
- //! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
- //! size of the range. However, it is linear in N if the range is already sorted
+ //!
+ //! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
+ //! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -777,10 +777,10 @@ class sgtree_impl
}
}
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare. The difference is that
//! key_value_comp compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the container, using
//! a user provided key instead of the value itself.
//!
@@ -789,16 +789,16 @@ class sgtree_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic.
//!
//! <b>Throws</b>: If the key_value_comp ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! node that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that
+ //! than the value_type and this function offers the possibility to use that
//! part to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
@@ -813,18 +813,18 @@ class sgtree_impl
{
detail::key_nodeptr_comp<KeyValueCompare, sgtree_impl>
comp(key_value_comp, this);
- std::pair<node_ptr, bool> ret =
+ std::pair<node_ptr, bool> ret =
(node_algorithms::insert_unique_check
(this->priv_header_ptr(), key, comp, commit_data));
return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
}
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare. The difference is that
//! key_value_comp compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the container, using
- //! a user provided key instead of the value itself, using "hint"
+ //! a user provided key instead of the value itself, using "hint"
//! as a hint to where it will be inserted.
//!
//! <b>Returns</b>: If there is an equivalent value
@@ -832,23 +832,23 @@ class sgtree_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it's amortized
//! constant time if t is inserted immediately before hint.
//!
//! <b>Throws</b>: If the key_value_comp ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! constructing that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that key
+ //! than the value_type and this function offers the possibility to use that key
//! to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
//! "insert_commit" to insert the object in constant-time. This can give a total
//! constant-time complexity to the insertion: check(O(1)) + commit(O(1)).
- //!
+ //!
//! "commit_data" remains valid for a subsequent "insert_commit" only if no more
//! objects are inserted or erased from the container.
template<class KeyType, class KeyValueCompare>
@@ -858,7 +858,7 @@ class sgtree_impl
{
detail::key_nodeptr_comp<KeyValueCompare, sgtree_impl>
comp(key_value_comp, this);
- std::pair<node_ptr, bool> ret =
+ std::pair<node_ptr, bool> ret =
(node_algorithms::insert_unique_check
(this->priv_header_ptr(), hint.pointed_node(), key, comp, commit_data));
return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
@@ -868,16 +868,16 @@ class sgtree_impl
//! must have been obtained from a previous call to "insert_check".
//! No objects should have been inserted or erased from the container between
//! the "insert_check" that filled "commit_data" and the call to "insert_commit".
- //!
+ //!
//! <b>Effects</b>: Inserts the value in the avl_set using the information obtained
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Returns</b>: An iterator to the newly inserted object.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function has only sense if a "insert_check" has been
//! previously executed to fill "commit_data". No value should be inserted or
//! erased between the "insert_check" and "insert_commit" calls.
@@ -900,11 +900,11 @@ class sgtree_impl
//! once inserted according to the predicate
//!
//! <b>Effects</b>: Inserts x into the tree before "pos".
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if "pos" is not
//! the successor of "value" tree ordering invariant will be broken.
//! This is a low-level function to be used only for performance reasons
@@ -927,11 +927,11 @@ class sgtree_impl
//! than the greatest inserted key
//!
//! <b>Effects</b>: Inserts x into the tree in the last position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! less than the greatest inserted key tree ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -944,7 +944,7 @@ class sgtree_impl
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
node_algorithms::push_back
- ( this->priv_header_ptr(), to_insert
+ ( this->priv_header_ptr(), to_insert
, (size_type)this->size(), this->get_h_alpha_func(), max_tree_size);
this->priv_size_traits().increment();
data_.max_tree_size_ = (size_type)max_tree_size;
@@ -954,11 +954,11 @@ class sgtree_impl
//! than the minimum inserted key
//!
//! <b>Effects</b>: Inserts x into the tree in the first position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! greater than the minimum inserted key tree ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -977,12 +977,12 @@ class sgtree_impl
data_.max_tree_size_ = (size_type)max_tree_size;
}
- //! <b>Effects</b>: Erases the element pointed to by pos.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by pos.
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator i)
@@ -1003,26 +1003,26 @@ class sgtree_impl
return ret.unconst();
}
- //! <b>Effects</b>: Erases the range pointed to by b end e.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator b, const_iterator e)
{ size_type n; return private_erase(b, e, n); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
@@ -1032,15 +1032,15 @@ class sgtree_impl
//! according to the comparison functor "comp".
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyValueCompare>
- size_type erase(const KeyType& key, KeyValueCompare comp
+ size_type erase(const KeyType& key, KeyValueCompare comp
/// @cond
, typename detail::enable_if_c<!detail::is_convertible<KeyValueCompare, const_iterator>::value >::type * = 0
/// @endcond
@@ -1054,14 +1054,14 @@ class sgtree_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Erases the element pointed to by pos.
+ //! <b>Effects</b>: Erases the element pointed to by pos.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
@@ -1082,12 +1082,12 @@ class sgtree_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -1098,13 +1098,13 @@ class sgtree_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -1123,11 +1123,11 @@ class sgtree_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyValueCompare, class Disposer>
@@ -1143,13 +1143,13 @@ class sgtree_impl
return n;
}
- //! <b>Effects</b>: Erases all of the elements.
- //!
+ //! <b>Effects</b>: Erases all of the elements.
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
@@ -1167,9 +1167,9 @@ class sgtree_impl
//! each node to be erased.
//! <b>Complexity</b>: Average complexity for is at most O(log(size() + N)),
//! where N is the number of elements in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. Calls N times to disposer functor.
template<class Disposer>
@@ -1181,19 +1181,19 @@ class sgtree_impl
}
//! <b>Effects</b>: Returns the number of contained elements with the given value
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given value.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type count(const_reference value) const
{ return this->count(value, priv_comp()); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
size_type count(const KeyType &key, KeyValueCompare comp) const
@@ -1204,27 +1204,27 @@ class sgtree_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator lower_bound(const_reference value)
{ return this->lower_bound(value, priv_comp()); }
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator lower_bound(const_reference value) const
{ return this->lower_bound(value, priv_comp()); }
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
iterator lower_bound(const KeyType &key, KeyValueCompare comp)
@@ -1237,9 +1237,9 @@ class sgtree_impl
//! <b>Effects</b>: Returns a const iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
const_iterator lower_bound(const KeyType &key, KeyValueCompare comp) const
@@ -1252,9 +1252,9 @@ class sgtree_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator upper_bound(const_reference value)
{ return this->upper_bound(value, priv_comp()); }
@@ -1264,7 +1264,7 @@ class sgtree_impl
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
iterator upper_bound(const KeyType &key, KeyValueCompare comp)
@@ -1277,9 +1277,9 @@ class sgtree_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator upper_bound(const_reference value) const
{ return this->upper_bound(value, priv_comp()); }
@@ -1289,7 +1289,7 @@ class sgtree_impl
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
const_iterator upper_bound(const KeyType &key, KeyValueCompare comp) const
@@ -1300,20 +1300,20 @@ class sgtree_impl
(this->priv_header_ptr(), key, key_node_comp), this);
}
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
//! k or end() if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator find(const_reference value)
{ return this->find(value, priv_comp()); }
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
//! k or end() if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
iterator find(const KeyType &key, KeyValueCompare comp)
@@ -1324,20 +1324,20 @@ class sgtree_impl
(node_algorithms::find(this->priv_header_ptr(), key, key_node_comp), this);
}
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
//! k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator find(const_reference value) const
{ return this->find(value, priv_comp()); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
//! k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
const_iterator find(const KeyType &key, KeyValueCompare comp) const
@@ -1351,9 +1351,9 @@ class sgtree_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return this->equal_range(value, priv_comp()); }
@@ -1361,9 +1361,9 @@ class sgtree_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
std::pair<iterator,iterator> equal_range(const KeyType &key, KeyValueCompare comp)
@@ -1378,9 +1378,9 @@ class sgtree_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
std::pair<const_iterator, const_iterator>
equal_range(const_reference value) const
@@ -1389,9 +1389,9 @@ class sgtree_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
std::pair<const_iterator, const_iterator>
@@ -1404,19 +1404,117 @@ class sgtree_impl
return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
}
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ {
+ detail::key_nodeptr_comp<KeyValueCompare, sgtree_impl>
+ key_node_comp(comp, this);
+ std::pair<node_ptr, node_ptr> ret
+ (node_algorithms::bounded_range
+ (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed));
+ return std::pair<iterator, iterator>(iterator(ret.first, this), iterator(ret.second, this));
+ }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator,const_iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator,const_iterator> bounded_range
+ (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ {
+ detail::key_nodeptr_comp<KeyValueCompare, sgtree_impl>
+ key_node_comp(comp, this);
+ std::pair<node_ptr, node_ptr> ret
+ (node_algorithms::bounded_range
+ (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed));
+ return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
+ }
+
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const sgtree_impl &src, Cloner cloner, Disposer disposer)
@@ -1437,11 +1535,11 @@ class sgtree_impl
}
//! <b>Effects</b>: Unlinks the leftmost node from the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! This function is normally used to achieve a step by step
@@ -1460,14 +1558,14 @@ class sgtree_impl
//! <b>Requires</b>: replace_this must be a valid iterator of *this
//! and with_this must not be inserted in any tree.
- //!
+ //!
//! <b>Effects</b>: Replaces replace_this in its position in the
//! tree with with_this. The tree does not need to be rebalanced.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! with_this is not equivalent to *replace_this according to the
//! ordering rules. This function is faster than erasing and inserting
@@ -1483,14 +1581,14 @@ class sgtree_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
@@ -1501,17 +1599,17 @@ class sgtree_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
- static const_iterator s_iterator_to(const_reference value)
+ static const_iterator s_iterator_to(const_reference value)
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
return const_iterator (value_traits::to_node_ptr(const_cast<reference> (value)), 0);
@@ -1519,58 +1617,58 @@ class sgtree_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator iterator_to(reference value)
{ return iterator (value_traits::to_node_ptr(value), this); }
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator iterator_to(const_reference value) const
{ return const_iterator (value_traits::to_node_ptr(const_cast<reference> (value)), this); }
//! <b>Requires</b>: value shall not be in a tree.
- //!
+ //!
//! <b>Effects</b>: init_node puts the hook of a value in a well-known default
//! state.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This function puts the hook in the well-known default state
//! used by auto_unlink and safe hooks.
static void init_node(reference value)
{ node_algorithms::init(value_traits::to_node_ptr(value)); }
//! <b>Effects</b>: Rebalances the tree.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear.
void rebalance()
{ node_algorithms::rebalance(this->priv_header_ptr()); }
//! <b>Requires</b>: old_root is a node of a tree.
- //!
+ //!
//! <b>Effects</b>: Rebalances the subtree rooted at old_root.
//!
//! <b>Returns</b>: The new root of the subtree.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements in the subtree.
iterator rebalance_subtree(iterator root)
{ return iterator(node_algorithms::rebalance_subtree(root.pointed_node()), this); }
@@ -1578,18 +1676,18 @@ class sgtree_impl
//! <b>Returns</b>: The balance factor (alpha) used in this tree
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
float balance_factor() const
{ return this->priv_alpha(); }
//! <b>Requires</b>: new_alpha must be a value between 0.5 and 1.0
- //!
+ //!
//! <b>Effects</b>: Establishes a new balance factor (alpha) and rebalances
//! the tree if the new balance factor is stricter (less) than the old factor.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements in the subtree.
void balance_factor(float new_alpha)
{
@@ -1609,12 +1707,12 @@ class sgtree_impl
}
/*
//! <b>Effects</b>: removes x from a tree of the appropriate type. It has no effect,
- //! if x is not in such a tree.
- //!
+ //! if x is not in such a tree.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This static function is only usable with the "safe mode"
//! hook and non-constant time size lists. Otherwise, the user must use
//! the non-static "erase(reference )" member. If the user calls
@@ -1624,7 +1722,7 @@ class sgtree_impl
static void remove_node(T& value)
{
//This function is only usable for safe mode hooks and non-constant
- //time lists.
+ //time lists.
//BOOST_STATIC_ASSERT((!(safemode_or_autounlink && constant_time_size)));
BOOST_STATIC_ASSERT((!constant_time_size));
BOOST_STATIC_ASSERT((boost::is_convertible<T, value_type>::value));
@@ -1795,7 +1893,7 @@ template<class T, class ...Options>
struct make_sgtree_opt
{
typedef typename pack_options
- < sg_set_defaults<T>,
+ < sg_set_defaults<T>,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1826,7 +1924,7 @@ struct make_sgtree
{
/// @cond
typedef sgtree_impl
- < typename make_sgtree_opt<T,
+ < typename make_sgtree_opt<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1845,7 +1943,7 @@ template<class T, class O1, class O2, class O3, class O4>
template<class T, class ...Options>
#endif
class sgtree
- : public make_sgtree<T,
+ : public make_sgtree<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1854,7 +1952,7 @@ class sgtree
>::type
{
typedef typename make_sgtree
- <T,
+ <T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1903,8 +2001,8 @@ class sgtree
#endif
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/sgtree_algorithms.hpp b/boost/intrusive/sgtree_algorithms.hpp
index f3c433225e..bad1c325a0 100644
--- a/boost/intrusive/sgtree_algorithms.hpp
+++ b/boost/intrusive/sgtree_algorithms.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007.
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -45,15 +45,15 @@ namespace intrusive {
//! <b>Static functions</b>:
//!
//! <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 node_ptr get_left(const_node_ptr n);</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 void set_right(node_ptr n, node_ptr right);</tt>
template<class NodeTraits>
class sgtree_algorithms
@@ -90,27 +90,27 @@ class sgtree_algorithms
//! <b>Requires</b>: header1 and header2 must be the header nodes
//! 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.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
{ return tree_algorithms::swap_tree(header1, header2); }
//! <b>Requires</b>: node1 and node2 can't be header nodes
//! of two trees.
- //!
+ //!
//! <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
//! position node1 had before the function.
- //!
- //! <b>Complexity</b>: Logarithmic.
- //!
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! node1 and node2 are not equivalent according to the ordering rules.
//!
@@ -119,22 +119,22 @@ class sgtree_algorithms
{
if(node1 == node2)
return;
-
+
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
swap_nodes(node1, header1, node2, header2);
}
//! <b>Requires</b>: node1 and node2 can't be header nodes
//! of two trees with header header1 and header2.
- //!
+ //!
//! <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
//! position node1 had before the function.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! 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
//! and new_node must not be inserted in a tree.
- //!
+ //!
//! <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
- //!
- //! <b>Complexity</b>: Logarithmic.
- //!
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! new_node is not equivalent to node_to_be_replaced according to the
//! 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
//! 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
//! 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>Note</b>: This function will break container ordering invariants if
//! new_node is not equivalent to node_to_be_replaced according to the
//! 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); }
//! <b>Requires</b>: node is a tree node but not the header.
- //!
+ //!
//! <b>Effects</b>: Unlinks the node and rebalances the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
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>Effects</b>: Unlinks the leftmost node from the tree, and
//! updates the header link to the new leftmost node.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! 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
//! by init(...).
- //!
+ //!
//! <b>Effects</b>: Returns true if the node is initialized by init().
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static bool unique(const const_node_ptr & node)
{ return tree_algorithms::unique(node); }
//! <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>Complexity</b>: Linear time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static std::size_t count(const const_node_ptr & node)
{ return tree_algorithms::count(node); }
//! <b>Requires</b>: header is the header node of the tree.
- //!
+ //!
//! <b>Effects</b>: Returns the number of nodes above the header.
- //!
+ //!
//! <b>Complexity</b>: Linear time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static std::size_t size(const const_node_ptr & header)
{ return tree_algorithms::size(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>Complexity</b>: Average constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr next_node(const node_ptr & p)
{ return tree_algorithms::next_node(p); }
//! <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>Complexity</b>: Average constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr prev_node(const node_ptr & 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>Effects</b>: After the function unique(node) == true.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <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.
//! unique(header) == true.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <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.
//!
//! <b>Effects</b>: Erases node "z" from the tree with header "header".
- //!
+ //!
//! <b>Complexity</b>: Amortized constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
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)
@@ -307,7 +307,7 @@ class sgtree_algorithms
//typename tree_algorithms::data_for_rebalance info;
tree_algorithms::erase(header, z);
--tree_size;
- if (tree_size > 0 &&
+ if (tree_size > 0 &&
tree_size < alpha_by_maxsize(max_tree_size)){
tree_algorithms::rebalance(header);
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
//! 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
//! except the header.
- //!
+ //!
//! 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
//! 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.
//! 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.
template <class Cloner, class Disposer>
static void clone
@@ -342,13 +342,13 @@ class sgtree_algorithms
//! <b>Requires</b>: "disposer" must be an object function
//! 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
//! except the header.
- //!
+ //!
//! <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.
- //!
+ //!
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
template<class Disposer>
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
@@ -364,7 +364,7 @@ class sgtree_algorithms
//! not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
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.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr upper_bound
@@ -396,7 +396,7 @@ class sgtree_algorithms
//! "key" according to "comp" or "header" if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr find
@@ -414,13 +414,38 @@ class sgtree_algorithms
//! if they there are no equivalent elements.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static std::pair<node_ptr, node_ptr> equal_range
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{ return tree_algorithms::equal_range(header, key, comp); }
+ //! <b>Requires</b>: "header" must be the header node of a tree.
+ //! KeyNodePtrCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyNodePtrCompare>
+ static std::pair<node_ptr, node_ptr> bounded_range
+ (const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp
+ , bool left_closed, bool right_closed)
+ { return tree_algorithms::bounded_range(header, lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: "h" must be the header node of a tree.
//! NodePtrCompare is a function object that induces a strict weak
//! ordering compatible with the strict weak ordering used to create the
@@ -428,10 +453,10 @@ class sgtree_algorithms
//!
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
//! according to "comp".
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class NodePtrCompare, class H_Alpha>
static node_ptr insert_equal_upper_bound
@@ -451,10 +476,10 @@ class sgtree_algorithms
//!
//! <b>Effects</b>: Inserts new_node into the tree before the lower bound
//! according to "comp".
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class NodePtrCompare, class H_Alpha>
static node_ptr insert_equal_lower_bound
@@ -472,14 +497,14 @@ class sgtree_algorithms
//! ordering compatible with the strict weak ordering used to create the
//! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from
//! the "header"'s tree.
- //!
+ //!
//! <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
//! the insertion takes constant time (two comparisons in the worst case).
//!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time if new_node is inserted immediately before "hint".
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class NodePtrCompare, class H_Alpha>
static node_ptr insert_equal
@@ -496,7 +521,7 @@ class sgtree_algorithms
//! KeyNodePtrCompare is a function object that induces a strict weak
//! ordering compatible with the strict weak ordering used to create the
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
- //!
+ //!
//! <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
//! a constant-time node insertion if there is no equivalent node.
@@ -507,11 +532,11 @@ class sgtree_algorithms
//! 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
//! insertion function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic.
//!
//! <b>Throws</b>: If "comp" throws.
- //!
+ //!
//! <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
//! in the tree: if there is an equivalent value
@@ -532,7 +557,7 @@ class sgtree_algorithms
,KeyNodePtrCompare comp, insert_commit_data &commit_data)
{
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);
commit_data.depth = depth;
return ret;
@@ -544,13 +569,13 @@ class sgtree_algorithms
//! "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
//! check "pos" and this precondition must be guaranteed by the caller.
- //!
+ //!
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
//!
//! <b>Complexity</b>: Constant-time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
//! tree invariants might be broken.
template<class H_Alpha>
@@ -567,13 +592,13 @@ class sgtree_algorithms
//! <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
//! greatest inserted key.
- //!
+ //!
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
//!
//! <b>Complexity</b>: Constant-time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
//! tree invariants are broken. This function is slightly faster than
//! using "insert_before".
@@ -589,13 +614,13 @@ class sgtree_algorithms
//! <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
//! lowest inserted key.
- //!
+ //!
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
//!
//! <b>Complexity</b>: Constant-time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
//! tree invariants are broken. This function is slightly faster than
//! using "insert_before".
@@ -613,12 +638,12 @@ class sgtree_algorithms
//! ordering compatible with the strict weak ordering used to create the
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
//! "hint" is node from the "header"'s tree.
- //!
+ //!
//! <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
//! inserted and obtains the needed information to realize
- //! a constant-time node insertion if there is no equivalent node.
- //! If "hint" is the upper_bound the function has constant time
+ //! a constant-time node insertion if there is no equivalent node.
+ //! If "hint" is the upper_bound the function has constant time
//! complexity (two comparisons in the worst case).
//!
//! <b>Returns</b>: If there is an equivalent value
@@ -627,12 +652,12 @@ class sgtree_algorithms
//! 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
//! insertion function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic, but it is
//! amortized constant time if new_node should be inserted immediately before "hint".
//!
//! <b>Throws</b>: If "comp" throws.
- //!
+ //!
//! <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
//! in the tree: if there is an equivalent value
@@ -653,7 +678,7 @@ class sgtree_algorithms
,KeyNodePtrCompare comp, insert_commit_data &commit_data)
{
std::size_t depth;
- std::pair<node_ptr, bool> ret =
+ std::pair<node_ptr, bool> ret =
tree_algorithms::insert_unique_check
(header, hint, key, comp, commit_data, &depth);
commit_data.depth = depth;
@@ -664,16 +689,16 @@ class sgtree_algorithms
//! "commit_data" must have been obtained from a previous call to
//! "insert_unique_check". No objects should have been inserted or erased
//! 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
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <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
//! erased between the "insert_check" and "insert_commit" calls.
@@ -687,23 +712,23 @@ class sgtree_algorithms
}
//! <b>Requires</b>: header must be the header of a tree.
- //!
+ //!
//! <b>Effects</b>: Rebalances the tree.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear.
static void rebalance(const node_ptr & header)
{ tree_algorithms::rebalance(header); }
//! <b>Requires</b>: old_root is a node of a tree.
- //!
+ //!
//! <b>Effects</b>: Rebalances the subtree rooted at old_root.
//!
//! <b>Returns</b>: The new root of the subtree.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear.
static node_ptr rebalance_subtree(const node_ptr & old_root)
{ return tree_algorithms::rebalance_subtree(old_root); }
@@ -713,7 +738,7 @@ class sgtree_algorithms
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr get_header(const node_ptr & n)
{ return tree_algorithms::get_header(n); }
@@ -722,11 +747,11 @@ class sgtree_algorithms
private:
//! <b>Requires</b>: p is a node of a tree.
- //!
+ //!
//! <b>Effects</b>: Returns true if p is the header of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static bool is_header(const const_node_ptr & p)
{ return tree_algorithms::is_header(p); }
@@ -774,8 +799,8 @@ class sgtree_algorithms
/// @endcond
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/slist.hpp b/boost/intrusive/slist.hpp
index 505343869a..d7fc1316b1 100644
--- a/boost/intrusive/slist.hpp
+++ b/boost/intrusive/slist.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -75,12 +75,12 @@ struct slist_defaults
/// @endcond
-//! The class template slist is an intrusive container, that encapsulates
-//! a singly-linked list. You can use such a list to squeeze the last bit
-//! of performance from your application. Unfortunately, the little gains
-//! come with some huge drawbacks. A lot of member functions can't be
-//! implemented as efficiently as for standard containers. To overcome
-//! this limitation some other member functions with rather unusual semantics
+//! The class template slist is an intrusive container, that encapsulates
+//! a singly-linked list. You can use such a list to squeeze the last bit
+//! of performance from your application. Unfortunately, the little gains
+//! come with some huge drawbacks. A lot of member functions can't be
+//! implemented as efficiently as for standard containers. To overcome
+//! this limitation some other member functions with rather unusual semantics
//! have to be introduced.
//!
//! The template parameter \c T is the type to be managed by the container.
@@ -91,11 +91,11 @@ struct slist_defaults
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<>,
//! \c linear<> and \c cache_last<>.
-//!
-//! The iterators of slist are forward iterators. slist provides a static
-//! function called "previous" to compute the previous iterator of a given iterator.
-//! This function has linear complexity. To improve the usability esp. with
-//! the '*_after' functions, ++end() == begin() and previous(begin()) == end()
+//!
+//! The iterators of slist are forward iterators. slist provides a static
+//! function called "previous" to compute the previous iterator of a given iterator.
+//! This function has linear complexity. To improve the usability esp. with
+//! the '*_after' functions, ++end() == begin() and previous(begin()) == end()
//! are defined. An new special function "before_begin()" is defined, which returns
//! an iterator that points one less the beginning of the list: ++before_begin() == begin()
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
@@ -151,7 +151,7 @@ class slist_impl
//noncopyable
BOOST_MOVABLE_BUT_NOT_COPYABLE(slist_impl)
- enum { safemode_or_autounlink =
+ enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
(int)real_value_traits::link_mode == (int)safe_link };
@@ -273,10 +273,10 @@ class slist_impl
{ return this->get_real_value_traits(detail::bool_<external_value_traits>()); }
public:
- //! <b>Effects</b>: constructs an empty list.
- //!
- //! <b>Complexity</b>: Constant
- //!
+ //! <b>Effects</b>: constructs an empty list.
+ //!
+ //! <b>Complexity</b>: Constant
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks).
slist_impl(const value_traits &v_traits = value_traits())
@@ -284,11 +284,11 @@ class slist_impl
{ this->set_default_constructed_state(); }
//! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
- //!
+ //!
//! <b>Effects</b>: Constructs a list equal to [first,last).
- //!
- //! <b>Complexity</b>: Linear in std::distance(b, e). No copy constructors are called.
- //!
+ //!
+ //! <b>Complexity</b>: Linear in std::distance(b, e). No copy constructors are called.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks).
template<class Iterator>
@@ -300,44 +300,44 @@ class slist_impl
}
//! <b>Effects</b>: to-do
- //!
+ //!
slist_impl(BOOST_RV_REF(slist_impl) x)
: data_(::boost::move(x.priv_value_traits()))
{
this->priv_size_traits().set_size(size_type(0));
- node_algorithms::init_header(this->get_root_node());
+ node_algorithms::init_header(this->get_root_node());
this->swap(x);
}
//! <b>Effects</b>: to-do
- //!
- slist_impl& operator=(BOOST_RV_REF(slist_impl) x)
+ //!
+ slist_impl& operator=(BOOST_RV_REF(slist_impl) x)
{ this->swap(x); return *this; }
//! <b>Effects</b>: If it's a safe-mode
//! or auto-unlink value, the destructor does nothing
- //! (ie. no code is generated). Otherwise it detaches all elements from this.
- //! In this case the objects in the list are not deleted (i.e. no destructors
+ //! (ie. no code is generated). Otherwise it detaches all elements from this.
+ //! In this case the objects in the list are not deleted (i.e. no destructors
//! are called), but the hooks according to the value_traits template parameter
//! are set to their default value.
- //!
- //! <b>Complexity</b>: Linear to the number of elements in the list, if
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in the list, if
//! it's a safe-mode or auto-unlink value. Otherwise constant.
~slist_impl()
{}
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements of the list.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the erased elements.
void clear()
{
if(safemode_or_autounlink){
- this->clear_and_dispose(detail::null_disposer());
+ this->clear_and_dispose(detail::null_disposer());
}
else{
this->set_default_constructed_state();
@@ -348,11 +348,11 @@ class slist_impl
//!
//! <b>Effects</b>: Erases all the elements of the container
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements of the list.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators to the erased elements.
template <class Disposer>
void clear_and_dispose(Disposer disposer)
@@ -369,16 +369,16 @@ class slist_impl
}
//! <b>Requires</b>: value must be an lvalue.
- //!
+ //!
//! <b>Effects</b>: Inserts the value in the front of the list.
//! No copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
- void push_front(reference value)
+ void push_front(reference value)
{
node_ptr to_insert = get_real_value_traits().to_node_ptr(value);
if(safemode_or_autounlink)
@@ -388,22 +388,22 @@ class slist_impl
this->set_last_node(to_insert);
}
}
- node_algorithms::link_after(this->get_root_node(), to_insert);
+ node_algorithms::link_after(this->get_root_node(), to_insert);
this->priv_size_traits().increment();
}
//! <b>Requires</b>: value must be an lvalue.
- //!
+ //!
//! <b>Effects</b>: Inserts the value in the back of the list.
//! No copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! This function is only available is cache_last<> is true.
- void push_back(reference value)
+ void push_back(reference value)
{
BOOST_STATIC_ASSERT((cache_last));
this->insert_after(const_iterator(this->get_last_node(), this), value);
@@ -411,24 +411,24 @@ class slist_impl
//! <b>Effects</b>: Erases the first element of the list.
//! No destructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the erased element.
- void pop_front()
+ void pop_front()
{ return this->pop_front_and_dispose(detail::null_disposer()); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Erases the first element of the list.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
void pop_front_and_dispose(Disposer disposer)
@@ -447,23 +447,23 @@ class slist_impl
}
//! <b>Effects</b>: Returns a reference to the first element of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
reference front()
{ return *this->get_real_value_traits().to_value_ptr(node_traits::get_next(this->get_root_node())); }
//! <b>Effects</b>: Returns a const_reference to the first element of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_reference front() const
{ return *this->get_real_value_traits().to_value_ptr(uncast(node_traits::get_next(this->get_root_node()))); }
//! <b>Effects</b>: Returns a reference to the last element of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
@@ -477,9 +477,9 @@ class slist_impl
}
//! <b>Effects</b>: Returns a const_reference to the last element of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
@@ -491,165 +491,165 @@ class slist_impl
}
//! <b>Effects</b>: Returns an iterator to the first element contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator begin()
+ iterator begin()
{ return iterator (node_traits::get_next(this->get_root_node()), this); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator begin() const
+ const_iterator begin() const
{ return const_iterator (node_traits::get_next(this->get_root_node()), this); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cbegin() const
+ const_iterator cbegin() const
{ return const_iterator(node_traits::get_next(this->get_root_node()), this); }
//! <b>Effects</b>: Returns an iterator to the end of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator end()
+ iterator end()
{ return iterator(this->get_end_node(), this); }
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator end() const
+ const_iterator end() const
{ return const_iterator(uncast(this->get_end_node()), this); }
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cend() const
+ const_iterator cend() const
{ return this->end(); }
//! <b>Effects</b>: Returns an iterator that points to a position
//! before the first element. Equivalent to "end()"
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator before_begin()
+ iterator before_begin()
{ return iterator(this->get_root_node(), this); }
//! <b>Effects</b>: Returns an iterator that points to a position
//! before the first element. Equivalent to "end()"
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator before_begin() const
+ const_iterator before_begin() const
{ return const_iterator(uncast(this->get_root_node()), this); }
//! <b>Effects</b>: Returns an iterator that points to a position
//! before the first element. Equivalent to "end()"
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cbefore_begin() const
+ const_iterator cbefore_begin() const
{ return this->before_begin(); }
//! <b>Effects</b>: Returns an iterator to the last element contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: This function is present only if cached_last<> option is true.
- iterator last()
+ iterator last()
{ return iterator (this->get_last_node(), this); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: This function is present only if cached_last<> option is true.
- const_iterator last() const
+ const_iterator last() const
{ return const_iterator (this->get_last_node(), this); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: This function is present only if cached_last<> option is true.
- const_iterator clast() const
+ const_iterator clast() const
{ return const_iterator(this->get_last_node(), this); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of slist.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the slist associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static slist_impl &container_from_end_iterator(iterator end_iterator)
{ return slist_impl::priv_container_from_end_iterator(end_iterator); }
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of slist.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the slist associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const slist_impl &container_from_end_iterator(const_iterator end_iterator)
{ return slist_impl::priv_container_from_end_iterator(end_iterator); }
//! <b>Effects</b>: Returns the number of the elements contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements contained in the list.
//! if constant_time_size is false. Constant time otherwise.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
size_type size() const
{
if(constant_time_size)
return this->priv_size_traits().get_size();
else
- return node_algorithms::count(this->get_root_node()) - 1;
+ return node_algorithms::count(this->get_root_node()) - 1;
}
//! <b>Effects</b>: Returns true if the list contains no elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
bool empty() const
{ return node_algorithms::unique(this->get_root_node()); }
//! <b>Effects</b>: Swaps the elements of x and *this.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Linear to the number of elements of both lists.
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements of both lists.
//! Constant-time if linear<> and/or cache_last<> options are used.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
void swap(slist_impl& other)
{
@@ -669,11 +669,11 @@ class slist_impl
//! <b>Effects</b>: Moves backwards all the elements, so that the first
//! element becomes the second, the second becomes the third...
//! the last element becomes the first one.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements plus the number shifts.
- //!
+ //!
//! <b>Note</b>: Iterators Does not affect the validity of iterators and references.
void shift_backwards(size_type n = 1)
{ this->priv_shift_backwards(n, detail::bool_<linear>()); }
@@ -681,11 +681,11 @@ class slist_impl
//! <b>Effects</b>: Moves forward all the elements, so that the second
//! element becomes the first, the third becomes the second...
//! the first element becomes the last one.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements plus the number shifts.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
void shift_forward(size_type n = 1)
{ this->priv_shift_forward(n, detail::bool_<linear>()); }
@@ -694,15 +694,15 @@ class slist_impl
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws.
template <class Cloner, class Disposer>
void clone_from(const slist_impl &src, Cloner cloner, Disposer disposer)
@@ -725,11 +725,11 @@ class slist_impl
//! No copy constructor is called.
//!
//! <b>Returns</b>: An iterator to the inserted element.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
iterator insert_after(const_iterator prev_p, reference value)
{
@@ -745,17 +745,17 @@ class slist_impl
return iterator (n, this);
}
- //! <b>Requires</b>: Dereferencing iterator must yield
+ //! <b>Requires</b>: Dereferencing iterator must yield
//! an lvalue of type value_type and prev_p must point to an element
//! contained by the list or to the end node.
- //!
+ //!
//! <b>Effects</b>: Inserts the [first, last)
//! after the position prev_p.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements inserted.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
template<class Iterator>
void insert_after(const_iterator prev_p, Iterator first, Iterator last)
@@ -769,44 +769,44 @@ class slist_impl
//!
//! <b>Effects</b>: Inserts the value before the position pointed by p.
//! No copy constructor is called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements before p.
//! Constant-time if cache_last<> is true and p == end().
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
iterator insert(const_iterator p, reference value)
{ return this->insert_after(this->previous(p), value); }
- //! <b>Requires</b>: Dereferencing iterator must yield
- //! an lvalue of type value_type and p must point to an element
+ //! <b>Requires</b>: Dereferencing iterator must yield
+ //! an lvalue of type value_type and p must point to an element
//! contained by the list or to the end node.
- //!
+ //!
//! <b>Effects</b>: Inserts the pointed by b and e
//! before the position p. No copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements inserted plus linear
//! to the elements before b.
//! Linear to the number of elements to insert if cache_last<> option is true and p == end().
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
template<class Iterator>
void insert(const_iterator p, Iterator b, Iterator e)
{ return this->insert_after(this->previous(p), b, e); }
- //! <b>Effects</b>: Erases the element after the element pointed by prev of
+ //! <b>Effects</b>: Erases the element after the element pointed by prev of
//! the list. No destructors are called.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
iterator erase_after(const_iterator prev)
@@ -817,12 +817,12 @@ class slist_impl
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of erased elements if it's a safe-mode
//! , auto-unlink value or constant-time size is activated. Constant time otherwise.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
iterator erase_after(const_iterator before_first, const_iterator last)
@@ -849,12 +849,12 @@ class slist_impl
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: constant-time if link_mode is normal_link.
+ //!
+ //! <b>Complexity</b>: constant-time if link_mode is normal_link.
//! Linear to the elements (last - before_first) otherwise.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
iterator erase_after(const_iterator before_first, const_iterator last, difference_type n)
@@ -879,33 +879,33 @@ class slist_impl
}
}
- //! <b>Effects</b>: Erases the element pointed by i of the list.
+ //! <b>Effects</b>: Erases the element pointed by i of the list.
//! No destructors are called.
//!
//! <b>Returns</b>: the first element remaining beyond the removed element,
//! or end() if no such element exists.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements before i.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
iterator erase(const_iterator i)
{ return this->erase_after(this->previous(i)); }
//! <b>Requires</b>: first and last must be valid iterator to elements in *this.
- //!
+ //!
//! <b>Effects</b>: Erases the range pointed by b and e.
//! No destructors are called.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements before last.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements.
iterator erase(const_iterator first, const_iterator last)
@@ -917,12 +917,12 @@ class slist_impl
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: linear to the elements before first if link_mode is normal_link
//! and constant_time_size is activated. Linear to the elements before last otherwise.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
iterator erase(const_iterator first, const_iterator last, difference_type n)
@@ -930,17 +930,17 @@ class slist_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Erases the element after the element pointed by prev of
+ //! <b>Effects</b>: Erases the element after the element pointed by prev of
//! the list.
//! Disposer::operator()(pointer) is called for the removed element.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
iterator erase_after_and_dispose(const_iterator prev, Disposer disposer)
@@ -992,11 +992,11 @@ class slist_impl
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Lineal to the elements (last - before_first + 1).
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
iterator erase_after_and_dispose(const_iterator before_first, const_iterator last, Disposer disposer)
@@ -1020,17 +1020,17 @@ class slist_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Erases the element pointed by i of the list.
+ //! <b>Effects</b>: Erases the element pointed by i of the list.
//! No destructors are called.
//! Disposer::operator()(pointer) is called for the removed element.
//!
//! <b>Returns</b>: the first element remaining beyond the removed element,
//! or end() if no such element exists.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements before i.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
template<class Disposer>
@@ -1045,38 +1045,38 @@ class slist_impl
//! <b>Requires</b>: first and last must be valid iterator to elements in *this.
//! Disposer::operator()(pointer) shouldn't throw.
- //!
+ //!
//! <b>Effects</b>: Erases the range pointed by b and e.
//! No destructors are called.
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of erased elements plus linear
//! to the elements before first.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator first, const_iterator last, Disposer disposer)
{ return this->erase_after_and_dispose(this->previous(first), last, disposer); }
- //! <b>Requires</b>: Dereferencing iterator must yield
+ //! <b>Requires</b>: Dereferencing iterator must yield
//! an lvalue of type value_type.
- //!
+ //!
//! <b>Effects</b>: Clears the list and inserts the range pointed by b and e.
//! No destructors or copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements inserted plus
//! linear to the elements contained in the list if it's a safe-mode
//! or auto-unlink value.
//! Linear to the number of elements inserted in the list otherwise.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements.
template<class Iterator>
@@ -1088,18 +1088,18 @@ class slist_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Requires</b>: Dereferencing iterator must yield
+ //! <b>Requires</b>: Dereferencing iterator must yield
//! an lvalue of type value_type.
- //!
+ //!
//! <b>Effects</b>: Clears the list and inserts the range pointed by b and e.
//! No destructors or copy constructors are called.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements inserted plus
//! linear to the elements contained in the list.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements.
template<class Iterator, class Disposer>
@@ -1111,18 +1111,18 @@ class slist_impl
//! <b>Requires</b>: prev must point to an element contained by this list or
//! to the before_begin() element
- //!
+ //!
//! <b>Effects</b>: Transfers all the elements of list x to this list, after the
//! the element pointed by prev. No destructors or copy constructors are called.
- //!
+ //!
//! <b>Returns</b>: Nothing.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: In general, linear to the elements contained in x.
- //! Constant-time if cache_last<> option is true and also constant-time if
+ //! Constant-time if cache_last<> option is true and also constant-time if
//! linear<> option is true "this" is empty and "last" is not used.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
//!
@@ -1159,14 +1159,14 @@ class slist_impl
//! <b>Requires</b>: prev must point to an element contained by this list or
//! to the before_begin() element. prev_ele must point to an element contained in list
//! x or must be x.before_begin().
- //!
- //! <b>Effects</b>: Transfers the element after prev_ele, from list x to this list,
+ //!
+ //! <b>Effects</b>: Transfers the element after prev_ele, from list x to this list,
//! after the element pointed by prev. No destructors or copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator prev_ele)
@@ -1177,17 +1177,17 @@ class slist_impl
//! <b>Requires</b>: prev_pos must be a dereferenceable iterator in *this or be
//! before_begin(), and before_first and before_last belong to x and
- //! ++before_first != x.end() && before_last != x.end().
- //!
+ //! ++before_first != x.end() && before_last != x.end().
+ //!
//! <b>Effects</b>: Transfers the range (before_first, before_last] from list x to this
//! list, after the element pointed by prev_pos.
//! No destructors or copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements transferred
//! if constant_time_size is true. Constant-time otherwise.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_first, const_iterator before_last)
@@ -1203,14 +1203,14 @@ class slist_impl
//! before_begin(), and before_first and before_last belong to x and
//! ++before_first != x.end() && before_last != x.end() and
//! n == std::distance(before_first, before_last).
- //!
+ //!
//! <b>Effects</b>: Transfers the range (before_first, before_last] from list x to this
//! list, after the element pointed by p. No destructors or copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_first, const_iterator before_last, difference_type n)
@@ -1227,19 +1227,19 @@ class slist_impl
}
//! <b>Requires</b>: it is an iterator to an element in *this.
- //!
+ //!
//! <b>Effects</b>: Transfers all the elements of list x to this list, before the
//! the element pointed by it. No destructors or copy constructors are called.
- //!
+ //!
//! <b>Returns</b>: Nothing.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the elements contained in x plus linear to
//! the elements before it.
//! Linear to the elements before it if cache_last<> option is true.
//! Constant-time if cache_last<> option is true and it == end().
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
//!
@@ -1253,66 +1253,66 @@ class slist_impl
//! <b>Requires</b>: it p must be a valid iterator of *this.
//! elem must point to an element contained in list
//! x.
- //!
- //! <b>Effects</b>: Transfers the element elem, from list x to this list,
+ //!
+ //! <b>Effects</b>: Transfers the element elem, from list x to this list,
//! before the element pointed by pos. No destructors or copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements before pos and before elem.
//! Linear to the elements before elem if cache_last<> option is true and pos == end().
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator pos, slist_impl &x, const_iterator elem)
{ return this->splice_after(this->previous(pos), x, x.previous(elem)); }
//! <b>Requires</b>: pos must be a dereferenceable iterator in *this
- //! and first and last belong to x and first and last a valid range on x.
- //!
+ //! and first and last belong to x and first and last a valid range on x.
+ //!
//! <b>Effects</b>: Transfers the range [first, last) from list x to this
//! list, before the element pointed by pos.
//! No destructors or copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the sum of elements before pos, first, and last
//! plus linear to the number of elements transferred if constant_time_size is true.
//! Linear to the sum of elements before first, and last
//! plus linear to the number of elements transferred if constant_time_size is true
//! if cache_last<> is true and pos == end()
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator pos, slist_impl &x, const_iterator first, const_iterator last)
{ return this->splice_after(this->previous(pos), x, x.previous(first), x.previous(last)); }
//! <b>Requires</b>: pos must be a dereferenceable iterator in *this
- //! and first and last belong to x and first and last a valid range on x.
+ //! and first and last belong to x and first and last a valid range on x.
//! n == std::distance(first, last).
- //!
+ //!
//! <b>Effects</b>: Transfers the range [first, last) from list x to this
//! list, before the element pointed by pos.
//! No destructors or copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the sum of elements before pos, first, and last.
//! Linear to the sum of elements before first and last
//! if cache_last<> is true and pos == end().
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator pos, slist_impl &x, const_iterator first, const_iterator last, difference_type n)
{ return this->splice_after(this->previous(pos), x, x.previous(first), x.previous(last), n); }
- //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
+ //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or the predicate throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
//!
@@ -1368,44 +1368,44 @@ class slist_impl
//! <b>Requires</b>: p must be a comparison function that induces a strict weak
//! ordering and both *this and x must be sorted according to that ordering
- //! The lists x and *this must be distinct.
- //!
+ //! The lists x and *this must be distinct.
+ //!
//! <b>Effects</b>: This function removes all of x's elements and inserts them
- //! in order into *this. The merge is stable; that is, if an element from *this is
- //! equivalent to one from x, then the element from *this will precede the one from x.
- //!
+ //! in order into *this. The merge is stable; that is, if an element from *this is
+ //! equivalent to one from x, then the element from *this will precede the one from x.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or std::less<value_type> throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated.
void sort()
{ this->sort(std::less<value_type>()); }
//! <b>Requires</b>: p must be a comparison function that induces a strict weak
//! ordering and both *this and x must be sorted according to that ordering
- //! The lists x and *this must be distinct.
- //!
+ //! The lists x and *this must be distinct.
+ //!
//! <b>Effects</b>: This function removes all of x's elements and inserts them
- //! in order into *this. The merge is stable; that is, if an element from *this is
- //! equivalent to one from x, then the element from *this will precede the one from x.
- //!
+ //! in order into *this. The merge is stable; that is, if an element from *this is
+ //! equivalent to one from x, then the element from *this will precede the one from x.
+ //!
//! <b>Returns</b>: Nothing.
- //!
+ //!
//! <b>Throws</b>: If the predicate throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated.
- //!
+ //!
//! <b>Additional note</b>: If optional "last" argument is passed, it is assigned
//! to an iterator to the last transferred value or end() is x is empty.
template<class Predicate>
- void merge(slist_impl& x, Predicate p, const_iterator *last = 0)
+ void merge(slist_impl& x, Predicate p, const_iterator *last = 0)
{
const_iterator e(this->cend()), ex(x.cend()), bb(this->cbefore_begin()),
bb_next;
@@ -1432,25 +1432,25 @@ class slist_impl
}
//! <b>Effects</b>: This function removes all of x's elements and inserts them
- //! in order into *this according to std::less<value_type>. The merge is stable;
- //! that is, if an element from *this is equivalent to one from x, then the element
- //! from *this will precede the one from x.
- //!
+ //! in order into *this according to std::less<value_type>. The merge is stable;
+ //! that is, if an element from *this is equivalent to one from x, then the element
+ //! from *this will precede the one from x.
+ //!
//! <b>Throws</b>: if std::less<value_type> throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated
void merge(slist_impl& x)
{ this->merge(x, std::less<value_type>()); }
- //! <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>Complexity</b>: This function is linear to the contained elements.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated
void reverse()
{
@@ -1462,13 +1462,13 @@ class slist_impl
//! <b>Effects</b>: Removes all the elements that compare equal to value.
//! No destructors are called.
- //!
+ //!
//! <b>Throws</b>: If std::equal_to<value_type> throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
- //! and iterators to elements that are not removed remain valid. This function is
+ //! and iterators to elements that are not removed remain valid. This function is
//! linear time: it performs exactly size() comparisons for equality.
void remove(const_reference value)
{ this->remove_if(detail::equal_to_value<const_reference>(value)); }
@@ -1479,9 +1479,9 @@ class slist_impl
//! Disposer::operator()(pointer) is called for every removed element.
//!
//! <b>Throws</b>: If std::equal_to<value_type> throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class Disposer>
@@ -1490,11 +1490,11 @@ class slist_impl
//! <b>Effects</b>: Removes all the elements for which a specified
//! predicate is satisfied. No destructors are called.
- //!
+ //!
//! <b>Throws</b>: If pred throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: Linear time. It performs exactly size() calls to the predicate.
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class Pred>
@@ -1508,7 +1508,7 @@ class slist_impl
//! Disposer::operator()(pointer) is called for every removed element.
//!
//! <b>Throws</b>: If pred throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
//!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
@@ -1517,7 +1517,7 @@ class slist_impl
void remove_and_dispose_if(Pred pred, Disposer disposer)
{
const_iterator bcur(this->before_begin()), cur(this->begin()), e(this->end());
-
+
while(cur != e){
if (pred(*cur)){
cur = this->erase_after_and_dispose(bcur, disposer);
@@ -1532,26 +1532,26 @@ class slist_impl
}
}
- //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
+ //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that are equal from the list. No destructors are called.
- //!
+ //!
//! <b>Throws</b>: If std::equal_to<value_type> throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: Linear time (size()-1) comparisons calls to pred()).
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
void unique()
{ this->unique_and_dispose(std::equal_to<value_type>(), detail::null_disposer()); }
- //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
+ //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that satisfy some binary predicate from the list.
//! No destructors are called.
- //!
+ //!
//! <b>Throws</b>: If the predicate throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: Linear time (size()-1) comparisons equality comparisons.
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class BinaryPredicate>
@@ -1560,14 +1560,14 @@ class slist_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
+ //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that satisfy some binary predicate from the list.
//! Disposer::operator()(pointer) is called for every removed element.
- //!
+ //!
//! <b>Throws</b>: If std::equal_to<value_type> throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: Linear time (size()-1) comparisons equality comparisons.
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class Disposer>
@@ -1576,14 +1576,14 @@ class slist_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
+ //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that satisfy some binary predicate from the list.
//! Disposer::operator()(pointer) is called for every removed element.
- //!
+ //!
//! <b>Throws</b>: If the predicate throws. Basic guarantee.
- //!
+ //!
//! <b>Complexity</b>: Linear time (size()-1) comparisons equality comparisons.
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class BinaryPredicate, class Disposer>
@@ -1610,17 +1610,17 @@ class slist_impl
}
//! <b>Requires</b>: value must be a reference to a value inserted in a list.
- //!
+ //!
//! <b>Effects</b>: This function returns a const_iterator pointing to the element
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated.
//! This static function is available only if the <i>value traits</i>
//! is stateless.
- static iterator s_iterator_to(reference value)
+ static iterator s_iterator_to(reference value)
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
//BOOST_INTRUSIVE_INVARIANT_ASSERT (!node_algorithms::inited(value_traits::to_node_ptr(value)));
@@ -1628,17 +1628,17 @@ class slist_impl
}
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
- //!
+ //!
//! <b>Effects</b>: This function returns an iterator pointing to the element.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated.
//! This static function is available only if the <i>value traits</i>
//! is stateless.
- static const_iterator s_iterator_to(const_reference value)
+ static const_iterator s_iterator_to(const_reference value)
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
//BOOST_INTRUSIVE_INVARIANT_ASSERT (!node_algorithms::inited(value_traits::to_node_ptr(const_cast<reference> (value))));
@@ -1646,28 +1646,28 @@ class slist_impl
}
//! <b>Requires</b>: value must be a reference to a value inserted in a list.
- //!
+ //!
//! <b>Effects</b>: This function returns a const_iterator pointing to the element
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated.
- iterator iterator_to(reference value)
+ iterator iterator_to(reference value)
{
//BOOST_INTRUSIVE_INVARIANT_ASSERT (!node_algorithms::inited(value_traits::to_node_ptr(value)));
return iterator (value_traits::to_node_ptr(value), this);
}
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
- //!
+ //!
//! <b>Effects</b>: This function returns an iterator pointing to the element.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated.
const_iterator iterator_to(const_reference value) const
{
@@ -1675,35 +1675,35 @@ class slist_impl
return const_iterator (value_traits::to_node_ptr(const_cast<reference> (value)), this);
}
- //! <b>Returns</b>: The iterator to the element before i in the list.
- //! Returns the end-iterator, if either i is the begin-iterator or the
- //! list is empty.
- //!
+ //! <b>Returns</b>: The iterator to the element before i in the list.
+ //! Returns the end-iterator, if either i is the begin-iterator or the
+ //! list is empty.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements before i.
//! Constant if cache_last<> is true and i == end().
iterator previous(iterator i)
{ return this->previous(this->cbefore_begin(), i); }
- //! <b>Returns</b>: The const_iterator to the element before i in the list.
- //! Returns the end-const_iterator, if either i is the begin-const_iterator or
- //! the list is empty.
- //!
+ //! <b>Returns</b>: The const_iterator to the element before i in the list.
+ //! Returns the end-const_iterator, if either i is the begin-const_iterator or
+ //! the list is empty.
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Linear to the number of elements before i.
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements before i.
//! Constant if cache_last<> is true and i == end().
const_iterator previous(const_iterator i) const
{ return this->previous(this->cbefore_begin(), i); }
//! <b>Returns</b>: The iterator to the element before i in the list,
//! starting the search on element after prev_from.
- //! Returns the end-iterator, if either i is the begin-iterator or the
- //! list is empty.
- //!
+ //! Returns the end-iterator, if either i is the begin-iterator or the
+ //! list is empty.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements before i.
//! Constant if cache_last<> is true and i == end().
iterator previous(const_iterator prev_from, iterator i)
@@ -1711,12 +1711,12 @@ class slist_impl
//! <b>Returns</b>: The const_iterator to the element before i in the list,
//! starting the search on element after prev_from.
- //! Returns the end-const_iterator, if either i is the begin-const_iterator or
- //! the list is empty.
- //!
+ //! Returns the end-const_iterator, if either i is the begin-const_iterator or
+ //! the list is empty.
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Linear to the number of elements before i.
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements before i.
//! Constant if cache_last<> is true and i == end().
const_iterator previous(const_iterator prev_from, const_iterator i) const
{
@@ -1730,17 +1730,17 @@ class slist_impl
//! <b>Requires</b>: prev_pos must be a dereferenceable iterator in *this or be
//! before_begin(), and before_first and before_last belong to x and
- //! ++before_first != x.end() && before_last != x.end().
- //!
+ //! ++before_first != x.end() && before_last != x.end().
+ //!
//! <b>Effects</b>: Transfers the range (before_first, before_last] to this
//! list, after the element pointed by prev_pos.
//! No destructors or copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements transferred
//! if constant_time_size is true. Constant-time otherwise.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void incorporate_after(const_iterator prev_from, const node_ptr & first, const node_ptr & before_last)
@@ -1756,14 +1756,14 @@ class slist_impl
//! before_begin(), and before_first and before_last belong to x and
//! ++before_first != x.end() && before_last != x.end() and
//! n == std::distance(first, before_last) + 1.
- //!
+ //!
//! <b>Effects</b>: Transfers the range (before_first, before_last] from list x to this
//! list, after the element pointed by p. No destructors or copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void incorporate_after(const_iterator prev_pos, const node_ptr & first, const node_ptr & before_last, difference_type n)
@@ -1837,7 +1837,7 @@ class slist_impl
void priv_shift_forward(size_type n, detail::bool_<false>)
{
- node_ptr last = node_algorithms::move_backwards(this->get_root_node(), (std::size_t)n);
+ node_ptr last = node_algorithms::move_backwards(this->get_root_node(), (std::size_t)n);
if(cache_last && last){
this->set_last_node(last);
}
@@ -1860,7 +1860,7 @@ class slist_impl
{
bool other_was_empty = false;
if(this_impl->empty()){
- //Check if both are empty or
+ //Check if both are empty or
if(other_impl->empty())
return;
//If this is empty swap pointers
@@ -2043,7 +2043,7 @@ struct make_slist
{
/// @cond
typedef typename pack_options
- < slist_defaults<T>,
+ < slist_defaults<T>,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4, O5
#else
@@ -2075,7 +2075,7 @@ template<class T, class O1, class O2, class O3, class O4, class O5>
template<class T, class ...Options>
#endif
class slist
- : public make_slist<T,
+ : public make_slist<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4, O5
#else
@@ -2084,7 +2084,7 @@ class slist
>::type
{
typedef typename make_slist
- <T,
+ <T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4, O5
#else
@@ -2126,8 +2126,8 @@ class slist
#endif
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/slist_hook.hpp b/boost/intrusive/slist_hook.hpp
index 1debe66c86..cd94a7e7aa 100644
--- a/boost/intrusive/slist_hook.hpp
+++ b/boost/intrusive/slist_hook.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -46,7 +46,7 @@ struct make_slist_base_hook
{
/// @cond
typedef typename pack_options
- < hook_defaults,
+ < hook_defaults,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3
#else
@@ -64,16 +64,16 @@ struct make_slist_base_hook
typedef implementation_defined type;
};
-//! 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
+//! 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
//! list and provides an appropriate value_traits class for list.
-//!
+//!
//! The hook admits the following options: \c tag<>, \c void_pointer<> and
//! \c link_mode<>.
//!
-//! \c tag<> defines a tag to identify the node.
-//! 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
+//! \c tag<> defines a tag to identify the node.
+//! 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
//! unique tag.
//!
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
@@ -99,27 +99,27 @@ class slist_base_hook
public:
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
slist_base_hook();
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
- //!
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
//! <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
//! move-semantics.
slist_base_hook(const slist_base_hook& );
//! <b>Effects</b>: Empty function. The argument is ignored.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Rationale</b>: Providing an assignment operator
- //! makes classes using the hook STL-compliant without forcing the
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Rationale</b>: Providing an assignment operator
+ //! makes classes using the hook STL-compliant without forcing the
//! user to do some additional work. \c swap can be used to emulate
//! move-semantics.
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
//! 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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
~slist_base_hook();
- //! <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
- //! 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
- //! 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
- //! after the swap-operation the other element is not in a container.
- //! Iterators to e1 and e2 related to those nodes are invalidated.
+ //! <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
+ //! 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
+ //! 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
+ //! after the swap-operation the other element is not in a container.
+ //! 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);
//! <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
- //! otherwise. This function can be used to test whether \c slist::iterator_to
- //! will return a valid iterator.
+ //! otherwise. This function can be used to test whether \c slist::iterator_to
+ //! will return a valid iterator.
//!
- //! <b>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
bool is_linked() const;
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
void unlink();
#endif
};
@@ -174,7 +174,7 @@ struct make_slist_member_hook
{
/// @cond
typedef typename pack_options
- < hook_defaults,
+ < hook_defaults,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3
#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
-//! 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.
-//!
+//!
//! The hook admits the following options: \c void_pointer<> and
//! \c link_mode<>.
-//!
+//!
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
//! \c auto_unlink or \c safe_link).
//!
@@ -222,27 +222,27 @@ class slist_member_hook
public:
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
slist_member_hook();
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
- //!
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
//! <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
//! move-semantics.
slist_member_hook(const slist_member_hook& );
//! <b>Effects</b>: Empty function. The argument is ignored.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Rationale</b>: Providing an assignment operator
- //! makes classes using the hook STL-compliant without forcing the
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Rationale</b>: Providing an assignment operator
+ //! makes classes using the hook STL-compliant without forcing the
//! user to do some additional work. \c swap can be used to emulate
//! move-semantics.
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
//! 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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
~slist_member_hook();
- //! <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
- //! 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
- //! 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
- //! after the swap-operation the other element is not in a container.
- //! Iterators to e1 and e2 related to those nodes are invalidated.
+ //! <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
+ //! 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
+ //! 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
+ //! after the swap-operation the other element is not in a container.
+ //! 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);
//! <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
- //! otherwise. This function can be used to test whether \c slist::iterator_to
- //! will return a valid iterator.
+ //! otherwise. This function can be used to test whether \c slist::iterator_to
+ //! will return a valid iterator.
//!
- //! <b>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
bool is_linked() const;
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
void unlink();
#endif
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/splay_set.hpp b/boost/intrusive/splay_set.hpp
index 5a21a06af8..e7f3b9470b 100644
--- a/boost/intrusive/splay_set.hpp
+++ b/boost/intrusive/splay_set.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -22,9 +22,9 @@
namespace boost {
namespace intrusive {
-//! The class template splay_set is an intrusive container, that mimics most of
+//! The class template splay_set is an intrusive container, that mimics most of
//! the interface of std::set as described in the C++ standard.
-//!
+//!
//! The template parameter \c T is the type to be managed by the container.
//! The user can specify additional options and if no options are provided
//! default options are used.
@@ -79,30 +79,30 @@ class splay_set_impl
/// @endcond
public:
- //! <b>Effects</b>: Constructs an empty splay_set.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //! <b>Effects</b>: Constructs an empty splay_set.
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor of the value_compare object throws.
+ //! or the copy constructor of the value_compare object throws.
splay_set_impl( const value_compare &cmp = value_compare()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: tree_(cmp, v_traits)
{}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
//! cmp must be a comparison function that induces a strict weak ordering.
- //!
- //! <b>Effects</b>: Constructs an empty splay_set and inserts elements from
+ //!
+ //! <b>Effects</b>: Constructs an empty splay_set and inserts elements from
//! [b, e).
- //!
- //! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
+ //!
+ //! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
//! comp and otherwise amortized N * log N, where N is std::distance(last, first).
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor/operator() of the value_compare object throws.
+ //! or the copy constructor/operator() of the value_compare object throws.
template<class Iterator>
splay_set_impl( Iterator b, Iterator e
, const value_compare &cmp = value_compare()
@@ -111,135 +111,135 @@ class splay_set_impl
{}
//! <b>Effects</b>: to-do
- //!
- splay_set_impl(BOOST_RV_REF(splay_set_impl) x)
+ //!
+ splay_set_impl(BOOST_RV_REF(splay_set_impl) x)
: tree_(::boost::move(x.tree_))
{}
//! <b>Effects</b>: to-do
- //!
- splay_set_impl& operator=(BOOST_RV_REF(splay_set_impl) x)
+ //!
+ splay_set_impl& operator=(BOOST_RV_REF(splay_set_impl) x)
{ tree_ = ::boost::move(x.tree_); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the splay_set
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the splay_set
//! are not deleted (i.e. no destructors are called).
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- ~splay_set_impl()
+ ~splay_set_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the splay_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the splay_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the splay_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return tree_.cbegin(); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the splay_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the splay_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the splay_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return tree_.cend(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
//! reversed splay_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rbegin()
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed splay_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rbegin() const
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed splay_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crbegin() const
{ return tree_.crbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed splay_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rend()
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed splay_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rend() const
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed splay_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crend() const
{ return tree_.crend(); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of splay_set.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the splay_set associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static splay_set_impl &container_from_end_iterator(iterator end_iterator)
{
@@ -250,11 +250,11 @@ class splay_set_impl
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of splay_set.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the splay_set associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const splay_set_impl &container_from_end_iterator(const_iterator end_iterator)
{
@@ -264,11 +264,11 @@ class splay_set_impl
}
//! <b>Precondition</b>: it must be a valid iterator of set.
- //!
+ //!
//! <b>Effects</b>: Returns a reference to the set associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static splay_set_impl &container_from_iterator(iterator it)
{
@@ -278,11 +278,11 @@ class splay_set_impl
}
//! <b>Precondition</b>: it must be a valid const_iterator of set.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the set associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static const splay_set_impl &container_from_iterator(const_iterator it)
{
@@ -292,42 +292,42 @@ class splay_set_impl
}
//! <b>Effects</b>: Returns the key_compare object used by the splay_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If key_compare copy-constructor throws.
key_compare key_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns the value_compare object used by the splay_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If value_compare copy-constructor throws.
value_compare value_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns true if the container is empty.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return tree_.empty(); }
//! <b>Effects</b>: Returns the number of elements stored in the splay_set.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this if,
//! constant-time size option is enabled. Constant-time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{ return tree_.size(); }
//! <b>Effects</b>: Swaps the contents of two splay_sets.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the swap() call for the comparison functor
//! found using ADL throws. Strong guarantee.
void swap(splay_set_impl& other)
@@ -337,22 +337,22 @@ class splay_set_impl
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const splay_set_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Tries to inserts value into the splay_set.
//!
//! <b>Returns</b>: If the value
@@ -360,38 +360,38 @@ class splay_set_impl
//! iterator to the new value and true. If there is an equivalent value
//! returns a pair containing an iterator to the already present value
//! and false.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
std::pair<iterator, bool> insert(reference value)
{ return tree_.insert_unique(value); }
//! <b>Requires</b>: value must be an lvalue
- //!
- //! <b>Effects</b>: Tries to to insert x into the splay_set, using "hint"
+ //!
+ //! <b>Effects</b>: Tries to to insert x into the splay_set, using "hint"
//! as a hint to where it will be inserted.
//!
- //! <b>Returns</b>: An iterator that points to the position where the
+ //! <b>Returns</b>: An iterator that points to the position where the
//! new element was inserted into the splay_set.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic in general, but it's amortized
//! constant time if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert(const_iterator hint, reference value)
{ return tree_.insert_unique(hint, value); }
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare. The difference is that
//! key_value_comp compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the splay_set, using
//! a user provided key instead of the value itself.
//!
@@ -400,16 +400,16 @@ class splay_set_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
//!
//! <b>Throws</b>: If the key_value_comp ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! node that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that
+ //! than the value_type and this function offers the possibility to use that
//! part to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
@@ -423,12 +423,12 @@ class splay_set_impl
(const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data)
{ return tree_.insert_unique_check(key, key_value_comp, commit_data); }
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare. The difference is that
//! key_value_comp compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the splay_set, using
- //! a user provided key instead of the value itself, using "hint"
+ //! a user provided key instead of the value itself, using "hint"
//! as a hint to where it will be inserted.
//!
//! <b>Returns</b>: If there is an equivalent value
@@ -436,23 +436,23 @@ class splay_set_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic in general, but it's amortized
//! constant time if t is inserted immediately before hint.
//!
//! <b>Throws</b>: If the key_value_comp ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! constructing that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that key
+ //! than the value_type and this function offers the possibility to use that key
//! to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
//! "insert_commit" to insert the object in constant-time. This can give a total
//! constant-time complexity to the insertion: check(O(1)) + commit(O(1)).
- //!
+ //!
//! "commit_data" remains valid for a subsequent "insert_commit" only if no more
//! objects are inserted or erased from the splay_set.
template<class KeyType, class KeyValueCompare>
@@ -465,74 +465,74 @@ class splay_set_impl
//! must have been obtained from a previous call to "insert_check".
//! No objects should have been inserted or erased from the splay_set between
//! the "insert_check" that filled "commit_data" and the call to "insert_commit".
- //!
+ //!
//! <b>Effects</b>: Inserts the value in the splay_set using the information obtained
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Returns</b>: An iterator to the newly inserted object.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function has only sense if a "insert_check" has been
//! previously executed to fill "commit_data". No value should be inserted or
//! erased between the "insert_check" and "insert_commit" calls.
iterator insert_commit(reference value, const insert_commit_data &commit_data)
{ return tree_.insert_unique_commit(value, commit_data); }
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Inserts a range into the splay_set.
- //!
+ //!
//! <b>Complexity</b>: Insert range is amortized O(N * log(N)), where N is the
//! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
void insert(Iterator b, Iterator e)
{ tree_.insert_unique(b, e); }
- //! <b>Effects</b>: Erases the element pointed to by pos.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by pos.
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Returns</b>: An iterator to the element after the erased element.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator i)
{ return tree_.erase(i); }
- //! <b>Effects</b>: Erases the range pointed to by b end e.
- //!
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //!
//! <b>Complexity</b>: Average complexity for erase range is amortized
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Returns</b>: An iterator to the element after the erased elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator b, const_iterator e)
{ return tree_.erase(b, e); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Amortized O(log(size()) + this->count(value)).
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
@@ -540,13 +540,13 @@ class splay_set_impl
//! <b>Effects</b>: Erases all the elements that compare equal with
//! the given key and the given comparison functor.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Amortized O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If the comp ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyValueCompare>
@@ -559,16 +559,16 @@ class splay_set_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Erases the element pointed to by pos.
+ //! <b>Effects</b>: Erases the element pointed to by pos.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Returns</b>: An iterator to the element after the erased element.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
@@ -584,14 +584,14 @@ class splay_set_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Returns</b>: An iterator to the element after the erased elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -602,13 +602,13 @@ class splay_set_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
- //!
+ //!
//! <b>Complexity</b>: Amortized O(log(size() + this->count(value)). Basic guarantee.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -622,11 +622,11 @@ class splay_set_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Amortized O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyValueCompare, class Disposer>
@@ -638,26 +638,26 @@ class splay_set_impl
{ return tree_.erase_and_dispose(key, comp, disposer); }
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
{ return tree_.clear(); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
- //!
+ //!
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -665,40 +665,40 @@ class splay_set_impl
{ return tree_.clear_and_dispose(disposer); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
size_type count(const_reference value)
{ return tree_.find(value) != end(); }
//! <b>Effects</b>: Returns the number of contained elements with the same key
//! compared with the given comparison functor.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
template<class KeyType, class KeyValueCompare>
size_type count(const KeyType& key, KeyValueCompare comp)
{ return tree_.find(key, comp) != end(); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
size_type count_dont_splay(const_reference value)const
{ return tree_.find_dont_splay(value) != end(); }
//! <b>Effects</b>: Returns the number of contained elements with the same key
//! compared with the given comparison functor.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
template<class KeyType, class KeyValueCompare>
size_type count_dont_splay(const KeyType& key, KeyValueCompare comp)const
@@ -706,9 +706,9 @@ class splay_set_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator lower_bound(const_reference value)
{ return tree_.lower_bound(value); }
@@ -718,13 +718,13 @@ class splay_set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -734,9 +734,9 @@ class splay_set_impl
//! <b>Effects</b>: Returns a const iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator lower_bound_dont_splay(const_reference value) const
{ return tree_.lower_bound_dont_splay(value); }
@@ -746,13 +746,13 @@ class splay_set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -762,9 +762,9 @@ class splay_set_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator upper_bound(const_reference value)
{ return tree_.upper_bound(value); }
@@ -774,11 +774,11 @@ class splay_set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -790,9 +790,9 @@ class splay_set_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator upper_bound_dont_splay(const_reference value) const
{ return tree_.upper_bound_dont_splay(value); }
@@ -802,11 +802,11 @@ class splay_set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -816,11 +816,11 @@ class splay_set_impl
const_iterator upper_bound_dont_splay(const KeyType& key, KeyValueCompare comp) const
{ return tree_.upper_bound_dont_splay(key, comp); }
- //! <b>Effects</b>: Finds an iterator to the first element whose value is
+ //! <b>Effects</b>: Finds an iterator to the first element whose value is
//! "value" or end() if that element does not exist.
//!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator find(const_reference value)
{ return tree_.find(value); }
@@ -829,12 +829,12 @@ class splay_set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
//!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -844,11 +844,11 @@ class splay_set_impl
iterator find(const KeyType& key, KeyValueCompare comp)
{ return tree_.find(key, comp); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
//! "value" or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator find_dont_splay(const_reference value) const
{ return tree_.find_dont_splay(value); }
@@ -857,12 +857,12 @@ class splay_set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -875,9 +875,9 @@ class splay_set_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return tree_.equal_range(value); }
@@ -886,13 +886,13 @@ class splay_set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -905,9 +905,9 @@ class splay_set_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<const_iterator, const_iterator>
equal_range_dont_splay(const_reference value) const
@@ -917,13 +917,13 @@ class splay_set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -934,16 +934,102 @@ class splay_set_impl
equal_range_dont_splay(const KeyType& key, KeyValueCompare comp) const
{ return tree_.equal_range_dont_splay(key, comp); }
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator, const_iterator>
+ bounded_range_dont_splay_dont_splay
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range_dont_splay(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator, const_iterator>
+ bounded_range_dont_splay
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range_dont_splay(lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: value must be an lvalue and shall be in a splay_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the splay_set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
@@ -951,14 +1037,14 @@ class splay_set_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a splay_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! splay_set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static const_iterator s_iterator_to(const_reference value)
@@ -966,48 +1052,48 @@ class splay_set_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a splay_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the splay_set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator iterator_to(reference value)
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value must be an lvalue and shall be in a splay_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! splay_set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator iterator_to(const_reference value) const
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value shall not be in a splay_set/multisplay_set.
- //!
+ //!
//! <b>Effects</b>: init_node puts the hook of a value in a well-known default
//! state.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This function puts the hook in the well-known default state
//! used by auto_unlink and safe hooks.
static void init_node(reference value)
{ tree_type::init_node(value); }
//! <b>Effects</b>: Unlinks the leftmost node from the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! This function is normally used to achieve a step by step
@@ -1017,14 +1103,14 @@ class splay_set_impl
//! <b>Requires</b>: replace_this must be a valid iterator of *this
//! and with_this must not be inserted in any tree.
- //!
+ //!
//! <b>Effects</b>: Replaces replace_this in its position in the
//! tree with with_this. The tree does not need to be rebalanced.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! with_this is not equivalent to *replace_this according to the
//! ordering rules. This function is faster than erasing and inserting
@@ -1033,12 +1119,12 @@ class splay_set_impl
{ tree_.replace_node(replace_this, with_this); }
//! <b>Requires</b>: i must be a valid iterator of *this.
- //!
+ //!
//! <b>Effects</b>: Rearranges the splay set so that the element pointed by i
//! is placed as the root of the tree, improving future searches of this value.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
void splay_up(iterator i)
{ tree_.splay_up(i); }
@@ -1047,9 +1133,9 @@ class splay_set_impl
//! with a key equivalent to value the element is placed as the root of the
//! tree. If the element is not present returns the last node compared with the key.
//! If the tree is empty, end() is returned.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Returns</b>: An iterator to the new root of the tree, end() if the tree is empty.
//!
//! <b>Throws</b>: If the comparison functor throws.
@@ -1060,9 +1146,9 @@ class splay_set_impl
//! <b>Effects</b>: Rearranges the splay set so that if *this stores an element
//! with a key equivalent to value the element is placed as the root of the
//! tree.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Returns</b>: An iterator to the new root of the tree, end() if the tree is empty.
//!
//! <b>Throws</b>: If the predicate throws.
@@ -1070,21 +1156,21 @@ class splay_set_impl
{ return tree_.splay_down(value); }
//! <b>Effects</b>: Rebalances the tree.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear.
void rebalance()
{ tree_.rebalance(); }
//! <b>Requires</b>: old_root is a node of a tree.
- //!
+ //!
//! <b>Effects</b>: Rebalances the subtree rooted at old_root.
//!
//! <b>Returns</b>: The new root of the subtree.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements in the subtree.
iterator rebalance_subtree(iterator root)
{ return tree_.rebalance_subtree(root); }
@@ -1175,7 +1261,7 @@ struct make_splay_set
{
/// @cond
typedef splay_set_impl
- < typename make_splaytree_opt<T,
+ < typename make_splaytree_opt<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1194,7 +1280,7 @@ template<class T, class O1, class O2, class O3, class O4>
template<class T, class ...Options>
#endif
class splay_set
- : public make_splay_set<T,
+ : public make_splay_set<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1203,7 +1289,7 @@ class splay_set
>::type
{
typedef typename make_splay_set
- <T,
+ <T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1255,9 +1341,9 @@ class splay_set
#endif
-//! The class template splay_multiset is an intrusive container, that mimics most of
+//! The class template splay_multiset is an intrusive container, that mimics most of
//! the interface of std::multiset as described in the C++ standard.
-//!
+//!
//! The template parameter \c T is the type to be managed by the container.
//! The user can specify additional options and if no options are provided
//! default options are used.
@@ -1311,30 +1397,30 @@ class splay_multiset_impl
/// @endcond
public:
- //! <b>Effects</b>: Constructs an empty splay_multiset.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //! <b>Effects</b>: Constructs an empty splay_multiset.
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor/operator() of the value_compare object throws.
+ //! or the copy constructor/operator() of the value_compare object throws.
splay_multiset_impl( const value_compare &cmp = value_compare()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: tree_(cmp, v_traits)
{}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
//! cmp must be a comparison function that induces a strict weak ordering.
- //!
- //! <b>Effects</b>: Constructs an empty splay_multiset and inserts elements from
+ //!
+ //! <b>Effects</b>: Constructs an empty splay_multiset and inserts elements from
//! [b, e).
- //!
+ //!
//! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
//! comp and otherwise amortized N * log N, where N is the distance between first and last.
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor/operator() of the value_compare object throws.
+ //! or the copy constructor/operator() of the value_compare object throws.
template<class Iterator>
splay_multiset_impl( Iterator b, Iterator e
, const value_compare &cmp = value_compare()
@@ -1343,135 +1429,135 @@ class splay_multiset_impl
{}
//! <b>Effects</b>: to-do
- //!
- splay_multiset_impl(BOOST_RV_REF(splay_multiset_impl) x)
+ //!
+ splay_multiset_impl(BOOST_RV_REF(splay_multiset_impl) x)
: tree_(::boost::move(x.tree_))
{}
//! <b>Effects</b>: to-do
- //!
- splay_multiset_impl& operator=(BOOST_RV_REF(splay_multiset_impl) x)
+ //!
+ splay_multiset_impl& operator=(BOOST_RV_REF(splay_multiset_impl) x)
{ tree_ = ::boost::move(x.tree_); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the set
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the set
//! are not deleted (i.e. no destructors are called).
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- ~splay_multiset_impl()
+ ~splay_multiset_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the splay_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the splay_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the splay_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return tree_.cbegin(); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the splay_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the splay_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the splay_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return tree_.cend(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
//! reversed splay_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rbegin()
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed splay_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rbegin() const
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed splay_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crbegin() const
{ return tree_.crbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed splay_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rend()
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed splay_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rend() const
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed splay_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crend() const
{ return tree_.crend(); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of splay_multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the splay_multiset associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static splay_multiset_impl &container_from_end_iterator(iterator end_iterator)
{
@@ -1482,11 +1568,11 @@ class splay_multiset_impl
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of splay_multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the splay_multiset associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const splay_multiset_impl &container_from_end_iterator(const_iterator end_iterator)
{
@@ -1496,11 +1582,11 @@ class splay_multiset_impl
}
//! <b>Precondition</b>: it must be a valid iterator of multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the multiset associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static splay_multiset_impl &container_from_iterator(iterator it)
{
@@ -1510,11 +1596,11 @@ class splay_multiset_impl
}
//! <b>Precondition</b>: it must be a valid const_iterator of multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the multiset associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const splay_multiset_impl &container_from_iterator(const_iterator it)
{
@@ -1524,42 +1610,42 @@ class splay_multiset_impl
}
//! <b>Effects</b>: Returns the key_compare object used by the splay_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If key_compare copy-constructor throws.
key_compare key_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns the value_compare object used by the splay_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If value_compare copy-constructor throws.
value_compare value_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns true if the container is empty.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return tree_.empty(); }
//! <b>Effects</b>: Returns the number of elements stored in the splay_multiset.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this if,
//! constant-time size option is enabled. Constant-time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{ return tree_.size(); }
//! <b>Effects</b>: Swaps the contents of two splay_multisets.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the swap() call for the comparison functor
//! found using ADL throws. Strong guarantee.
void swap(splay_multiset_impl& other)
@@ -1569,109 +1655,109 @@ class splay_multiset_impl
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const splay_multiset_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts value into the splay_multiset.
- //!
+ //!
//! <b>Returns</b>: An iterator that points to the position where the new
//! element was inserted.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert(reference value)
{ return tree_.insert_equal(this->end(), value); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts x into the splay_multiset, using pos as a hint to
//! where it will be inserted.
- //!
+ //!
//! <b>Returns</b>: An iterator that points to the position where the new
//! element was inserted.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic in general, but it is amortized
//! constant time if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert(const_iterator hint, reference value)
{ return tree_.insert_equal(hint, value); }
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Inserts a range into the splay_multiset.
- //!
+ //!
//! <b>Returns</b>: An iterator that points to the position where the new
//! element was inserted.
- //!
+ //!
//! <b>Complexity</b>: Insert range is amortized O(N * log(N)), where N is the
//! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
void insert(Iterator b, Iterator e)
{ tree_.insert_equal(b, e); }
- //! <b>Effects</b>: Erases the element pointed to by pos.
- //!
- //! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by pos.
+ //!
+ //! <b>Complexity</b>: Average complexity is constant time.
+ //!
//! <b>Returns</b>: An iterator to the element after the erased element.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator i)
{ return tree_.erase(i); }
- //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
//!
//! <b>Returns</b>: An iterator to the element after the erased elements.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for erase range is amortized
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator b, const_iterator e)
{ return tree_.erase(b, e); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Amortized O(log(size() + this->count(value)).
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
@@ -1679,13 +1765,13 @@ class splay_multiset_impl
//! <b>Effects</b>: Erases all the elements that compare equal with
//! the given key and the given comparison functor.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Amortized O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyValueCompare>
@@ -1700,14 +1786,14 @@ class splay_multiset_impl
//!
//! <b>Returns</b>: An iterator to the element after the erased element.
//!
- //! <b>Effects</b>: Erases the element pointed to by pos.
+ //! <b>Effects</b>: Erases the element pointed to by pos.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
@@ -1725,12 +1811,12 @@ class splay_multiset_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for erase range is amortized
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -1741,13 +1827,13 @@ class splay_multiset_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Amortized O(log(size() + this->count(value)).
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -1761,11 +1847,11 @@ class splay_multiset_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Amortized O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyValueCompare, class Disposer>
@@ -1777,26 +1863,26 @@ class splay_multiset_impl
{ return tree_.erase_and_dispose(key, comp, disposer); }
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
{ return tree_.clear(); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
- //!
+ //!
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -1804,40 +1890,40 @@ class splay_multiset_impl
{ return tree_.clear_and_dispose(disposer); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
size_type count(const_reference value)
{ return tree_.count(value); }
//! <b>Effects</b>: Returns the number of contained elements with the same key
//! compared with the given comparison functor.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
template<class KeyType, class KeyValueCompare>
size_type count(const KeyType& key, KeyValueCompare comp)
{ return tree_.count(key, comp); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
size_type count_dont_splay(const_reference value) const
{ return tree_.count_dont_splay(value); }
//! <b>Effects</b>: Returns the number of contained elements with the same key
//! compared with the given comparison functor.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
template<class KeyType, class KeyValueCompare>
size_type count_dont_splay(const KeyType& key, KeyValueCompare comp) const
@@ -1845,9 +1931,9 @@ class splay_multiset_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator lower_bound(const_reference value)
{ return tree_.lower_bound(value); }
@@ -1857,13 +1943,13 @@ class splay_multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -1873,9 +1959,9 @@ class splay_multiset_impl
//! <b>Effects</b>: Returns a const iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator lower_bound_dont_splay(const_reference value) const
{ return tree_.lower_bound_dont_splay(value); }
@@ -1885,13 +1971,13 @@ class splay_multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -1901,9 +1987,9 @@ class splay_multiset_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator upper_bound(const_reference value)
{ return tree_.upper_bound(value); }
@@ -1913,11 +1999,11 @@ class splay_multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1929,9 +2015,9 @@ class splay_multiset_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator upper_bound_dont_splay(const_reference value) const
{ return tree_.upper_bound_dont_splay(value); }
@@ -1941,11 +2027,11 @@ class splay_multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1955,11 +2041,11 @@ class splay_multiset_impl
const_iterator upper_bound_dont_splay(const KeyType& key, KeyValueCompare comp) const
{ return tree_.upper_bound_dont_splay(key, comp); }
- //! <b>Effects</b>: Finds an iterator to the first element whose value is
+ //! <b>Effects</b>: Finds an iterator to the first element whose value is
//! "value" or end() if that element does not exist.
//!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator find(const_reference value)
{ return tree_.find(value); }
@@ -1968,12 +2054,12 @@ class splay_multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
//!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1983,11 +2069,11 @@ class splay_multiset_impl
iterator find(const KeyType& key, KeyValueCompare comp)
{ return tree_.find(key, comp); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
//! "value" or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator find_dont_splay(const_reference value) const
{ return tree_.find_dont_splay(value); }
@@ -1996,12 +2082,12 @@ class splay_multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2014,9 +2100,9 @@ class splay_multiset_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return tree_.equal_range(value); }
@@ -2025,13 +2111,13 @@ class splay_multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2044,9 +2130,9 @@ class splay_multiset_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<const_iterator, const_iterator>
equal_range_dont_splay(const_reference value) const
@@ -2056,13 +2142,13 @@ class splay_multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2073,16 +2159,102 @@ class splay_multiset_impl
equal_range_dont_splay(const KeyType& key, KeyValueCompare comp) const
{ return tree_.equal_range_dont_splay(key, comp); }
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator, const_iterator>
+ bounded_range_dont_splay
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range_dont_splay(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator, const_iterator>
+ bounded_range_dont_splay
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range_dont_splay(lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
@@ -2090,14 +2262,14 @@ class splay_multiset_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static const_iterator s_iterator_to(const_reference value)
@@ -2105,48 +2277,48 @@ class splay_multiset_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator iterator_to(reference value)
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator iterator_to(const_reference value) const
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value shall not be in a set/splay_multiset.
- //!
+ //!
//! <b>Effects</b>: init_node puts the hook of a value in a well-known default
//! state.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This function puts the hook in the well-known default state
//! used by auto_unlink and safe hooks.
static void init_node(reference value)
{ tree_type::init_node(value); }
//! <b>Effects</b>: Unlinks the leftmost node from the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! This function is normally used to achieve a step by step
@@ -2156,14 +2328,14 @@ class splay_multiset_impl
//! <b>Requires</b>: replace_this must be a valid iterator of *this
//! and with_this must not be inserted in any tree.
- //!
+ //!
//! <b>Effects</b>: Replaces replace_this in its position in the
//! tree with with_this. The tree does not need to be rebalanced.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! with_this is not equivalent to *replace_this according to the
//! ordering rules. This function is faster than erasing and inserting
@@ -2172,12 +2344,12 @@ class splay_multiset_impl
{ tree_.replace_node(replace_this, with_this); }
//! <b>Requires</b>: i must be a valid iterator of *this.
- //!
+ //!
//! <b>Effects</b>: Rearranges the splay set so that the element pointed by i
//! is placed as the root of the tree, improving future searches of this value.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
void splay_up(iterator i)
{ tree_.splay_up(i); }
@@ -2186,9 +2358,9 @@ class splay_multiset_impl
//! with a key equivalent to value the element is placed as the root of the
//! tree. If the element is not present returns the last node compared with the key.
//! If the tree is empty, end() is returned.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Returns</b>: An iterator to the new root of the tree, end() if the tree is empty.
//!
//! <b>Throws</b>: If the comparison functor throws.
@@ -2199,9 +2371,9 @@ class splay_multiset_impl
//! <b>Effects</b>: Rearranges the splay set so that if *this stores an element
//! with a key equivalent to value the element is placed as the root of the
//! tree.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Returns</b>: An iterator to the new root of the tree, end() if the tree is empty.
//!
//! <b>Throws</b>: If the predicate throws.
@@ -2209,21 +2381,21 @@ class splay_multiset_impl
{ return tree_.splay_down(value); }
//! <b>Effects</b>: Rebalances the tree.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear.
void rebalance()
{ tree_.rebalance(); }
//! <b>Requires</b>: old_root is a node of a tree.
- //!
+ //!
//! <b>Effects</b>: Rebalances the subtree rooted at old_root.
//!
//! <b>Returns</b>: The new root of the subtree.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements in the subtree.
iterator rebalance_subtree(iterator root)
{ return tree_.rebalance_subtree(root); }
@@ -2314,7 +2486,7 @@ struct make_splay_multiset
{
/// @cond
typedef splay_multiset_impl
- < typename make_splaytree_opt<T,
+ < typename make_splaytree_opt<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -2334,7 +2506,7 @@ template<class T, class O1, class O2, class O3, class O4>
template<class T, class ...Options>
#endif
class splay_multiset
- : public make_splay_multiset<T,
+ : public make_splay_multiset<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -2343,7 +2515,7 @@ class splay_multiset
>::type
{
typedef typename make_splay_multiset
- <T,
+ <T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -2395,8 +2567,8 @@ class splay_multiset
#endif
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/splay_set_hook.hpp b/boost/intrusive/splay_set_hook.hpp
index d42f4c8bee..c8698c65b0 100644
--- a/boost/intrusive/splay_set_hook.hpp
+++ b/boost/intrusive/splay_set_hook.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -43,7 +43,7 @@ struct make_splay_set_base_hook
{
/// @cond
typedef typename pack_options
- < hook_defaults,
+ < hook_defaults,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3
#else
@@ -61,16 +61,16 @@ struct make_splay_set_base_hook
typedef implementation_defined type;
};
-//! 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
+//! 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
//! 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<>,
//! \c link_mode<> and \c optimize_size<>.
//!
-//! \c tag<> defines a tag to identify the node.
-//! 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
+//! \c tag<> defines a tag to identify the node.
+//! 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
//! unique tag.
//!
//! \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:
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
splay_set_base_hook();
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
- //!
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
//! <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
//! move-semantics.
splay_set_base_hook(const splay_set_base_hook& );
//! <b>Effects</b>: Empty function. The argument is ignored.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Rationale</b>: Providing an assignment operator
- //! makes classes using the hook STL-compliant without forcing the
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Rationale</b>: Providing an assignment operator
+ //! makes classes using the hook STL-compliant without forcing the
//! user to do some additional work. \c swap can be used to emulate
//! move-semantics.
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
//! 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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
~splay_set_base_hook();
- //! <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
- //! 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
- //! 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
- //! after the swap-operation the other element is not in a container.
- //! Iterators to e1 and e2 related to those nodes are invalidated.
+ //! <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
+ //! 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
+ //! 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
+ //! after the swap-operation the other element is not in a container.
+ //! 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);
//! <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
- //! otherwise. This function can be used to test whether \c set::iterator_to
- //! will return a valid iterator.
+ //! otherwise. This function can be used to test whether \c set::iterator_to
+ //! will return a valid iterator.
//!
- //! <b>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
bool is_linked() const;
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
void unlink();
#endif
};
@@ -171,7 +171,7 @@ struct make_splay_set_member_hook
{
/// @cond
typedef typename pack_options
- < hook_defaults,
+ < hook_defaults,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3
#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
//! necessary for maintaining the splay_set/splay_multiset and provides an appropriate
//! value_traits class for splay_set/splay_multiset.
-//!
+//!
//! The hook admits the following options: \c void_pointer<>,
//! \c link_mode<> and \c optimize_size<>.
//!
@@ -220,27 +220,27 @@ class splay_set_member_hook
public:
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
splay_set_member_hook();
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
- //!
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
//! <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
//! move-semantics.
splay_set_member_hook(const splay_set_member_hook& );
//! <b>Effects</b>: Empty function. The argument is ignored.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Rationale</b>: Providing an assignment operator
- //! makes classes using the hook STL-compliant without forcing the
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Rationale</b>: Providing an assignment operator
+ //! makes classes using the hook STL-compliant without forcing the
//! user to do some additional work. \c swap can be used to emulate
//! move-semantics.
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
//! 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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
~splay_set_member_hook();
- //! <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
- //! 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
- //! 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
- //! after the swap-operation the other element is not in a container.
- //! Iterators to e1 and e2 related to those nodes are invalidated.
+ //! <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
+ //! 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
+ //! 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
+ //! after the swap-operation the other element is not in a container.
+ //! 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);
//! <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
- //! otherwise. This function can be used to test whether \c set::iterator_to
- //! will return a valid iterator.
+ //! otherwise. This function can be used to test whether \c set::iterator_to
+ //! will return a valid iterator.
//!
- //! <b>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
bool is_linked() const;
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
void unlink();
#endif
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/splaytree.hpp b/boost/intrusive/splaytree.hpp
index 01b28d0a77..a1c5209dc1 100644
--- a/boost/intrusive/splaytree.hpp
+++ b/boost/intrusive/splaytree.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -63,8 +63,8 @@ struct splay_set_defaults
/// @endcond
//! The class template splaytree is an intrusive splay tree container that
-//! is used to construct intrusive splay_set and splay_multiset containers. The no-throw
-//! guarantee holds only, if the value_compare object
+//! is used to construct intrusive splay_set and splay_multiset containers. The no-throw
+//! guarantee holds only, if the value_compare object
//! doesn't throw.
//!
//! The template parameter \c T is the type to be managed by the container.
@@ -129,7 +129,7 @@ class splaytree_impl
//noncopyable
BOOST_MOVABLE_BUT_NOT_COPYABLE(splaytree_impl)
- enum { safemode_or_autounlink =
+ enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
(int)real_value_traits::link_mode == (int)safe_link };
@@ -155,7 +155,7 @@ class splaytree_impl
{}
node_plus_pred_t node_plus_pred_;
} data_;
-
+
const value_compare &priv_comp() const
{ return data_.node_plus_pred_.get(); }
@@ -207,18 +207,18 @@ class splaytree_impl
typedef typename node_algorithms::insert_commit_data insert_commit_data;
- //! <b>Effects</b>: Constructs an empty tree.
- //!
+ //! <b>Effects</b>: Constructs an empty tree.
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or the copy constructorof the value_compare object throws. Basic guarantee.
splaytree_impl( const value_compare &cmp = value_compare()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: data_(cmp, v_traits)
- {
- node_algorithms::init_header(this->priv_header_ptr());
+ {
+ node_algorithms::init_header(this->priv_header_ptr());
this->priv_size_traits().set_size(size_type(0));
}
@@ -230,7 +230,7 @@ class splaytree_impl
//!
//! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
//! comp and otherwise amortized N * log N, where N is the distance between first and last.
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or the copy constructor/operator() of the value_compare object throws. Basic guarantee.
@@ -249,59 +249,59 @@ class splaytree_impl
}
//! <b>Effects</b>: to-do
- //!
+ //!
splaytree_impl(BOOST_RV_REF(splaytree_impl) x)
: data_(::boost::move(x.priv_comp()), ::boost::move(x.priv_value_traits()))
{
- node_algorithms::init_header(this->priv_header_ptr());
+ node_algorithms::init_header(this->priv_header_ptr());
this->priv_size_traits().set_size(size_type(0));
this->swap(x);
}
//! <b>Effects</b>: to-do
- //!
- splaytree_impl& operator=(BOOST_RV_REF(splaytree_impl) x)
+ //!
+ splaytree_impl& operator=(BOOST_RV_REF(splaytree_impl) x)
{ this->swap(x); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the set
- //! are not deleted (i.e. no destructors are called), but the nodes according to
- //! the value_traits template parameter are reinitialized and thus can be reused.
- //!
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the set
+ //! are not deleted (i.e. no destructors are called), but the nodes according to
+ //! the value_traits template parameter are reinitialized and thus can be reused.
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- ~splaytree_impl()
+ ~splaytree_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return iterator(node_algorithms::begin_node(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return cbegin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return const_iterator(node_algorithms::begin_node(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return iterator (this->priv_header_ptr(), this); }
@@ -309,138 +309,138 @@ class splaytree_impl
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the tree.
//!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return cend(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return const_iterator (uncast(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
//! reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rbegin()
{ return reverse_iterator(end()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rbegin() const
{ return const_reverse_iterator(end()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crbegin() const
{ return const_reverse_iterator(end()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rend()
{ return reverse_iterator(begin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rend() const
{ return const_reverse_iterator(begin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crend() const
{ return const_reverse_iterator(begin()); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of splaytree.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the splaytree associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static splaytree_impl &container_from_end_iterator(iterator end_iterator)
{ return priv_container_from_end_iterator(end_iterator); }
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of splaytree.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the splaytree associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const splaytree_impl &container_from_end_iterator(const_iterator end_iterator)
{ return priv_container_from_end_iterator(end_iterator); }
//! <b>Precondition</b>: it must be a valid iterator
//! of rbtree.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the tree associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static splaytree_impl &container_from_iterator(iterator it)
{ return priv_container_from_iterator(it); }
//! <b>Precondition</b>: it must be a valid end const_iterator
//! of rbtree.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the tree associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static const splaytree_impl &container_from_iterator(const_iterator it)
{ return priv_container_from_iterator(it); }
//! <b>Effects</b>: Returns the value_compare object used by the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If value_compare copy-constructor throws.
value_compare value_comp() const
{ return priv_comp(); }
//! <b>Effects</b>: Returns true if the container is empty.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return this->cbegin() == this->cend(); }
//! <b>Effects</b>: Returns the number of elements stored in the tree.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this
//! if constant-time size option is disabled. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{
@@ -453,9 +453,9 @@ class splaytree_impl
}
//! <b>Effects</b>: Swaps the contents of two splaytrees.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the comparison functor's swap call throws.
void swap(splaytree_impl& other)
{
@@ -472,14 +472,14 @@ class splaytree_impl
}
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts value into the tree before the lower bound.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is amortized
//! logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert_equal(reference value)
@@ -497,16 +497,16 @@ class splaytree_impl
//! <b>Requires</b>: value must be an lvalue, and "hint" must be
//! a valid iterator.
- //!
+ //!
//! <b>Effects</b>: Inserts x into the tree, using "hint" as a hint to
//! where it will be inserted. If "hint" is the upper_bound
//! the insertion takes constant time (two comparisons in the worst case)
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic in general, but it is amortized
//! constant time if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert_equal(const_iterator hint, reference value)
@@ -522,18 +522,18 @@ class splaytree_impl
return ret;
}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Inserts a each element of a range into the tree
//! before the upper bound of the key of each element.
- //!
+ //!
//! <b>Complexity</b>: Insert range is in general amortized O(N * log(N)), where N is the
//! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -547,14 +547,14 @@ class splaytree_impl
}
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts value into the tree if the value
//! is not already present.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
std::pair<iterator, bool> insert_unique(reference value)
@@ -568,16 +568,16 @@ class splaytree_impl
//! <b>Requires</b>: value must be an lvalue, and "hint" must be
//! a valid iterator
- //!
+ //!
//! <b>Effects</b>: Tries to insert x into the tree, using "hint" as a hint
//! to where it will be inserted.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic in general, but it is amortized
//! constant time (two comparisons in the worst case)
//! if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert_unique(const_iterator hint, reference value)
@@ -589,17 +589,17 @@ class splaytree_impl
return insert_unique_commit(value, commit_data);
}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Tries to insert each element of a range into the tree.
- //!
- //! <b>Complexity</b>: Insert range is in general amortized O(N * log(N)), where N is the
- //! size of the range. However, it is linear in N if the range is already sorted
+ //!
+ //! <b>Complexity</b>: Insert range is in general amortized O(N * log(N)), where N is the
+ //! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -609,10 +609,10 @@ class splaytree_impl
this->insert_unique(*b);
}
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare. The difference is that
//! key_value_comp compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the container, using
//! a user provided key instead of the value itself.
//!
@@ -621,16 +621,16 @@ class splaytree_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic.
//!
//! <b>Throws</b>: If the key_value_comp ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! node that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that
+ //! than the value_type and this function offers the possibility to use that
//! part to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
@@ -645,18 +645,18 @@ class splaytree_impl
{
detail::key_nodeptr_comp<KeyValueCompare, splaytree_impl>
comp(key_value_comp, this);
- std::pair<node_ptr, bool> ret =
+ std::pair<node_ptr, bool> ret =
(node_algorithms::insert_unique_check
(this->priv_header_ptr(), key, comp, commit_data));
return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
}
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare. The difference is that
//! key_value_comp compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the container, using
- //! a user provided key instead of the value itself, using "hint"
+ //! a user provided key instead of the value itself, using "hint"
//! as a hint to where it will be inserted.
//!
//! <b>Returns</b>: If there is an equivalent value
@@ -664,23 +664,23 @@ class splaytree_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it's amortized
//! constant time if t is inserted immediately before hint.
//!
//! <b>Throws</b>: If the key_value_comp ordering function throws. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! constructing that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that key
+ //! than the value_type and this function offers the possibility to use that key
//! to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
//! "insert_commit" to insert the object in constant-time. This can give a total
//! constant-time complexity to the insertion: check(O(1)) + commit(O(1)).
- //!
+ //!
//! "commit_data" remains valid for a subsequent "insert_commit" only if no more
//! objects are inserted or erased from the container.
template<class KeyType, class KeyValueCompare>
@@ -690,7 +690,7 @@ class splaytree_impl
{
detail::key_nodeptr_comp<KeyValueCompare, splaytree_impl>
comp(key_value_comp, this);
- std::pair<node_ptr, bool> ret =
+ std::pair<node_ptr, bool> ret =
node_algorithms::insert_unique_check
(this->priv_header_ptr(), hint.pointed_node(), key, comp, commit_data);
return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
@@ -700,16 +700,16 @@ class splaytree_impl
//! must have been obtained from a previous call to "insert_check".
//! No objects should have been inserted or erased from the container between
//! the "insert_check" that filled "commit_data" and the call to "insert_commit".
- //!
+ //!
//! <b>Effects</b>: Inserts the value in the avl_set using the information obtained
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Returns</b>: An iterator to the newly inserted object.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function has only sense if a "insert_check" has been
//! previously executed to fill "commit_data". No value should be inserted or
//! erased between the "insert_check" and "insert_commit" calls.
@@ -724,12 +724,12 @@ class splaytree_impl
return iterator(to_insert, this);
}
- //! <b>Effects</b>: Erases the element pointed to by pos.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by pos.
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator i)
@@ -746,26 +746,26 @@ class splaytree_impl
return ret.unconst();
}
- //! <b>Effects</b>: Erases the range pointed to by b end e.
- //!
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //!
//! <b>Complexity</b>: Average complexity for erase range is amortized
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator b, const_iterator e)
{ size_type n; return private_erase(b, e, n); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Amortized O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
@@ -775,11 +775,11 @@ class splaytree_impl
//! according to the comparison functor "comp".
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Amortized O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyValueCompare>
@@ -797,14 +797,14 @@ class splaytree_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Erases the element pointed to by pos.
+ //! <b>Effects</b>: Erases the element pointed to by pos.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
@@ -825,12 +825,12 @@ class splaytree_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for erase range is amortized
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -841,13 +841,13 @@ class splaytree_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Amortized O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -866,11 +866,11 @@ class splaytree_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Amortized O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyValueCompare, class Disposer>
@@ -886,13 +886,13 @@ class splaytree_impl
return n;
}
- //! <b>Effects</b>: Erases all of the elements.
- //!
+ //! <b>Effects</b>: Erases all of the elements.
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
@@ -910,9 +910,9 @@ class splaytree_impl
//! each node to be erased.
//! <b>Complexity</b>: Amortized O(log(size() + N)),
//! where N is the number of elements in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. Calls N times to disposer functor.
template<class Disposer>
@@ -924,19 +924,19 @@ class splaytree_impl
}
//! <b>Effects</b>: Returns the number of contained elements with the given value
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic to the number of elements contained plus lineal
//! to number of objects with the given value.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type count(const_reference value)
{ return this->count(value, priv_comp()); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
size_type count(const KeyType &key, KeyValueCompare comp)
@@ -946,19 +946,19 @@ class splaytree_impl
}
//! <b>Effects</b>: Returns the number of contained elements with the given value
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic to the number of elements contained plus lineal
//! to number of objects with the given value.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type count_dont_splay(const_reference value) const
{ return this->count_dont_splay(value, priv_comp()); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
size_type count_dont_splay(const KeyType &key, KeyValueCompare comp) const
@@ -969,27 +969,27 @@ class splaytree_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator lower_bound(const_reference value)
{ return this->lower_bound(value, priv_comp()); }
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator lower_bound_dont_splay(const_reference value) const
{ return this->lower_bound_dont_splay(value, priv_comp()); }
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
iterator lower_bound(const KeyType &key, KeyValueCompare comp)
@@ -1002,9 +1002,9 @@ class splaytree_impl
//! <b>Effects</b>: Returns a const iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
const_iterator lower_bound_dont_splay(const KeyType &key, KeyValueCompare comp) const
@@ -1017,9 +1017,9 @@ class splaytree_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator upper_bound(const_reference value)
{ return this->upper_bound(value, priv_comp()); }
@@ -1029,7 +1029,7 @@ class splaytree_impl
//! does not exist.
//!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
iterator upper_bound(const KeyType &key, KeyValueCompare comp)
@@ -1042,9 +1042,9 @@ class splaytree_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator upper_bound_dont_splay(const_reference value) const
{ return this->upper_bound_dont_splay(value, priv_comp()); }
@@ -1054,7 +1054,7 @@ class splaytree_impl
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
const_iterator upper_bound_dont_splay(const KeyType &key, KeyValueCompare comp) const
@@ -1065,20 +1065,20 @@ class splaytree_impl
(this->priv_header_ptr(), key, key_node_comp, false), this);
}
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
//! k or end() if that element does not exist.
//!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator find(const_reference value)
{ return this->find(value, priv_comp()); }
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
//! k or end() if that element does not exist.
//!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
iterator find(const KeyType &key, KeyValueCompare comp)
@@ -1089,20 +1089,20 @@ class splaytree_impl
(node_algorithms::find(this->priv_header_ptr(), key, key_node_comp), this);
}
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
//! k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator find_dont_splay(const_reference value) const
{ return this->find_dont_splay(value, priv_comp()); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
//! k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
const_iterator find_dont_splay(const KeyType &key, KeyValueCompare comp) const
@@ -1116,9 +1116,9 @@ class splaytree_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return this->equal_range(value, priv_comp()); }
@@ -1126,9 +1126,9 @@ class splaytree_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
std::pair<iterator,iterator> equal_range(const KeyType &key, KeyValueCompare comp)
@@ -1143,9 +1143,9 @@ class splaytree_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
std::pair<const_iterator, const_iterator>
equal_range_dont_splay(const_reference value) const
@@ -1154,9 +1154,9 @@ class splaytree_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
std::pair<const_iterator, const_iterator>
@@ -1169,19 +1169,117 @@ class splaytree_impl
return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
}
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ {
+ detail::key_nodeptr_comp<KeyValueCompare, splaytree_impl>
+ key_node_comp(comp, this);
+ std::pair<node_ptr, node_ptr> ret
+ (node_algorithms::bounded_range
+ (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed));
+ return std::pair<iterator, iterator>(iterator(ret.first, this), iterator(ret.second, this));
+ }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator,const_iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return this->bounded_range_dont_splay(lower_value, upper_value, priv_comp(), left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator,const_iterator> bounded_range
+ (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ {
+ detail::key_nodeptr_comp<KeyValueCompare, splaytree_impl>
+ key_node_comp(comp, this);
+ std::pair<node_ptr, node_ptr> ret
+ (node_algorithms::bounded_range
+ (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed, false));
+ return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
+ }
+
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const splaytree_impl &src, Cloner cloner, Disposer disposer)
@@ -1202,11 +1300,11 @@ class splaytree_impl
}
//! <b>Effects</b>: Unlinks the leftmost node from the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! This function is normally used to achieve a step by step
@@ -1224,12 +1322,12 @@ class splaytree_impl
}
//! <b>Requires</b>: i must be a valid iterator of *this.
- //!
+ //!
//! <b>Effects</b>: Rearranges the splay set so that the element pointed by i
//! is placed as the root of the tree, improving future searches of this value.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
void splay_up(iterator i)
{ return node_algorithms::splay_up(i.pointed_node(), this->priv_header_ptr()); }
@@ -1238,7 +1336,7 @@ class splaytree_impl
//! with a key equivalent to value the element is placed as the root of the
//! tree. If the element is not present returns the last node compared with the key.
//! If the tree is empty, end() is returned.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
//!
//! <b>Returns</b>: An iterator to the new root of the tree, end() if the tree is empty.
@@ -1256,9 +1354,9 @@ class splaytree_impl
//! <b>Effects</b>: Rearranges the splay set so that if *this stores an element
//! with a key equivalent to value the element is placed as the root of the
//! tree.
- //!
+ //!
//! <b>Complexity</b>: Amortized logarithmic.
- //!
+ //!
//! <b>Returns</b>: An iterator to the new root of the tree, end() if the tree is empty.
//!
//! <b>Throws</b>: If the predicate throws.
@@ -1267,14 +1365,14 @@ class splaytree_impl
//! <b>Requires</b>: replace_this must be a valid iterator of *this
//! and with_this must not be inserted in any tree.
- //!
+ //!
//! <b>Effects</b>: Replaces replace_this in its position in the
//! tree with with_this. The tree does not need to be rebalanced.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! with_this is not equivalent to *replace_this according to the
//! ordering rules. This function is faster than erasing and inserting
@@ -1290,14 +1388,14 @@ class splaytree_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
@@ -1308,17 +1406,17 @@ class splaytree_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
- static const_iterator s_iterator_to(const_reference value)
+ static const_iterator s_iterator_to(const_reference value)
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
return const_iterator (value_traits::to_node_ptr(const_cast<reference> (value)), 0);
@@ -1326,70 +1424,70 @@ class splaytree_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator iterator_to(reference value)
{ return iterator (value_traits::to_node_ptr(value), this); }
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator iterator_to(const_reference value) const
{ return const_iterator (value_traits::to_node_ptr(const_cast<reference> (value)), this); }
//! <b>Requires</b>: value shall not be in a tree.
- //!
+ //!
//! <b>Effects</b>: init_node puts the hook of a value in a well-known default
//! state.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This function puts the hook in the well-known default state
//! used by auto_unlink and safe hooks.
static void init_node(reference value)
{ node_algorithms::init(value_traits::to_node_ptr(value)); }
//! <b>Effects</b>: Rebalances the tree.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear.
void rebalance()
{ node_algorithms::rebalance(this->priv_header_ptr()); }
//! <b>Requires</b>: old_root is a node of a tree.
- //!
+ //!
//! <b>Effects</b>: Rebalances the subtree rooted at old_root.
//!
//! <b>Returns</b>: The new root of the subtree.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements in the subtree.
iterator rebalance_subtree(iterator root)
{ return iterator(node_algorithms::rebalance_subtree(root.pointed_node()), this); }
/*
//! <b>Effects</b>: removes x from a tree of the appropriate type. It has no effect,
- //! if x is not in such a tree.
- //!
+ //! if x is not in such a tree.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This static function is only usable with the "safe mode"
//! hook and non-constant time size lists. Otherwise, the user must use
//! the non-static "erase(reference )" member. If the user calls
@@ -1399,7 +1497,7 @@ class splaytree_impl
static void remove_node(T& value)
{
//This function is only usable for safe mode hooks and non-constant
- //time lists.
+ //time lists.
//BOOST_STATIC_ASSERT((!(safemode_or_autounlink && constant_time_size)));
BOOST_STATIC_ASSERT((!constant_time_size));
BOOST_STATIC_ASSERT((boost::is_convertible<T, value_type>::value));
@@ -1571,7 +1669,7 @@ template<class T, class ...Options>
struct make_splaytree_opt
{
typedef typename pack_options
- < splay_set_defaults<T>,
+ < splay_set_defaults<T>,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1602,7 +1700,7 @@ struct make_splaytree
{
/// @cond
typedef splaytree_impl
- < typename make_splaytree_opt<T,
+ < typename make_splaytree_opt<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1621,7 +1719,7 @@ template<class T, class O1, class O2, class O3, class O4>
template<class T, class ...Options>
#endif
class splaytree
- : public make_splaytree<T,
+ : public make_splaytree<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1630,7 +1728,7 @@ class splaytree
>::type
{
typedef typename make_splaytree
- <T,
+ <T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1678,8 +1776,8 @@ class splaytree
#endif
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/splaytree_algorithms.hpp b/boost/intrusive/splaytree_algorithms.hpp
index 0c699030ea..8155648983 100644
--- a/boost/intrusive/splaytree_algorithms.hpp
+++ b/boost/intrusive/splaytree_algorithms.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007.
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,8 +15,8 @@
// The code has been modified and (supposely) improved by Ion Gaztanaga.
// 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 compatible splay tree.
+//
// Copyright (c) 2004 Ralf Mattethat
//
// Permission to copy, use, modify, sell and distribute this software
@@ -24,22 +24,22 @@
// This software is provided "as is" without express or implied
// 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
//
// Requirements for element type
// * must be copy-constructible
// * destructor must not throw exception
//
-// 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
+// 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
// effect on the containers state
//
// 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
//
-// 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
//
@@ -95,8 +95,8 @@ struct splaydown_rollback
//! A splay tree is an implementation of a binary search tree. The tree is
//! 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
//! AT&T Bell Laboratories, Murray Hill, NJ
//! Journal of the ACM, Vol 32, no 3, July 1985, pp 652-686
@@ -116,15 +116,15 @@ struct splaydown_rollback
//! <b>Static functions</b>:
//!
//! <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 node_ptr get_left(const_node_ptr n);</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 void set_right(node_ptr n, node_ptr right);</tt>
template<class NodeTraits>
class splaytree_algorithms
@@ -159,11 +159,11 @@ class splaytree_algorithms
//! <b>Requires</b>: node is a node of the tree or an node initialized
//! by init(...).
- //!
+ //!
//! <b>Effects</b>: Returns true if the node is initialized by init().
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static bool unique(const const_node_ptr & node)
{ return tree_algorithms::unique(node); }
@@ -173,15 +173,15 @@ class splaytree_algorithms
//! <b>Requires</b>: node1 and node2 can't be header nodes
//! of two trees.
- //!
+ //!
//! <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
//! position node1 had before the function.
- //!
- //! <b>Complexity</b>: Logarithmic.
- //!
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! node1 and node2 are not equivalent according to the ordering rules.
//!
@@ -190,22 +190,22 @@ class splaytree_algorithms
{
if(node1 == node2)
return;
-
+
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
swap_nodes(node1, header1, node2, header2);
}
//! <b>Requires</b>: node1 and node2 can't be header nodes
//! of two trees with header header1 and header2.
- //!
+ //!
//! <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
//! position node1 had before the function.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! 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
//! and new_node must not be inserted in a tree.
- //!
+ //!
//! <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
- //!
- //! <b>Complexity</b>: Logarithmic.
- //!
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! new_node is not equivalent to node_to_be_replaced according to the
//! 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
//! 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
//! 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>Note</b>: This function will break container ordering invariants if
//! new_node is not equivalent to node_to_be_replaced according to the
//! 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); }
//! <b>Requires</b>: p is a node from the tree except the header.
- //!
+ //!
//! <b>Effects</b>: Returns the next node of the tree.
- //!
+ //!
//! <b>Complexity</b>: Average constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr next_node(const node_ptr & p)
{ return tree_algorithms::next_node(p); }
//! <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>Complexity</b>: Average constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr prev_node(const node_ptr & 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>Effects</b>: After the function unique(node) == true.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <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.
//! unique(header) == true.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <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
//! 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
//! except the header.
- //!
+ //!
//! <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.
- //!
+ //!
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
template<class Disposer>
static void clear_and_dispose(const node_ptr & header, Disposer 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>Effects</b>: Returns the number of nodes of the subtree.
- //!
+ //!
//! <b>Complexity</b>: Linear time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static std::size_t count(const const_node_ptr & node)
{ return tree_algorithms::count(node); }
//! <b>Requires</b>: header is the header node of the tree.
- //!
+ //!
//! <b>Effects</b>: Returns the number of nodes above the header.
- //!
+ //!
//! <b>Complexity</b>: Linear time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static std::size_t size(const const_node_ptr & header)
{ return tree_algorithms::size(header); }
//! <b>Requires</b>: header1 and header2 must be the header nodes
//! 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.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
static void swap_tree(const node_ptr & header1, const node_ptr & 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
//! "insert_unique_check". No objects should have been inserted or erased
//! 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
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <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
//! 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
//! ordering compatible with the strict weak ordering used to create the
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
- //!
+ //!
//! <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
//! 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
//! be used with the "insert_commit" function to achieve a constant-time
//! insertion function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic.
//!
//! <b>Throws</b>: If "comp" throws.
- //!
+ //!
//! <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
//! 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.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr find
@@ -457,7 +457,7 @@ class splaytree_algorithms
//! if they there are no equivalent elements.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static std::pair<node_ptr, node_ptr> equal_range
@@ -477,13 +477,45 @@ class splaytree_algorithms
//! KeyNodePtrCompare is a function object that induces a strict weak
//! ordering compatible with the strict weak ordering used to create the
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyNodePtrCompare>
+ static std::pair<node_ptr, node_ptr> bounded_range
+ (const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp
+ , bool left_closed, bool right_closed, bool splay = true)
+ {
+ std::pair<node_ptr, node_ptr> ret =
+ tree_algorithms::bounded_range(header, lower_key, upper_key, comp, left_closed, right_closed);
+
+ if(splay)
+ splay_up(ret.first, uncast(header));
+ return ret;
+ }
+
+ //! <b>Requires</b>: "header" must be the header node of a tree.
+ //! KeyNodePtrCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
//!
//! <b>Effects</b>: Returns an node_ptr to the first element that is
//! not less than "key" according to "comp" or "header" if that element does
//! not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr lower_bound
@@ -506,7 +538,7 @@ class splaytree_algorithms
//! than "key" according to "comp" or "header" if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr upper_bound
@@ -525,14 +557,14 @@ class splaytree_algorithms
//! ordering compatible with the strict weak ordering used to create the
//! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from
//! the "header"'s tree.
- //!
+ //!
//! <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
//! the insertion takes constant time (two comparisons in the worst case).
//!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time if new_node is inserted immediately before "hint".
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class NodePtrCompare>
static node_ptr insert_equal
@@ -548,13 +580,13 @@ class splaytree_algorithms
//! "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
//! check "pos" and this precondition must be guaranteed by the caller.
- //!
+ //!
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
//!
//! <b>Complexity</b>: Constant-time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
//! tree invariants might be broken.
static node_ptr insert_before
@@ -568,13 +600,13 @@ class splaytree_algorithms
//! <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
//! greatest inserted key.
- //!
+ //!
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
//!
//! <b>Complexity</b>: Constant-time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
//! tree invariants are broken. This function is slightly faster than
//! using "insert_before".
@@ -587,13 +619,13 @@ class splaytree_algorithms
//! <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
//! lowest inserted key.
- //!
+ //!
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
//!
//! <b>Complexity</b>: Constant-time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
//! tree invariants are broken. This function is slightly faster than
//! using "insert_before".
@@ -610,10 +642,10 @@ class splaytree_algorithms
//!
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
//! according to "comp".
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class NodePtrCompare>
static node_ptr insert_equal_upper_bound
@@ -630,10 +662,10 @@ class splaytree_algorithms
//!
//! <b>Effects</b>: Inserts new_node into the tree before the lower bound
//! according to "comp".
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class NodePtrCompare>
static node_ptr insert_equal_lower_bound
@@ -647,18 +679,18 @@ class splaytree_algorithms
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
//! 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
//! except the header.
- //!
+ //!
//! 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
//! 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.
//! 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.
template <class Cloner, class Disposer>
static void clone
@@ -723,13 +755,13 @@ class splaytree_algorithms
node_ptr t(header);
if( n == t ) return;
-
+
for( ;; ){
node_ptr p(NodeTraits::get_parent(n));
node_ptr g(NodeTraits::get_parent(p));
if( p == t ) break;
-
+
if( g == t ){
// zig
rotate(n);
@@ -772,10 +804,11 @@ class splaytree_algorithms
node_ptr leftmost (NodeTraits::get_left(header));
node_ptr rightmost(NodeTraits::get_right(header));
{
+ //Anti-exception rollback, recovers the original header node if an exception is thrown.
detail::splaydown_rollback<NodeTraits> rollback(&t, header, leftmost, rightmost);
- node_ptr null = header;
- node_ptr l = null;
- node_ptr r = null;
+ node_ptr null_node = header;
+ node_ptr l = null_node;
+ node_ptr r = null_node;
for( ;; ){
if(comp(key, t)){
@@ -827,10 +860,12 @@ class splaytree_algorithms
}
}
- assemble(t, l, r, null);
+ assemble(t, l, r, null_node);
rollback.release();
}
+ //Now recover the original header except for the
+ //splayed root node.
//t is the current root
NodeTraits::set_parent(header, t);
NodeTraits::set_parent(t, header);
@@ -841,23 +876,23 @@ class splaytree_algorithms
}
//! <b>Requires</b>: header must be the header of a tree.
- //!
+ //!
//! <b>Effects</b>: Rebalances the tree.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear.
static void rebalance(const node_ptr & header)
{ tree_algorithms::rebalance(header); }
//! <b>Requires</b>: old_root is a node of a tree.
- //!
+ //!
//! <b>Effects</b>: Rebalances the subtree rooted at old_root.
//!
//! <b>Returns</b>: The new root of the subtree.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear.
static node_ptr rebalance_subtree(const node_ptr & old_root)
{ return tree_algorithms::rebalance_subtree(old_root); }
@@ -868,7 +903,7 @@ class splaytree_algorithms
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr get_header(const node_ptr & n)
{ return tree_algorithms::get_header(n); }
@@ -926,10 +961,10 @@ class splaytree_algorithms
{
node_ptr p = NodeTraits::get_parent(n);
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
bool g_is_header = is_header(g);
-
+
if(NodeTraits::get_left(p) == n){
NodeTraits::set_left(p, NodeTraits::get_right(n));
if(NodeTraits::get_left(p) != node_ptr())
@@ -965,8 +1000,8 @@ class splaytree_algorithms
/// @endcond
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/treap.hpp b/boost/intrusive/treap.hpp
index cbf81c180e..b539acc569 100644
--- a/boost/intrusive/treap.hpp
+++ b/boost/intrusive/treap.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2008
+// (C) Copyright Ion Gaztanaga 2008-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -66,7 +66,7 @@ struct treap_set_defaults
/// @endcond
//! The class template treap is an intrusive treap container that
-//! is used to construct intrusive set and multiset containers. The no-throw
+//! is used to construct intrusive set and multiset containers. The no-throw
//! guarantee holds only, if the value_compare object and priority_compare object
//! don't throw.
//!
@@ -133,7 +133,7 @@ class treap_impl
//noncopyable
BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_impl)
- enum { safemode_or_autounlink =
+ enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
(int)real_value_traits::link_mode == (int)safe_link };
@@ -167,7 +167,7 @@ class treap_impl
{}
node_plus_pred_t node_plus_pred_;
} data_;
-
+
const value_compare &priv_comp() const
{ return data_.node_plus_pred_.get(); }
@@ -225,19 +225,19 @@ class treap_impl
typedef typename node_algorithms::insert_commit_data insert_commit_data;
- //! <b>Effects</b>: Constructs an empty treap.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //! <b>Effects</b>: Constructs an empty treap.
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or the copy constructor of the value_compare/priority_compare objects throw. Basic guarantee.
treap_impl( const value_compare &cmp = value_compare()
, const priority_compare &pcmp = priority_compare()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: data_(cmp, pcmp, v_traits)
- {
- node_algorithms::init_header(this->priv_header_ptr());
+ {
+ node_algorithms::init_header(this->priv_header_ptr());
this->priv_size_traits().set_size(size_type(0));
}
@@ -249,10 +249,10 @@ class treap_impl
//!
//! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
//! comp and otherwise N * log N, where N is the distance between first and last.
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor/operator() of the value_compare/priority_compare objects
+ //! or the copy constructor/operator() of the value_compare/priority_compare objects
//! throw. Basic guarantee.
template<class Iterator>
treap_impl( bool unique, Iterator b, Iterator e
@@ -270,61 +270,61 @@ class treap_impl
}
//! <b>Effects</b>: to-do
- //!
+ //!
treap_impl(BOOST_RV_REF(treap_impl) x)
: data_( ::boost::move(x.priv_comp())
, ::boost::move(x.priv_pcomp())
, ::boost::move(x.priv_value_traits()))
{
- node_algorithms::init_header(this->priv_header_ptr());
+ node_algorithms::init_header(this->priv_header_ptr());
this->priv_size_traits().set_size(size_type(0));
this->swap(x);
}
//! <b>Effects</b>: to-do
- //!
- treap_impl& operator=(BOOST_RV_REF(treap_impl) x)
+ //!
+ treap_impl& operator=(BOOST_RV_REF(treap_impl) x)
{ this->swap(x); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the set
- //! are not deleted (i.e. no destructors are called), but the nodes according to
- //! the value_traits template parameter are reinitialized and thus can be reused.
- //!
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the set
+ //! are not deleted (i.e. no destructors are called), but the nodes according to
+ //! the value_traits template parameter are reinitialized and thus can be reused.
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this
//! if constant-time size option is disabled. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- ~treap_impl()
+ ~treap_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return iterator (node_traits::get_left(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return this->cbegin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return const_iterator (node_traits::get_left(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return iterator (this->priv_header_ptr(), this); }
@@ -332,198 +332,198 @@ class treap_impl
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the treap.
//!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return this->cend(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return const_iterator (uncast(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns an iterator pointing to the highest priority object of the treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator top()
{ return this->empty() ? this->end() : iterator (node_traits::get_parent(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns a const_iterator pointing to the highest priority object of the treap..
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator top() const
{ return this->ctop(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the highest priority object of the treap..
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator ctop() const
{ return this->empty() ? this->cend() : const_iterator (node_traits::get_parent(this->priv_header_ptr()), this); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
//! reversed treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rbegin()
{ return reverse_iterator(this->end()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rbegin() const
{ return const_reverse_iterator(this->end()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crbegin() const
{ return const_reverse_iterator(this->end()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rend()
{ return reverse_iterator(this->begin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rend() const
{ return const_reverse_iterator(this->begin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crend() const
{ return const_reverse_iterator(this->begin()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the highest priority object of the
//! reversed treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rtop()
{ return reverse_iterator(this->top()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the highest priority objec
//! of the reversed treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rtop() const
{ return const_reverse_iterator(this->top()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the highest priority object
//! of the reversed treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crtop() const
{ return const_reverse_iterator(this->top()); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of treap.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the treap associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static treap_impl &container_from_end_iterator(iterator end_iterator)
{ return priv_container_from_end_iterator(end_iterator); }
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of treap.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the treap associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const treap_impl &container_from_end_iterator(const_iterator end_iterator)
{ return priv_container_from_end_iterator(end_iterator); }
//! <b>Precondition</b>: it must be a valid iterator
//! of treap.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the treap associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static treap_impl &container_from_iterator(iterator it)
{ return priv_container_from_iterator(it); }
//! <b>Precondition</b>: it must be a valid end const_iterator
//! of treap.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the treap associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static const treap_impl &container_from_iterator(const_iterator it)
{ return priv_container_from_iterator(it); }
//! <b>Effects</b>: Returns the value_compare object used by the treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If value_compare copy-constructor throws.
value_compare value_comp() const
{ return this->priv_comp(); }
//! <b>Effects</b>: Returns the priority_compare object used by the treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If priority_compare copy-constructor throws.
priority_compare priority_comp() const
{ return this->priv_pcomp(); }
//! <b>Effects</b>: Returns true if the container is empty.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return node_algorithms::unique(this->priv_header_ptr()); }
//! <b>Effects</b>: Returns the number of elements stored in the treap.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this
//! if constant-time size option is disabled. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{
@@ -535,9 +535,9 @@ class treap_impl
}
//! <b>Effects</b>: Swaps the contents of two treaps.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the comparison functor's swap call throws.
void swap(treap_impl& other)
{
@@ -555,14 +555,14 @@ class treap_impl
}
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts value into the treap before the upper bound.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare or priority_compare functions throw. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert_equal(reference value)
@@ -582,16 +582,16 @@ class treap_impl
//! <b>Requires</b>: value must be an lvalue, and "hint" must be
//! a valid iterator.
- //!
+ //!
//! <b>Effects</b>: Inserts x into the treap, using "hint" as a hint to
//! where it will be inserted. If "hint" is the upper_bound
//! the insertion takes constant time (two comparisons in the worst case)
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare or priority_compare functions throw. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert_equal(const_iterator hint, reference value)
@@ -609,19 +609,19 @@ class treap_impl
return ret;
}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Inserts a each element of a range into the treap
//! before the upper bound of the key of each element.
- //!
+ //!
//! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
//! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare or priority_compare functions throw.
//! Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -633,16 +633,16 @@ class treap_impl
}
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts value into the treap if the value
//! is not already present.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare or priority_compare functions throw.
//! Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
std::pair<iterator, bool> insert_unique(reference value)
@@ -656,17 +656,17 @@ class treap_impl
//! <b>Requires</b>: value must be an lvalue, and "hint" must be
//! a valid iterator
- //!
+ //!
//! <b>Effects</b>: Tries to insert x into the treap, using "hint" as a hint
//! to where it will be inserted.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time (two comparisons in the worst case)
//! if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare or priority_compare functions throw.
//! Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert_unique(const_iterator hint, reference value)
@@ -678,18 +678,18 @@ class treap_impl
return insert_unique_commit(value, commit_data);
}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Tries to insert each element of a range into the treap.
- //!
- //! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
- //! size of the range. However, it is linear in N if the range is already sorted
+ //!
+ //! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
+ //! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare or priority_compare functions throw.
//! Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -706,12 +706,12 @@ class treap_impl
}
}
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare.
- //! key_value_pcomp must be a comparison function that induces
+ //! key_value_pcomp must be a comparison function that induces
//! the same strict weak ordering as priority_compare. The difference is that
//! key_value_pcomp and key_value_comp compare an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the container, using
//! a user provided key instead of the value itself.
//!
@@ -720,17 +720,17 @@ class treap_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic.
//!
//! <b>Throws</b>: If the key_value_comp or key_value_pcomp
//! ordering functions throw. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! node that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that
+ //! than the value_type and this function offers the possibility to use that
//! part to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
@@ -748,20 +748,20 @@ class treap_impl
comp(key_value_comp, this);
detail::key_nodeptr_comp<KeyValuePrioCompare, treap_impl>
pcomp(key_value_pcomp, this);
- std::pair<node_ptr, bool> ret =
+ std::pair<node_ptr, bool> ret =
(node_algorithms::insert_unique_check
(this->priv_header_ptr(), key, comp, pcomp, commit_data));
return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
}
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare.
- //! key_value_pcomp must be a comparison function that induces
+ //! key_value_pcomp must be a comparison function that induces
//! the same strict weak ordering as priority_compare. The difference is that
//! key_value_pcomp and key_value_comp compare an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the container, using
- //! a user provided key instead of the value itself, using "hint"
+ //! a user provided key instead of the value itself, using "hint"
//! as a hint to where it will be inserted.
//!
//! <b>Returns</b>: If there is an equivalent value
@@ -769,24 +769,24 @@ class treap_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it's amortized
//! constant time if t is inserted immediately before hint.
//!
//! <b>Throws</b>: If the key_value_comp or key_value_pcomp
//! ordering functions throw. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! constructing that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that key
+ //! than the value_type and this function offers the possibility to use that key
//! to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
//! "insert_commit" to insert the object in constant-time. This can give a total
//! constant-time complexity to the insertion: check(O(1)) + commit(O(1)).
- //!
+ //!
//! "commit_data" remains valid for a subsequent "insert_commit" only if no more
//! objects are inserted or erased from the container.
template<class KeyType, class KeyValueCompare, class KeyValuePrioCompare>
@@ -800,7 +800,7 @@ class treap_impl
comp(key_value_comp, this);
detail::key_nodeptr_comp<KeyValuePrioCompare, treap_impl>
pcomp(key_value_pcomp, this);
- std::pair<node_ptr, bool> ret =
+ std::pair<node_ptr, bool> ret =
(node_algorithms::insert_unique_check
(this->priv_header_ptr(), hint.pointed_node(), key, comp, pcomp, commit_data));
return std::pair<iterator, bool>(iterator(ret.first, this), ret.second);
@@ -810,16 +810,16 @@ class treap_impl
//! must have been obtained from a previous call to "insert_check".
//! No objects should have been inserted or erased from the container between
//! the "insert_check" that filled "commit_data" and the call to "insert_commit".
- //!
+ //!
//! <b>Effects</b>: Inserts the value in the avl_set using the information obtained
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Returns</b>: An iterator to the newly inserted object.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing
- //!
+ //!
//! <b>Notes</b>: This function has only sense if a "insert_check" has been
//! previously executed to fill "commit_data". No value should be inserted or
//! erased between the "insert_check" and "insert_commit" calls.
@@ -838,11 +838,11 @@ class treap_impl
//! once inserted according to the predicate
//!
//! <b>Effects</b>: Inserts x into the treap before "pos".
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: If the internal priority_compare function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if "pos" is not
//! the successor of "value" treap ordering invariant will be broken.
//! This is a low-level function to be used only for performance reasons
@@ -864,11 +864,11 @@ class treap_impl
//! than the greatest inserted key
//!
//! <b>Effects</b>: Inserts x into the treap in the last position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: If the internal priority_compare function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! less than the greatest inserted key treap ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -889,11 +889,11 @@ class treap_impl
//! than the minimum inserted key
//!
//! <b>Effects</b>: Inserts x into the treap in the first position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: If the internal priority_compare function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! greater than the minimum inserted key treap ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -910,12 +910,12 @@ class treap_impl
this->priv_size_traits().increment();
}
- //! <b>Effects</b>: Erases the element pointed to by pos.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by pos.
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Throws</b>: if the internal priority_compare function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator i)
@@ -934,26 +934,26 @@ class treap_impl
return ret.unconst();
}
- //! <b>Effects</b>: Erases the range pointed to by b end e.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: if the internal priority_compare function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator b, const_iterator e)
{ size_type n; return private_erase(b, e, n); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: if the internal priority_compare function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
@@ -963,12 +963,12 @@ class treap_impl
//! according to the comparison functor "comp".
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: if the internal priority_compare function throws.
//! Equivalent guarantee to <i>while(beg != end) erase(beg++);</i>
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyValueCompare>
@@ -986,14 +986,14 @@ class treap_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Erases the element pointed to by pos.
+ //! <b>Effects</b>: Erases the element pointed to by pos.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Throws</b>: if the internal priority_compare function throws. Strong guarantee.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
@@ -1014,12 +1014,12 @@ class treap_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: if the internal priority_compare function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -1030,14 +1030,14 @@ class treap_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: if the priority_compare function throws then weak guarantee and heap invariants are broken.
//! The safest thing would be to clear or destroy the container.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -1056,12 +1056,12 @@ class treap_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + N).
- //!
+ //!
//! <b>Throws</b>: if the priority_compare function throws then weak guarantee and heap invariants are broken.
//! The safest thing would be to clear or destroy the container.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyValueCompare, class Disposer>
@@ -1077,13 +1077,13 @@ class treap_impl
return n;
}
- //! <b>Effects</b>: Erases all of the elements.
- //!
+ //! <b>Effects</b>: Erases all of the elements.
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
@@ -1101,9 +1101,9 @@ class treap_impl
//! each node to be erased.
//! <b>Complexity</b>: Average complexity for is at most O(log(size() + N)),
//! where N is the number of elements in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. Calls N times to disposer functor.
template<class Disposer>
@@ -1116,19 +1116,19 @@ class treap_impl
}
//! <b>Effects</b>: Returns the number of contained elements with the given value
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given value.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type count(const_reference value) const
{ return this->count(value, priv_comp()); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
size_type count(const KeyType &key, KeyValueCompare comp) const
@@ -1139,27 +1139,27 @@ class treap_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator lower_bound(const_reference value)
{ return this->lower_bound(value, priv_comp()); }
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator lower_bound(const_reference value) const
{ return this->lower_bound(value, priv_comp()); }
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
iterator lower_bound(const KeyType &key, KeyValueCompare comp)
@@ -1172,9 +1172,9 @@ class treap_impl
//! <b>Effects</b>: Returns a const iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
const_iterator lower_bound(const KeyType &key, KeyValueCompare comp) const
@@ -1187,9 +1187,9 @@ class treap_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator upper_bound(const_reference value)
{ return this->upper_bound(value, priv_comp()); }
@@ -1199,7 +1199,7 @@ class treap_impl
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
iterator upper_bound(const KeyType &key, KeyValueCompare comp)
@@ -1212,9 +1212,9 @@ class treap_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator upper_bound(const_reference value) const
{ return this->upper_bound(value, priv_comp()); }
@@ -1224,7 +1224,7 @@ class treap_impl
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
const_iterator upper_bound(const KeyType &key, KeyValueCompare comp) const
@@ -1235,20 +1235,20 @@ class treap_impl
(this->priv_header_ptr(), key, key_node_comp), this);
}
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
//! k or end() if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator find(const_reference value)
{ return this->find(value, priv_comp()); }
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
//! k or end() if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
iterator find(const KeyType &key, KeyValueCompare comp)
@@ -1259,20 +1259,20 @@ class treap_impl
(node_algorithms::find(this->priv_header_ptr(), key, key_node_comp), this);
}
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
//! k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator find(const_reference value) const
{ return this->find(value, priv_comp()); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
//! k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
const_iterator find(const KeyType &key, KeyValueCompare comp) const
@@ -1286,9 +1286,9 @@ class treap_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return this->equal_range(value, priv_comp()); }
@@ -1296,9 +1296,9 @@ class treap_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
std::pair<iterator,iterator> equal_range(const KeyType &key, KeyValueCompare comp)
@@ -1313,9 +1313,9 @@ class treap_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
std::pair<const_iterator, const_iterator>
equal_range(const_reference value) const
@@ -1324,9 +1324,9 @@ class treap_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
template<class KeyType, class KeyValueCompare>
std::pair<const_iterator, const_iterator>
@@ -1339,19 +1339,117 @@ class treap_impl
return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
}
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ {
+ detail::key_nodeptr_comp<KeyValueCompare, treap_impl>
+ key_node_comp(comp, this);
+ std::pair<node_ptr, node_ptr> ret
+ (node_algorithms::bounded_range
+ (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed));
+ return std::pair<iterator, iterator>(iterator(ret.first, this), iterator(ret.second, this));
+ }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator,const_iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator,const_iterator> bounded_range
+ (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ {
+ detail::key_nodeptr_comp<KeyValueCompare, treap_impl>
+ key_node_comp(comp, this);
+ std::pair<node_ptr, node_ptr> ret
+ (node_algorithms::bounded_range
+ (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed));
+ return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
+ }
+
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const treap_impl &src, Cloner cloner, Disposer disposer)
@@ -1372,11 +1470,11 @@ class treap_impl
}
//! <b>Effects</b>: Unlinks the leftmost node from the treap.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the treap and the treap can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! This function is normally used to achieve a step by step
@@ -1395,14 +1493,14 @@ class treap_impl
//! <b>Requires</b>: replace_this must be a valid iterator of *this
//! and with_this must not be inserted in any treap.
- //!
+ //!
//! <b>Effects</b>: Replaces replace_this in its position in the
//! treap with with_this. The treap does not need to be rebalanced.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! with_this is not equivalent to *replace_this according to the
//! ordering and priority rules. This function is faster than erasing and inserting
@@ -1418,14 +1516,14 @@ class treap_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
@@ -1436,17 +1534,17 @@ class treap_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
- static const_iterator s_iterator_to(const_reference value)
+ static const_iterator s_iterator_to(const_reference value)
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
return const_iterator (value_traits::to_node_ptr(const_cast<reference> (value)), 0);
@@ -1454,37 +1552,37 @@ class treap_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator iterator_to(reference value)
{ return iterator (value_traits::to_node_ptr(value), this); }
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator iterator_to(const_reference value) const
{ return const_iterator (value_traits::to_node_ptr(const_cast<reference> (value)), this); }
//! <b>Requires</b>: value shall not be in a treap.
- //!
+ //!
//! <b>Effects</b>: init_node puts the hook of a value in a well-known default
//! state.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This function puts the hook in the well-known default state
//! used by auto_unlink and safe hooks.
static void init_node(reference value)
@@ -1658,7 +1756,7 @@ template<class T, class ...Options>
struct make_treap_opt
{
typedef typename pack_options
- < treap_set_defaults<T>,
+ < treap_set_defaults<T>,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1690,7 +1788,7 @@ struct make_trie
{
/// @cond
typedef treap_impl
- < typename make_treap_opt<T,
+ < typename make_treap_opt<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1710,7 +1808,7 @@ template<class T, class O1, class O2, class O3, class O4>
template<class T, class ...Options>
#endif
class treap
- : public make_trie<T,
+ : public make_trie<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1719,7 +1817,7 @@ class treap
>::type
{
typedef typename make_trie
- <T,
+ <T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1776,8 +1874,8 @@ class treap
#endif
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/treap_algorithms.hpp b/boost/intrusive/treap_algorithms.hpp
index 128e7ce227..967e7315cf 100644
--- a/boost/intrusive/treap_algorithms.hpp
+++ b/boost/intrusive/treap_algorithms.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2006-2009.
+// (C) Copyright Ion Gaztanaga 2006-2012.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -28,15 +28,15 @@
namespace boost {
namespace intrusive {
-//! treap_algorithms provides basic algorithms to manipulate
+//! treap_algorithms provides basic algorithms to manipulate
//! nodes forming a treap.
-//!
+//!
//! (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
//! begin(), and to the rightmost node of the tree, to enable linear time
//! performance when used with the generic set algorithms (set_union,
//! etc.);
-//!
+//!
//! (2) when a node being deleted has two children its successor node is
//! relinked into its place, rather than copied, so that the only
//! pointers invalidated are those referring to the deleted node.
@@ -56,15 +56,15 @@ namespace intrusive {
//! <b>Static functions</b>:
//!
//! <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 node_ptr get_left(const_node_ptr n);</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 void set_right(node_ptr n, node_ptr right);</tt>
template<class NodeTraits>
class treap_algorithms
@@ -92,7 +92,7 @@ class treap_algorithms
tree_algorithms::erase(header_, z_);
}
}
-
+
void release()
{ remove_it_ = false; }
@@ -117,7 +117,7 @@ class treap_algorithms
rotate_up_n(header_, p_, n_);
}
}
-
+
void release()
{ remove_it_ = false; }
@@ -170,27 +170,27 @@ class treap_algorithms
//! <b>Requires</b>: header1 and header2 must be the header nodes
//! 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.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
{ return tree_algorithms::swap_tree(header1, header2); }
//! <b>Requires</b>: node1 and node2 can't be header nodes
//! of two trees.
- //!
+ //!
//! <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
//! position node1 had before the function.
- //!
- //! <b>Complexity</b>: Logarithmic.
- //!
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! node1 and node2 are not equivalent according to the ordering rules.
//!
@@ -199,22 +199,22 @@ class treap_algorithms
{
if(node1 == node2)
return;
-
+
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
swap_nodes(node1, header1, node2, header2);
}
//! <b>Requires</b>: node1 and node2 can't be header nodes
//! of two trees with header header1 and header2.
- //!
+ //!
//! <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
//! position node1 had before the function.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! 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
//! and new_node must not be inserted in a tree.
- //!
+ //!
//! <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
- //!
- //! <b>Complexity</b>: Logarithmic.
- //!
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! new_node is not equivalent to node_to_be_replaced according to the
//! 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
//! 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
//! 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>Note</b>: This function will break container ordering invariants if
//! new_node is not equivalent to node_to_be_replaced according to the
//! 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); }
//! <b>Requires</b>: node is a tree node but not the header.
- //!
+ //!
//! <b>Effects</b>: Unlinks the node and rebalances the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: If "pcomp" throws, strong guarantee
template<class NodePtrPriorityCompare>
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>Effects</b>: Unlinks the leftmost node from the tree, and
//! updates the header link to the new leftmost node.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! 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
//! by init(...).
- //!
+ //!
//! <b>Effects</b>: Returns true if the node is initialized by init().
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static bool unique(const const_node_ptr & node)
{ return tree_algorithms::unique(node); }
//! <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>Complexity</b>: Linear time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static std::size_t count(const const_node_ptr & node)
{ return tree_algorithms::count(node); }
//! <b>Requires</b>: header is the header node of the tree.
- //!
+ //!
//! <b>Effects</b>: Returns the number of nodes above the header.
- //!
+ //!
//! <b>Complexity</b>: Linear time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static std::size_t size(const const_node_ptr & header)
{ return tree_algorithms::size(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>Complexity</b>: Average constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr next_node(const node_ptr & p)
{ return tree_algorithms::next_node(p); }
//! <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>Complexity</b>: Average constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr prev_node(const node_ptr & 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>Effects</b>: After the function unique(node) == true.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <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.
//! unique(header) == true.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <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.
//!
//! <b>Effects</b>: Erases node "z" from the tree with header "header".
- //!
+ //!
//! <b>Complexity</b>: Amortized constant time.
- //!
+ //!
//! <b>Throws</b>: If "pcomp" throws, strong guarantee.
template<class NodePtrPriorityCompare>
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
//! 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
//! except the header.
- //!
+ //!
//! 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
//! 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.
//! 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.
template <class Cloner, class Disposer>
static void clone
@@ -420,13 +420,13 @@ class treap_algorithms
//! <b>Requires</b>: "disposer" must be an object function
//! 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
//! except the header.
- //!
+ //!
//! <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.
- //!
+ //!
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
template<class Disposer>
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
@@ -442,7 +442,7 @@ class treap_algorithms
//! not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
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.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr upper_bound
@@ -474,7 +474,7 @@ class treap_algorithms
//! "key" according to "comp" or "header" if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr find
@@ -492,13 +492,38 @@ class treap_algorithms
//! if they there are no equivalent elements.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class KeyType, class KeyNodePtrCompare>
static std::pair<node_ptr, node_ptr> equal_range
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{ return tree_algorithms::equal_range(header, key, comp); }
+ //! <b>Requires</b>: "header" must be the header node of a tree.
+ //! KeyNodePtrCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyNodePtrCompare>
+ static std::pair<node_ptr, node_ptr> bounded_range
+ (const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp
+ , bool left_closed, bool right_closed)
+ { return tree_algorithms::bounded_range(header, lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: "h" must be the header node of a tree.
//! NodePtrCompare is a function object that induces a strict weak
//! ordering compatible with the strict weak ordering used to create the
@@ -509,10 +534,10 @@ class treap_algorithms
//!
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
//! according to "comp" and rotates the tree according to "pcomp".
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throw or "pcomp" throw.
template<class NodePtrCompare, class NodePtrPriorityCompare>
static node_ptr insert_equal_upper_bound
@@ -534,10 +559,10 @@ class treap_algorithms
//!
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
//! according to "comp" and rotates the tree according to "pcomp".
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If "comp" throws.
template<class NodePtrCompare, class NodePtrPriorityCompare>
static node_ptr insert_equal_lower_bound
@@ -557,7 +582,7 @@ class treap_algorithms
//! NodePtrPriorityCompare is a priority function object that induces a strict weak
//! ordering compatible with the one used to create the
//! the tree. NodePtrPriorityCompare compares two node_ptrs.
- //!
+ //!
//! <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
//! the insertion takes constant time (two comparisons in the worst case).
@@ -565,7 +590,7 @@ class treap_algorithms
//!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time if new_node is inserted immediately before "hint".
- //!
+ //!
//! <b>Throws</b>: If "comp" throw or "pcomp" throw.
template<class NodePtrCompare, class NodePtrPriorityCompare>
static node_ptr insert_equal
@@ -585,14 +610,14 @@ class treap_algorithms
//! NodePtrPriorityCompare is a priority function object that induces a strict weak
//! ordering compatible with the one used to create the
//! the tree. NodePtrPriorityCompare compares two node_ptrs.
- //!
+ //!
//! <b>Effects</b>: Inserts new_node into the tree before "pos"
//! and rotates the tree according to "pcomp".
//!
//! <b>Complexity</b>: Constant-time.
- //!
+ //!
//! <b>Throws</b>: If "pcomp" throws, strong guarantee.
- //!
+ //!
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
//! tree invariants might be broken.
template<class NodePtrPriorityCompare>
@@ -611,14 +636,14 @@ class treap_algorithms
//! NodePtrPriorityCompare is a priority function object that induces a strict weak
//! ordering compatible with the one used to create the
//! the tree. NodePtrPriorityCompare compares two node_ptrs.
- //!
+ //!
//! <b>Effects</b>: Inserts x into the tree in the last position
//! and rotates the tree according to "pcomp".
//!
//! <b>Complexity</b>: Constant-time.
- //!
+ //!
//! <b>Throws</b>: If "pcomp" throws, strong guarantee.
- //!
+ //!
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
//! tree invariants are broken. This function is slightly faster than
//! using "insert_before".
@@ -636,14 +661,14 @@ class treap_algorithms
//! NodePtrPriorityCompare is a priority function object that induces a strict weak
//! ordering compatible with the one used to create the
//! the tree. NodePtrPriorityCompare compares two node_ptrs.
- //!
+ //!
//! <b>Effects</b>: Inserts x into the tree in the first position
//! and rotates the tree according to "pcomp".
//!
//! <b>Complexity</b>: Constant-time.
- //!
+ //!
//! <b>Throws</b>: If "pcomp" throws, strong guarantee.
- //!
+ //!
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
//! tree invariants are broken. This function is slightly faster than
//! using "insert_before".
@@ -659,7 +684,7 @@ class treap_algorithms
//! KeyNodePtrCompare is a function object that induces a strict weak
//! ordering compatible with the strict weak ordering used to create the
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
- //!
+ //!
//! <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
//! a constant-time node insertion if there is no equivalent node.
@@ -670,11 +695,11 @@ class treap_algorithms
//! 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
//! insertion function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic.
//!
//! <b>Throws</b>: If "comp" throws.
- //!
+ //!
//! <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
//! in the tree: if there is an equivalent value
@@ -707,12 +732,12 @@ class treap_algorithms
//! ordering compatible with the strict weak ordering used to create the
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
//! "hint" is node from the "header"'s tree.
- //!
+ //!
//! <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
//! inserted and obtains the needed information to realize
- //! a constant-time node insertion if there is no equivalent node.
- //! If "hint" is the upper_bound the function has constant time
+ //! a constant-time node insertion if there is no equivalent node.
+ //! If "hint" is the upper_bound the function has constant time
//! complexity (two comparisons in the worst case).
//!
//! <b>Returns</b>: If there is an equivalent value
@@ -721,12 +746,12 @@ class treap_algorithms
//! 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
//! insertion function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic, but it is
//! amortized constant time if new_node should be inserted immediately before "hint".
//!
//! <b>Throws</b>: If "comp" throws.
- //!
+ //!
//! <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
//! in the tree: if there is an equivalent value
@@ -757,16 +782,16 @@ class treap_algorithms
//! "commit_data" must have been obtained from a previous call to
//! "insert_unique_check". No objects should have been inserted or erased
//! 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
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <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
//! erased between the "insert_check" and "insert_commit" calls.
@@ -782,7 +807,7 @@ class treap_algorithms
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static node_ptr get_header(const node_ptr & n)
{ return tree_algorithms::get_header(n); }
@@ -791,11 +816,11 @@ class treap_algorithms
private:
//! <b>Requires</b>: p is a node of a tree.
- //!
+ //!
//! <b>Effects</b>: Returns true if p is the header of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static bool is_header(const const_node_ptr & p)
{
@@ -887,8 +912,8 @@ class treap_algorithms
/// @endcond
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/treap_set.hpp b/boost/intrusive/treap_set.hpp
index 01dfcd8b30..66adfaf207 100644
--- a/boost/intrusive/treap_set.hpp
+++ b/boost/intrusive/treap_set.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -22,9 +22,9 @@
namespace boost {
namespace intrusive {
-//! The class template treap_set is an intrusive container, that mimics most of
+//! The class template treap_set is an intrusive container, that mimics most of
//! the interface of std::set as described in the C++ standard.
-//!
+//!
//! The template parameter \c T is the type to be managed by the container.
//! The user can specify additional options and if no options are provided
//! default options are used.
@@ -80,31 +80,31 @@ class treap_set_impl
/// @endcond
public:
- //! <b>Effects</b>: Constructs an empty treap_set.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //! <b>Effects</b>: Constructs an empty treap_set.
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor of the value_compare object throws.
+ //! or the copy constructor of the value_compare object throws.
treap_set_impl( const value_compare &cmp = value_compare()
, const priority_compare &pcmp = priority_compare()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: tree_(cmp, pcmp, v_traits)
{}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
//! cmp must be a comparison function that induces a strict weak ordering.
- //!
- //! <b>Effects</b>: Constructs an empty treap_set and inserts elements from
+ //!
+ //! <b>Effects</b>: Constructs an empty treap_set and inserts elements from
//! [b, e).
- //!
- //! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
+ //!
+ //! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
//! comp and otherwise N * log N, where N is std::distance(last, first).
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor/operator() of the value_compare object throws.
+ //! or the copy constructor/operator() of the value_compare object throws.
template<class Iterator>
treap_set_impl( Iterator b, Iterator e
, const value_compare &cmp = value_compare()
@@ -114,186 +114,186 @@ class treap_set_impl
{}
//! <b>Effects</b>: to-do
- //!
- treap_set_impl(BOOST_RV_REF(treap_set_impl) x)
+ //!
+ treap_set_impl(BOOST_RV_REF(treap_set_impl) x)
: tree_(::boost::move(x.tree_))
{}
//! <b>Effects</b>: to-do
- //!
- treap_set_impl& operator=(BOOST_RV_REF(treap_set_impl) x)
+ //!
+ treap_set_impl& operator=(BOOST_RV_REF(treap_set_impl) x)
{ tree_ = ::boost::move(x.tree_); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the treap_set
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the treap_set
//! are not deleted (i.e. no destructors are called).
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- ~treap_set_impl()
+ ~treap_set_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the treap_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the treap_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the treap_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return tree_.cbegin(); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the treap_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the treap_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return tree_.end(); }
//! <b>Effects</b>: Returns an iterator pointing to the highest priority object of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator top()
{ return tree_.top(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the highest priority object of the tree..
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator top() const
{ return this->ctop(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the highest priority object of the tree..
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator ctop() const
{ return tree_.ctop(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the treap_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return tree_.cend(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
//! reversed treap_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rbegin()
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed treap_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rbegin() const
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed treap_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crbegin() const
{ return tree_.crbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed treap_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rend()
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed treap_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rend() const
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed treap_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crend() const
{ return tree_.crend(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the highest priority object of the
//! reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rtop()
{ return tree_.rtop(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the highest priority objec
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rtop() const
{ return tree_.crtop(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the highest priority object
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crtop() const
{ return tree_.crtop(); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of treap_set.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the treap_set associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static treap_set_impl &container_from_end_iterator(iterator end_iterator)
{
@@ -304,11 +304,11 @@ class treap_set_impl
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of treap_set.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the treap_set associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const treap_set_impl &container_from_end_iterator(const_iterator end_iterator)
{
@@ -318,11 +318,11 @@ class treap_set_impl
}
//! <b>Precondition</b>: it must be a valid iterator of set.
- //!
+ //!
//! <b>Effects</b>: Returns a reference to the set associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static treap_set_impl &container_from_iterator(iterator it)
{
@@ -332,11 +332,11 @@ class treap_set_impl
}
//! <b>Precondition</b>: it must be a valid const_iterator of set.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the set associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
static const treap_set_impl &container_from_iterator(const_iterator it)
{
@@ -346,50 +346,50 @@ class treap_set_impl
}
//! <b>Effects</b>: Returns the key_compare object used by the treap_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If key_compare copy-constructor throws.
key_compare key_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns the value_compare object used by the treap_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If value_compare copy-constructor throws.
value_compare value_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns the priority_compare object used by the treap_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If priority_compare copy-constructor throws.
priority_compare priority_comp() const
{ return tree_.priority_comp(); }
//! <b>Effects</b>: Returns true if the container is empty.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return tree_.empty(); }
//! <b>Effects</b>: Returns the number of elements stored in the treap_set.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this if,
//! constant-time size option is enabled. Constant-time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{ return tree_.size(); }
//! <b>Effects</b>: Swaps the contents of two sets.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the swap() call for the comparison functor
//! found using ADL throws. Strong guarantee.
void swap(treap_set_impl& other)
@@ -399,22 +399,22 @@ class treap_set_impl
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const treap_set_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Tries to inserts value into the treap_set.
//!
//! <b>Returns</b>: If the value
@@ -422,43 +422,43 @@ class treap_set_impl
//! iterator to the new value and true. If there is an equivalent value
//! returns a pair containing an iterator to the already present value
//! and false.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare or priority_compare ordering function throw.
//! Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
std::pair<iterator, bool> insert(reference value)
{ return tree_.insert_unique(value); }
//! <b>Requires</b>: value must be an lvalue
- //!
- //! <b>Effects</b>: Tries to to insert x into the treap_set, using "hint"
+ //!
+ //! <b>Effects</b>: Tries to to insert x into the treap_set, using "hint"
//! as a hint to where it will be inserted.
//!
- //! <b>Returns</b>: An iterator that points to the position where the
+ //! <b>Returns</b>: An iterator that points to the position where the
//! new element was inserted into the treap_set.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it's amortized
//! constant time if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare or priority_compare ordering
//! functions throw. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert(const_iterator hint, reference value)
{ return tree_.insert_unique(hint, value); }
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare.
- //! key_value_pcomp must be a comparison function that induces
+ //! key_value_pcomp must be a comparison function that induces
//! the same strict weak ordering as priority_compare. The difference is that
//! key_value_pcomp and key_value_comp compare an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the treap_set, using
//! a user provided key instead of the value itself.
//!
@@ -467,17 +467,17 @@ class treap_set_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is at most logarithmic.
//!
//! <b>Throws</b>: If key_value_comp or key_value_pcomp ordering function throw.
//! Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! node that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that
+ //! than the value_type and this function offers the possibility to use that
//! part to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
@@ -492,14 +492,14 @@ class treap_set_impl
, insert_commit_data &commit_data)
{ return tree_.insert_unique_check(key, key_value_comp, key_value_pcomp, commit_data); }
- //! <b>Requires</b>: key_value_comp must be a comparison function that induces
+ //! <b>Requires</b>: key_value_comp must be a comparison function that induces
//! the same strict weak ordering as value_compare.
- //! key_value_pcomp must be a comparison function that induces
+ //! key_value_pcomp must be a comparison function that induces
//! the same strict weak ordering as priority_compare. The difference is that
//! key_value_pcomp and key_value_comp compare an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the treap_set, using
- //! a user provided key instead of the value itself, using "hint"
+ //! a user provided key instead of the value itself, using "hint"
//! as a hint to where it will be inserted.
//!
//! <b>Returns</b>: If there is an equivalent value
@@ -507,24 +507,24 @@ class treap_set_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it's amortized
//! constant time if t is inserted immediately before hint.
//!
//! <b>Throws</b>: If key_value_comp or key_value_pcomp ordering function throw.
//! Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
//! constructing that is used to impose the order is much cheaper to construct
- //! than the value_type and this function offers the possibility to use that key
+ //! than the value_type and this function offers the possibility to use that key
//! to check if the insertion will be successful.
//!
//! If the check is successful, the user can construct the value_type and use
//! "insert_commit" to insert the object in constant-time. This can give a total
//! constant-time complexity to the insertion: check(O(1)) + commit(O(1)).
- //!
+ //!
//! "commit_data" remains valid for a subsequent "insert_commit" only if no more
//! objects are inserted or erased from the treap_set.
template<class KeyType, class KeyValueCompare, class KeyValuePriorityCompare>
@@ -538,34 +538,34 @@ class treap_set_impl
//! must have been obtained from a previous call to "insert_check".
//! No objects should have been inserted or erased from the treap_set between
//! the "insert_check" that filled "commit_data" and the call to "insert_commit".
- //!
+ //!
//! <b>Effects</b>: Inserts the value in the treap_set using the information obtained
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Returns</b>: An iterator to the newly inserted object.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function has only sense if a "insert_check" has been
//! previously executed to fill "commit_data". No value should be inserted or
//! erased between the "insert_check" and "insert_commit" calls.
iterator insert_commit(reference value, const insert_commit_data &commit_data)
{ return tree_.insert_unique_commit(value, commit_data); }
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Inserts a range into the treap_set.
- //!
+ //!
//! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
//! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare or priority_compare ordering function
//! throw. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -578,11 +578,11 @@ class treap_set_impl
//! inserted key according to the predicate.
//!
//! <b>Effects</b>: Inserts x into the treap before "pos".
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: If the internal priority_compare function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if "pos" is not
//! the successor of "value" treap ordering invariant will be broken.
//! This is a low-level function to be used only for performance reasons
@@ -594,11 +594,11 @@ class treap_set_impl
//! any inserted key according to the predicate.
//!
//! <b>Effects</b>: Inserts x into the treap in the last position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: If the internal priority_compare function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! less than the greatest inserted key treap ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -611,11 +611,11 @@ class treap_set_impl
//! than any inserted key according to the predicate.
//!
//! <b>Effects</b>: Inserts x into the treap in the first position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: If the internal priority_compare function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! greater than the minimum inserted key treap ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -624,42 +624,42 @@ class treap_set_impl
void push_front(reference value)
{ tree_.push_front(value); }
- //! <b>Effects</b>: Erases the element pointed to by pos.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by pos.
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Returns</b>: An iterator to the element after the erased element.
//!
//! <b>Throws</b>: If the internal priority_compare function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator i)
{ return tree_.erase(i); }
- //! <b>Effects</b>: Erases the range pointed to by b end e.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Returns</b>: An iterator to the element after the erased elements.
- //!
+ //!
//! <b>Throws</b>: If the internal priority_compare function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator b, const_iterator e)
{ return tree_.erase(b, e); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size()) + this->count(value)).
- //!
+ //!
//! <b>Throws</b>: If internal value_compare or priority_compare
//! ordering functions throw. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
@@ -667,14 +667,14 @@ class treap_set_impl
//! <b>Effects</b>: Erases all the elements that compare equal with
//! the given key and the given comparison functor.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If comp or internal priority_compare
//! ordering functions throw. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyValueCompare>
@@ -687,16 +687,16 @@ class treap_set_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Erases the element pointed to by pos.
+ //! <b>Effects</b>: Erases the element pointed to by pos.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Returns</b>: An iterator to the element after the erased element.
- //!
+ //!
//! <b>Throws</b>: If the internal priority_compare function throws. Strong guarantee.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
@@ -712,14 +712,14 @@ class treap_set_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Returns</b>: An iterator to the element after the erased elements.
- //!
+ //!
//! <b>Throws</b>: If the internal priority_compare function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -730,13 +730,13 @@ class treap_set_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(value)). Basic guarantee.
- //!
+ //!
//! <b>Throws</b>: If the internal priority_compare function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -750,12 +750,12 @@ class treap_set_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If comp or internal priority_compare ordering functions throw.
//! Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyValueCompare, class Disposer>
@@ -767,26 +767,26 @@ class treap_set_impl
{ return tree_.erase_and_dispose(key, comp, disposer); }
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
{ return tree_.clear(); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
- //!
+ //!
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -794,20 +794,20 @@ class treap_set_impl
{ return tree_.clear_and_dispose(disposer); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
size_type count(const_reference value) const
{ return tree_.find(value) != end(); }
//! <b>Effects</b>: Returns the number of contained elements with the same key
//! compared with the given comparison functor.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
template<class KeyType, class KeyValueCompare>
size_type count(const KeyType& key, KeyValueCompare comp) const
@@ -815,9 +815,9 @@ class treap_set_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator lower_bound(const_reference value)
{ return tree_.lower_bound(value); }
@@ -827,13 +827,13 @@ class treap_set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -843,9 +843,9 @@ class treap_set_impl
//! <b>Effects</b>: Returns a const iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator lower_bound(const_reference value) const
{ return tree_.lower_bound(value); }
@@ -855,13 +855,13 @@ class treap_set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -871,9 +871,9 @@ class treap_set_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator upper_bound(const_reference value)
{ return tree_.upper_bound(value); }
@@ -883,11 +883,11 @@ class treap_set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -899,9 +899,9 @@ class treap_set_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator upper_bound(const_reference value) const
{ return tree_.upper_bound(value); }
@@ -911,11 +911,11 @@ class treap_set_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -925,11 +925,11 @@ class treap_set_impl
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const
{ return tree_.upper_bound(key, comp); }
- //! <b>Effects</b>: Finds an iterator to the first element whose value is
+ //! <b>Effects</b>: Finds an iterator to the first element whose value is
//! "value" or end() if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator find(const_reference value)
{ return tree_.find(value); }
@@ -938,12 +938,12 @@ class treap_set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -953,11 +953,11 @@ class treap_set_impl
iterator find(const KeyType& key, KeyValueCompare comp)
{ return tree_.find(key, comp); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
//! "value" or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator find(const_reference value) const
{ return tree_.find(value); }
@@ -966,12 +966,12 @@ class treap_set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -984,9 +984,9 @@ class treap_set_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return tree_.equal_range(value); }
@@ -995,13 +995,13 @@ class treap_set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1014,9 +1014,9 @@ class treap_set_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<const_iterator, const_iterator>
equal_range(const_reference value) const
@@ -1026,13 +1026,13 @@ class treap_set_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1043,16 +1043,101 @@ class treap_set_impl
equal_range(const KeyType& key, KeyValueCompare comp) const
{ return tree_.equal_range(key, comp); }
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator, const_iterator>
+ bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator, const_iterator>
+ bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: value must be an lvalue and shall be in a treap_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the treap_set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
@@ -1060,14 +1145,14 @@ class treap_set_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a treap_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! treap_set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static const_iterator s_iterator_to(const_reference value)
@@ -1075,48 +1160,48 @@ class treap_set_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a treap_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the treap_set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator iterator_to(reference value)
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value must be an lvalue and shall be in a treap_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! treap_set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator iterator_to(const_reference value) const
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value shall not be in a treap_set/treap_multiset.
- //!
+ //!
//! <b>Effects</b>: init_node puts the hook of a value in a well-known default
//! state.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This function puts the hook in the well-known default state
//! used by auto_unlink and safe hooks.
static void init_node(reference value)
{ tree_type::init_node(value); }
//! <b>Effects</b>: Unlinks the leftmost node from the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! This function is normally used to achieve a step by step
@@ -1126,14 +1211,14 @@ class treap_set_impl
//! <b>Requires</b>: replace_this must be a valid iterator of *this
//! and with_this must not be inserted in any tree.
- //!
+ //!
//! <b>Effects</b>: Replaces replace_this in its position in the
//! tree with with_this. The tree does not need to be rebalanced.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! with_this is not equivalent to *replace_this according to the
//! ordering rules. This function is faster than erasing and inserting
@@ -1142,21 +1227,21 @@ class treap_set_impl
{ tree_.replace_node(replace_this, with_this); }
//! <b>Effects</b>: Rebalances the tree.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear.
void rebalance()
{ tree_.rebalance(); }
//! <b>Requires</b>: old_root is a node of a tree.
- //!
+ //!
//! <b>Effects</b>: Rebalances the subtree rooted at old_root.
//!
//! <b>Returns</b>: The new root of the subtree.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements in the subtree.
iterator rebalance_subtree(iterator root)
{ return tree_.rebalance_subtree(root); }
@@ -1164,18 +1249,18 @@ class treap_set_impl
//! <b>Returns</b>: The balance factor (alpha) used in this tree
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
float balance_factor() const
{ return tree_.balance_factor(); }
//! <b>Requires</b>: new_alpha must be a value between 0.5 and 1.0
- //!
+ //!
//! <b>Effects</b>: Establishes a new balance factor (alpha) and rebalances
//! the tree if the new balance factor is stricter (less) than the old factor.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements in the subtree.
void balance_factor(float new_alpha)
{ tree_.balance_factor(new_alpha); }
@@ -1266,7 +1351,7 @@ struct make_treap_set
{
/// @cond
typedef treap_set_impl
- < typename make_treap_opt<T,
+ < typename make_treap_opt<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1286,7 +1371,7 @@ template<class T, class O1, class O2, class O3, class O4>
template<class T, class ...Options>
#endif
class treap_set
- : public make_treap_set<T,
+ : public make_treap_set<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1295,7 +1380,7 @@ class treap_set
>::type
{
typedef typename make_treap_set
- <T,
+ <T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -1350,9 +1435,9 @@ class treap_set
#endif
-//! The class template treap_multiset is an intrusive container, that mimics most of
+//! The class template treap_multiset is an intrusive container, that mimics most of
//! the interface of std::treap_multiset as described in the C++ standard.
-//!
+//!
//! The template parameter \c T is the type to be managed by the container.
//! The user can specify additional options and if no options are provided
//! default options are used.
@@ -1406,31 +1491,31 @@ class treap_multiset_impl
/// @endcond
public:
- //! <b>Effects</b>: Constructs an empty treap_multiset.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //! <b>Effects</b>: Constructs an empty treap_multiset.
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor of the value_compare/priority_compare objects throw.
+ //! or the copy constructor of the value_compare/priority_compare objects throw.
treap_multiset_impl( const value_compare &cmp = value_compare()
, const priority_compare &pcmp = priority_compare()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: tree_(cmp, pcmp, v_traits)
{}
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
//! cmp must be a comparison function that induces a strict weak ordering.
- //!
- //! <b>Effects</b>: Constructs an empty treap_multiset and inserts elements from
+ //!
+ //! <b>Effects</b>: Constructs an empty treap_multiset and inserts elements from
//! [b, e).
- //!
+ //!
//! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
//! comp and otherwise N * log N, where N is the distance between first and last
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor/operator() of the value_compare/priority_compare objects throw.
+ //! or the copy constructor/operator() of the value_compare/priority_compare objects throw.
template<class Iterator>
treap_multiset_impl( Iterator b, Iterator e
, const value_compare &cmp = value_compare()
@@ -1440,186 +1525,186 @@ class treap_multiset_impl
{}
//! <b>Effects</b>: to-do
- //!
- treap_multiset_impl(BOOST_RV_REF(treap_multiset_impl) x)
+ //!
+ treap_multiset_impl(BOOST_RV_REF(treap_multiset_impl) x)
: tree_(::boost::move(x.tree_))
{}
//! <b>Effects</b>: to-do
- //!
- treap_multiset_impl& operator=(BOOST_RV_REF(treap_multiset_impl) x)
+ //!
+ treap_multiset_impl& operator=(BOOST_RV_REF(treap_multiset_impl) x)
{ tree_ = ::boost::move(x.tree_); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the treap_multiset
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the treap_multiset
//! are not deleted (i.e. no destructors are called).
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- ~treap_multiset_impl()
+ ~treap_multiset_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return tree_.begin(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the beginning of the treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return tree_.cbegin(); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return tree_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return tree_.cend(); }
//! <b>Effects</b>: Returns an iterator pointing to the highest priority object of the tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator top()
{ return tree_.top(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the highest priority object of the tree..
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator top() const
{ return this->ctop(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the highest priority object of the tree..
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator ctop() const
{ return tree_.ctop(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning of the
//! reversed treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rbegin()
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rbegin() const
{ return tree_.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crbegin() const
{ return tree_.crbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rend()
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rend() const
{ return tree_.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crend() const
{ return tree_.crend(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the highest priority object of the
//! reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
reverse_iterator rtop()
{ return tree_.rtop(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the highest priority objec
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator rtop() const
{ return tree_.crtop(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the highest priority object
//! of the reversed tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_reverse_iterator crtop() const
{ return tree_.crtop(); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! of treap_multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the treap_multiset associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static treap_multiset_impl &container_from_end_iterator(iterator end_iterator)
{
@@ -1630,11 +1715,11 @@ class treap_multiset_impl
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of treap_multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the treap_multiset associated to the end iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const treap_multiset_impl &container_from_end_iterator(const_iterator end_iterator)
{
@@ -1644,11 +1729,11 @@ class treap_multiset_impl
}
//! <b>Precondition</b>: it must be a valid iterator of multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the multiset associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static treap_multiset_impl &container_from_iterator(iterator it)
{
@@ -1658,11 +1743,11 @@ class treap_multiset_impl
}
//! <b>Precondition</b>: it must be a valid const_iterator of multiset.
- //!
+ //!
//! <b>Effects</b>: Returns a const reference to the multiset associated to the iterator
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
static const treap_multiset_impl &container_from_iterator(const_iterator it)
{
@@ -1672,50 +1757,50 @@ class treap_multiset_impl
}
//! <b>Effects</b>: Returns the key_compare object used by the treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If key_compare copy-constructor throws.
key_compare key_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns the value_compare object used by the treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If value_compare copy-constructor throws.
value_compare value_comp() const
{ return tree_.value_comp(); }
//! <b>Effects</b>: Returns the priority_compare object used by the treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If priority_compare copy-constructor throws.
priority_compare priority_comp() const
{ return tree_.priority_comp(); }
//! <b>Effects</b>: Returns true if the container is empty.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return tree_.empty(); }
//! <b>Effects</b>: Returns the number of elements stored in the treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this if,
//! constant-time size option is enabled. Constant-time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{ return tree_.size(); }
//! <b>Effects</b>: Swaps the contents of two treap_multisets.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the swap() call for the comparison functor
//! found using ADL throws. Strong guarantee.
void swap(treap_multiset_impl& other)
@@ -1725,72 +1810,72 @@ class treap_multiset_impl
//! Cloner should yield to nodes equivalent to the original nodes.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. Copies the predicate from the source container.
//!
//! If cloner throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
template <class Cloner, class Disposer>
void clone_from(const treap_multiset_impl &src, Cloner cloner, Disposer disposer)
{ tree_.clone_from(src.tree_, cloner, disposer); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts value into the treap_multiset.
- //!
+ //!
//! <b>Returns</b>: An iterator that points to the position where the new
//! element was inserted.
- //!
+ //!
//! <b>Complexity</b>: Average complexity for insert element is at
//! most logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare or priority_compare ordering
//! function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert(reference value)
{ return tree_.insert_equal(value); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts x into the treap_multiset, using pos as a hint to
//! where it will be inserted.
- //!
+ //!
//! <b>Returns</b>: An iterator that points to the position where the new
//! element was inserted.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
//! constant time if t is inserted immediately before hint.
- //!
+ //!
//! <b>Throws</b>: If internal value_compare or priority_compare ordering functions throw.
//! Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert(const_iterator hint, reference value)
{ return tree_.insert_equal(hint, value); }
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Inserts a range into the treap_multiset.
- //!
+ //!
//! <b>Returns</b>: An iterator that points to the position where the new
//! element was inserted.
- //!
+ //!
//! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
//! size of the range. However, it is linear in N if the range is already sorted
//! by value_comp().
- //!
+ //!
//! <b>Throws</b>: If internal value_compare or priority_compare ordering functions throw.
//! Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
@@ -1802,11 +1887,11 @@ class treap_multiset_impl
//! once inserted according to the predicate
//!
//! <b>Effects</b>: Inserts x into the treap before "pos".
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: If the internal priority_compare function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if "pos" is not
//! the successor of "value" treap ordering invariant will be broken.
//! This is a low-level function to be used only for performance reasons
@@ -1818,11 +1903,11 @@ class treap_multiset_impl
//! than the greatest inserted key.
//!
//! <b>Effects</b>: Inserts x into the treap in the last position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: If the internal priority_compare function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! less than the greatest inserted key treap ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -1835,11 +1920,11 @@ class treap_multiset_impl
//! than the minimum inserted key
//!
//! <b>Effects</b>: Inserts x into the treap in the first position.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Throws</b>: If the internal priority_compare function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: This function does not check preconditions so if value is
//! greater than the minimum inserted key treap ordering invariant will be broken.
//! This function is slightly more efficient than using "insert_before".
@@ -1848,42 +1933,42 @@ class treap_multiset_impl
void push_front(reference value)
{ tree_.push_front(value); }
- //! <b>Effects</b>: Erases the element pointed to by pos.
- //!
- //! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by pos.
+ //!
+ //! <b>Complexity</b>: Average complexity is constant time.
+ //!
//! <b>Returns</b>: An iterator to the element after the erased element.
//!
//! <b>Throws</b>: If the internal priority_compare function throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator i)
{ return tree_.erase(i); }
- //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
//!
//! <b>Returns</b>: An iterator to the element after the erased elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: If the internal priority_compare function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator b, const_iterator e)
{ return tree_.erase(b, e); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(value)).
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare or priority_compare ordering
//! functiona throw. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
@@ -1891,13 +1976,13 @@ class treap_multiset_impl
//! <b>Effects</b>: Erases all the elements that compare equal with
//! the given key and the given comparison functor.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If comp or internal priority_compare ordering functions throw. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyValueCompare>
@@ -1912,14 +1997,14 @@ class treap_multiset_impl
//!
//! <b>Returns</b>: An iterator to the element after the erased element.
//!
- //! <b>Effects</b>: Erases the element pointed to by pos.
+ //! <b>Effects</b>: Erases the element pointed to by pos.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
- //! <b>Complexity</b>: Average complexity for erase element is constant time.
- //!
+ //!
+ //! <b>Complexity</b>: Average complexity for erase element is constant time.
+ //!
//! <b>Throws</b>: If the internal priority_compare function throws. Strong guarantee.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
@@ -1937,12 +2022,12 @@ class treap_multiset_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
- //! <b>Complexity</b>: Average complexity for erase range is at most
+ //!
+ //! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
- //!
+ //!
//! <b>Throws</b>: If the internal priority_compare function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -1953,13 +2038,13 @@ class treap_multiset_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(value)).
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -1973,11 +2058,11 @@ class treap_multiset_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: O(log(size() + this->count(key, comp)).
- //!
+ //!
//! <b>Throws</b>: If comp or internal priority_compare ordering functions throw. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyValueCompare, class Disposer>
@@ -1989,26 +2074,26 @@ class treap_multiset_impl
{ return tree_.erase_and_dispose(key, comp, disposer); }
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
{ return tree_.clear(); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
- //!
+ //!
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -2016,20 +2101,20 @@ class treap_multiset_impl
{ return tree_.clear_and_dispose(disposer); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
size_type count(const_reference value) const
{ return tree_.count(value); }
//! <b>Effects</b>: Returns the number of contained elements with the same key
//! compared with the given comparison functor.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic to the number of elements contained plus lineal
//! to number of objects with the given key.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
template<class KeyType, class KeyValueCompare>
size_type count(const KeyType& key, KeyValueCompare comp) const
@@ -2037,9 +2122,9 @@ class treap_multiset_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator lower_bound(const_reference value)
{ return tree_.lower_bound(value); }
@@ -2049,13 +2134,13 @@ class treap_multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -2065,9 +2150,9 @@ class treap_multiset_impl
//! <b>Effects</b>: Returns a const iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator lower_bound(const_reference value) const
{ return tree_.lower_bound(value); }
@@ -2077,13 +2162,13 @@ class treap_multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is not less than k or
+ //! key according to the comparison functor is not less than k or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
- //!
+ //!
//! <b>Note</b>: This function is used when constructing a value_type
//! is expensive and the value_type can be compared with a cheaper
//! key type. Usually this key is part of the value_type.
@@ -2093,9 +2178,9 @@ class treap_multiset_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator upper_bound(const_reference value)
{ return tree_.upper_bound(value); }
@@ -2105,11 +2190,11 @@ class treap_multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns an iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2121,9 +2206,9 @@ class treap_multiset_impl
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is greater than k or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator upper_bound(const_reference value) const
{ return tree_.upper_bound(value); }
@@ -2133,11 +2218,11 @@ class treap_multiset_impl
//! that is used in the ordering functor.
//!
//! <b>Effects</b>: Returns a const_iterator to the first element whose
- //! key according to the comparison functor is greater than key or
+ //! key according to the comparison functor is greater than key or
//! end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2147,11 +2232,11 @@ class treap_multiset_impl
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const
{ return tree_.upper_bound(key, comp); }
- //! <b>Effects</b>: Finds an iterator to the first element whose value is
+ //! <b>Effects</b>: Finds an iterator to the first element whose value is
//! "value" or end() if that element does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
iterator find(const_reference value)
{ return tree_.find(value); }
@@ -2160,12 +2245,12 @@ class treap_multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
//!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2175,11 +2260,11 @@ class treap_multiset_impl
iterator find(const KeyType& key, KeyValueCompare comp)
{ return tree_.find(key, comp); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose value is
//! "value" or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
const_iterator find(const_reference value) const
{ return tree_.find(value); }
@@ -2188,12 +2273,12 @@ class treap_multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
- //! "key" according to the comparison functor or end() if that element
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! "key" according to the comparison functor or end() if that element
//! does not exist.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2206,9 +2291,9 @@ class treap_multiset_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return tree_.equal_range(value); }
@@ -2217,13 +2302,13 @@ class treap_multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2236,9 +2321,9 @@ class treap_multiset_impl
//! <b>Effects</b>: Finds a range containing all elements whose key is k or
//! an empty range that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If the internal value_compare ordering function throws.
std::pair<const_iterator, const_iterator>
equal_range(const_reference value) const
@@ -2248,13 +2333,13 @@ class treap_multiset_impl
//! value_compare. Usually key is the part of the value_type
//! that is used in the ordering functor.
//!
- //! <b>Effects</b>: Finds a range containing all elements whose key is k
- //! according to the comparison functor or an empty range
+ //! <b>Effects</b>: Finds a range containing all elements whose key is k
+ //! according to the comparison functor or an empty range
//! that indicates the position where those elements would be
//! if they there is no elements with key k.
- //!
+ //!
//! <b>Complexity</b>: Logarithmic.
- //!
+ //!
//! <b>Throws</b>: If comp ordering function throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -2265,16 +2350,101 @@ class treap_multiset_impl
equal_range(const KeyType& key, KeyValueCompare comp) const
{ return tree_.equal_range(key, comp); }
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator, const_iterator>
+ bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator, const_iterator>
+ bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: value must be an lvalue and shall be in a treap_multiset of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the treap_multiset
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
@@ -2282,14 +2452,14 @@ class treap_multiset_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a treap_multiset of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! treap_multiset that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static const_iterator s_iterator_to(const_reference value)
@@ -2297,48 +2467,48 @@ class treap_multiset_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a treap_multiset of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator i belonging to the treap_multiset
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator iterator_to(reference value)
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value must be an lvalue and shall be in a treap_multiset of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
//! treap_multiset that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator iterator_to(const_reference value) const
{ return tree_.iterator_to(value); }
//! <b>Requires</b>: value shall not be in a treap_multiset/treap_multiset.
- //!
+ //!
//! <b>Effects</b>: init_node puts the hook of a value in a well-known default
//! state.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
- //!
+ //!
//! <b>Note</b>: This function puts the hook in the well-known default state
//! used by auto_unlink and safe hooks.
static void init_node(reference value)
{ tree_type::init_node(value); }
//! <b>Effects</b>: Unlinks the leftmost node from the tree.
- //!
+ //!
//! <b>Complexity</b>: Average complexity is constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function breaks the tree and the tree can
//! only be used for more unlink_leftmost_without_rebalance calls.
//! This function is normally used to achieve a step by step
@@ -2348,14 +2518,14 @@ class treap_multiset_impl
//! <b>Requires</b>: replace_this must be a valid iterator of *this
//! and with_this must not be inserted in any tree.
- //!
+ //!
//! <b>Effects</b>: Replaces replace_this in its position in the
//! tree with with_this. The tree does not need to be rebalanced.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This function will break container ordering invariants if
//! with_this is not equivalent to *replace_this according to the
//! ordering rules. This function is faster than erasing and inserting
@@ -2364,21 +2534,21 @@ class treap_multiset_impl
{ tree_.replace_node(replace_this, with_this); }
//! <b>Effects</b>: Rebalances the tree.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear.
void rebalance()
{ tree_.rebalance(); }
//! <b>Requires</b>: old_root is a node of a tree.
- //!
+ //!
//! <b>Effects</b>: Rebalances the subtree rooted at old_root.
//!
//! <b>Returns</b>: The new root of the subtree.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements in the subtree.
iterator rebalance_subtree(iterator root)
{ return tree_.rebalance_subtree(root); }
@@ -2386,18 +2556,18 @@ class treap_multiset_impl
//! <b>Returns</b>: The balance factor (alpha) used in this tree
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
float balance_factor() const
{ return tree_.balance_factor(); }
//! <b>Requires</b>: new_alpha must be a value between 0.5 and 1.0
- //!
+ //!
//! <b>Effects</b>: Establishes a new balance factor (alpha) and rebalances
//! the tree if the new balance factor is stricter (less) than the old factor.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements in the subtree.
void balance_factor(float new_alpha)
{ tree_.balance_factor(new_alpha); }
@@ -2488,7 +2658,7 @@ struct make_treap_multiset
{
/// @cond
typedef treap_multiset_impl
- < typename make_treap_opt<T,
+ < typename make_treap_opt<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -2508,7 +2678,7 @@ template<class T, class O1, class O2, class O3, class O4>
template<class T, class ...Options>
#endif
class treap_multiset
- : public make_treap_multiset<T,
+ : public make_treap_multiset<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -2517,7 +2687,7 @@ class treap_multiset
>::type
{
typedef typename make_treap_multiset
- <T,
+ <T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -2573,8 +2743,8 @@ class treap_multiset
#endif
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/trivial_value_traits.hpp b/boost/intrusive/trivial_value_traits.hpp
index c924022608..5c166fdaa1 100644
--- a/boost/intrusive/trivial_value_traits.hpp
+++ b/boost/intrusive/trivial_value_traits.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -40,7 +40,7 @@ struct trivial_value_traits
static const const_pointer &to_value_ptr(const const_node_ptr &n) { return n; }
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#endif //BOOST_INTRUSIVE_TRIVIAL_VALUE_TRAITS_HPP
diff --git a/boost/intrusive/unordered_set.hpp b/boost/intrusive/unordered_set.hpp
index 6407fcfa45..a06d74bf31 100644
--- a/boost/intrusive/unordered_set.hpp
+++ b/boost/intrusive/unordered_set.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -23,7 +23,7 @@
namespace boost {
namespace intrusive {
-//! The class template unordered_set is an intrusive container, that mimics most of
+//! The class template unordered_set is an intrusive container, that mimics most of
//! the interface of std::tr1::unordered_set as described in the C++ TR1.
//!
//! unordered_set is a semi-intrusive container: each object to be stored in the
@@ -113,73 +113,73 @@ class unordered_set_impl
//!
//! <b>Effects</b>: Constructs an empty unordered_set_impl, storing a reference
//! to the bucket array and copies of the hasher and equal functors.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor or invocation of Hash or Equal throws.
+ //! or the copy constructor or invocation of Hash or Equal throws.
//!
//! <b>Notes</b>: buckets array must be disposed only after
- //! *this is disposed.
+ //! *this is disposed.
unordered_set_impl( const bucket_traits &b_traits
, const hasher & hash_func = hasher()
, const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: table_(b_traits, hash_func, equal_func, v_traits)
{}
//! <b>Requires</b>: buckets must not be being used by any other resource
//! and Dereferencing iterator must yield an lvalue of type value_type.
- //!
- //! <b>Effects</b>: Constructs an empty unordered_set and inserts elements from
+ //!
+ //! <b>Effects</b>: Constructs an empty unordered_set and inserts elements from
//! [b, e).
- //!
+ //!
//! <b>Complexity</b>: If N is std::distance(b, e): Average case is O(N)
//! (with a good hash function and with buckets_len >= N),worst case O(N2).
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor or invocation of hasher or key_equal throws.
+ //! or the copy constructor or invocation of hasher or key_equal throws.
//!
//! <b>Notes</b>: buckets array must be disposed only after
- //! *this is disposed.
+ //! *this is disposed.
template<class Iterator>
unordered_set_impl( Iterator b
, Iterator e
, const bucket_traits &b_traits
, const hasher & hash_func = hasher()
, const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: table_(b_traits, hash_func, equal_func, v_traits)
{ table_.insert_unique(b, e); }
//! <b>Effects</b>: to-do
- //!
- unordered_set_impl(BOOST_RV_REF(unordered_set_impl) x)
+ //!
+ unordered_set_impl(BOOST_RV_REF(unordered_set_impl) x)
: table_(::boost::move(x.table_))
{}
//! <b>Effects</b>: to-do
- //!
- unordered_set_impl& operator=(BOOST_RV_REF(unordered_set_impl) x)
+ //!
+ unordered_set_impl& operator=(BOOST_RV_REF(unordered_set_impl) x)
{ table_ = ::boost::move(x.table_); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_set
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_set
//! are not deleted (i.e. no destructors are called).
- //!
- //! <b>Complexity</b>: Linear to the number of elements in the unordered_set, if
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in the unordered_set, if
//! it's a safe-mode or auto-unlink value. Otherwise constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- ~unordered_set_impl()
+ ~unordered_set_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the unordered_set.
- //!
+ //!
//! <b>Complexity</b>: Constant time if `cache_begin<>` is true. Amortized
//! constant time with worst case (empty unordered_set) O(this->bucket_count())
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return table_.begin(); }
@@ -189,7 +189,7 @@ class unordered_set_impl
//!
//! <b>Complexity</b>: Constant time if `cache_begin<>` is true. Amortized
//! constant time with worst case (empty unordered_set) O(this->bucket_count())
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return table_.begin(); }
@@ -199,76 +199,76 @@ class unordered_set_impl
//!
//! <b>Complexity</b>: Constant time if `cache_begin<>` is true. Amortized
//! constant time with worst case (empty unordered_set) O(this->bucket_count())
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return table_.cbegin(); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the unordered_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return table_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the unordered_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return table_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the unordered_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return table_.cend(); }
//! <b>Effects</b>: Returns the hasher object used by the unordered_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If hasher copy-constructor throws.
hasher hash_function() const
{ return table_.hash_function(); }
//! <b>Effects</b>: Returns the key_equal object used by the unordered_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If key_equal copy-constructor throws.
key_equal key_eq() const
{ return table_.key_eq(); }
//! <b>Effects</b>: Returns true if the container is empty.
- //!
+ //!
//! <b>Complexity</b>: if constant-time size and cache_last options are disabled,
//! average constant time (worst case, with empty() == true: O(this->bucket_count()).
//! Otherwise constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return table_.empty(); }
//! <b>Effects</b>: Returns the number of elements stored in the unordered_set.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this if
//! constant-time size option is disabled. Constant-time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{ return table_.size(); }
//! <b>Requires</b>: the hasher and the equality function unqualified swap
//! call should not throw.
- //!
+ //!
//! <b>Effects</b>: Swaps the contents of two unordered_sets.
//! Swaps also the contained bucket array and equality and hasher functors.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If the swap() call for the comparison or hash functors
@@ -281,7 +281,7 @@ class unordered_set_impl
//! hash than the original node.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. The hash function and the equality
//! predicate are copied from the source.
@@ -290,9 +290,9 @@ class unordered_set_impl
//!
//! If any operation throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner or hasher throw or hash or equality predicate copying
//! throws. Basic guarantee.
template <class Cloner, class Disposer>
@@ -300,7 +300,7 @@ class unordered_set_impl
{ table_.clone_from(src.table_, cloner, disposer); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Tries to inserts value into the unordered_set.
//!
//! <b>Returns</b>: If the value
@@ -308,40 +308,40 @@ class unordered_set_impl
//! iterator to the new value and true. If there is an equivalent value
//! returns a pair containing an iterator to the already present value
//! and false.
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
std::pair<iterator, bool> insert(reference value)
{ return table_.insert_unique(value); }
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Equivalent to this->insert(t) for each element in [b, e).
- //!
+ //!
//! <b>Complexity</b>: Average case O(N), where N is std::distance(b, e).
//! Worst case O(N*this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
void insert(Iterator b, Iterator e)
{ table_.insert_unique(b, e); }
- //! <b>Requires</b>: "hasher" must be a hash function that induces
+ //! <b>Requires</b>: "hasher" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hasher" hashes the given key instead of the value_type.
//!
- //! "key_value_equal" must be a equality function that induces
+ //! "key_value_equal" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "key_value_equal" compares an arbitrary key with the contained values.
- //!
+ //!
//! <b>Effects</b>: Checks if a value can be inserted in the unordered_set, using
//! a user provided key instead of the value itself.
//!
@@ -350,11 +350,11 @@ class unordered_set_impl
//! and false. If the value can be inserted returns true in the returned
//! pair boolean and fills "commit_data" that is meant to be used with
//! the "insert_commit" function.
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
//!
//! <b>Throws</b>: If hasher or key_value_equal throw. Strong guarantee.
- //!
+ //!
//! <b>Notes</b>: This function is used to improve performance when constructing
//! a value_type is expensive: if there is an equivalent value
//! the constructed object must be discarded. Many times, the part of the
@@ -378,16 +378,16 @@ class unordered_set_impl
//! must have been obtained from a previous call to "insert_check".
//! No objects should have been inserted or erased from the unordered_set between
//! the "insert_check" that filled "commit_data" and the call to "insert_commit".
- //!
+ //!
//! <b>Effects</b>: Inserts the value in the unordered_set using the information obtained
//! from the "commit_data" that a previous "insert_check" filled.
//!
//! <b>Returns</b>: An iterator to the newly inserted object.
- //!
+ //!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Notes</b>: This function has only sense if a "insert_check" has been
//! previously executed to fill "commit_data". No value should be inserted or
//! erased between the "insert_check" and "insert_commit" calls.
@@ -396,61 +396,61 @@ class unordered_set_impl
iterator insert_commit(reference value, const insert_commit_data &commit_data)
{ return table_.insert_unique_commit(value, commit_data); }
- //! <b>Effects</b>: Erases the element pointed to by i.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by i.
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased element. No destructors are called.
void erase(const_iterator i)
{ table_.erase(i); }
- //! <b>Effects</b>: Erases the range pointed to by b end e.
- //!
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //!
//! <b>Complexity</b>: Average case O(std::distance(b, e)),
//! worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void erase(const_iterator b, const_iterator e)
{ table_.erase(b, e); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
{ return table_.erase(value); }
- //! <b>Requires</b>: "hasher" must be a hash function that induces
+ //! <b>Requires</b>: "hasher" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hasher" hashes the given key instead of the value_type.
//!
- //! "key_value_equal" must be a equality function that induces
+ //! "key_value_equal" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "key_value_equal" compares an arbitrary key with the contained values.
//!
//! <b>Effects</b>: Erases all the elements that have the same hash and
//! compare equal with the given key.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If hash_func or equal_func throw. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyHasher, class KeyValueEqual>
@@ -459,14 +459,14 @@ class unordered_set_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Erases the element pointed to by i.
+ //! <b>Effects</b>: Erases the element pointed to by i.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
void erase_and_dispose(const_iterator i, Disposer disposer
@@ -480,12 +480,12 @@ class unordered_set_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Complexity</b>: Average case O(std::distance(b, e)),
//! worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -496,14 +496,14 @@ class unordered_set_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -517,39 +517,39 @@ class unordered_set_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If hash_func or equal_func throw. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyHasher, class KeyValueEqual, class Disposer>
size_type erase_and_dispose(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func, Disposer disposer)
{ return table_.erase_and_dispose(key, hash_func, equal_func, disposer); }
- //! <b>Effects</b>: Erases all of the elements.
- //!
+ //! <b>Effects</b>: Erases all of the elements.
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
{ return table_.clear(); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
- //!
- //! <b>Effects</b>: Erases all of the elements.
- //!
+ //!
+ //! <b>Effects</b>: Erases all of the elements.
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -557,25 +557,25 @@ class unordered_set_impl
{ return table_.clear_and_dispose(disposer); }
//! <b>Effects</b>: Returns the number of contained elements with the given value
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
size_type count(const_reference value) const
{ return table_.find(value) != end(); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "equal_func" must be a equality function that induces
+ //! "equal_func" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "equal_func" compares an arbitrary key with the contained values.
//!
//! <b>Effects</b>: Returns the number of contained elements with the given key
//!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If hash_func or equal_func throw.
template<class KeyType, class KeyHasher, class KeyValueEqual>
size_type count(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func) const
@@ -585,25 +585,25 @@ class unordered_set_impl
//! "value" or end() if that element does not exist.
//!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
iterator find(const_reference value)
{ return table_.find(value); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "equal_func" must be a equality function that induces
+ //! "equal_func" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "equal_func" compares an arbitrary key with the contained values.
//!
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
//! "key" according to the given hasher and equality functor or end() if
//! that element does not exist.
//!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If hash_func or equal_func throw.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -613,29 +613,29 @@ class unordered_set_impl
iterator find(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func)
{ return table_.find(key, hash_func, equal_func); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
//! "key" or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
const_iterator find(const_reference value) const
{ return table_.find(value); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "equal_func" must be a equality function that induces
+ //! "equal_func" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "equal_func" compares an arbitrary key with the contained values.
//!
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
//! "key" according to the given hasher and equality functor or end() if
//! that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If hash_func or equal_func throw.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -646,30 +646,30 @@ class unordered_set_impl
{ return table_.find(key, hash_func, equal_func); }
//! <b>Effects</b>: Returns a range containing all elements with values equivalent
- //! to value. Returns std::make_pair(this->end(), this->end()) if no such
+ //! to value. Returns std::make_pair(this->end(), this->end()) if no such
//! elements exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)). Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return table_.equal_range(value); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "equal_func" must be a equality function that induces
+ //! "equal_func" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "equal_func" compares an arbitrary key with the contained values.
//!
//! <b>Effects</b>: Returns a range containing all elements with equivalent
- //! keys. Returns std::make_pair(this->end(), this->end()) if no such
+ //! keys. Returns std::make_pair(this->end(), this->end()) if no such
//! elements exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(key, hash_func, hash_func)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If hash_func or the equal_func throw.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -680,31 +680,31 @@ class unordered_set_impl
{ return table_.equal_range(key, hash_func, equal_func); }
//! <b>Effects</b>: Returns a range containing all elements with values equivalent
- //! to value. Returns std::make_pair(this->end(), this->end()) if no such
+ //! to value. Returns std::make_pair(this->end(), this->end()) if no such
//! elements exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)). Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
std::pair<const_iterator, const_iterator>
equal_range(const_reference value) const
{ return table_.equal_range(value); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "equal_func" must be a equality function that induces
+ //! "equal_func" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "equal_func" compares an arbitrary key with the contained values.
//!
//! <b>Effects</b>: Returns a range containing all elements with equivalent
- //! keys. Returns std::make_pair(this->end(), this->end()) if no such
+ //! keys. Returns std::make_pair(this->end(), this->end()) if no such
//! elements exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(key, hash_func, equal_func)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the hash_func or equal_func throw.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -717,38 +717,38 @@ class unordered_set_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator belonging to the unordered_set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the internal hash function throws.
iterator iterator_to(reference value)
{ return table_.iterator_to(value); }
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator belonging to the
//! unordered_set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the internal hash function throws.
const_iterator iterator_to(const_reference value) const
{ return table_.iterator_to(value); }
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid local_iterator belonging to the unordered_set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static local_iterator s_local_iterator_to(reference value)
@@ -756,14 +756,14 @@ class unordered_set_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_local_iterator belonging to
//! the unordered_set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static const_local_iterator s_local_iterator_to(const_reference value)
@@ -771,33 +771,33 @@ class unordered_set_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid local_iterator belonging to the unordered_set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
local_iterator local_iterator_to(reference value)
{ return table_.local_iterator_to(value); }
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_local_iterator belonging to
//! the unordered_set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_local_iterator local_iterator_to(const_reference value) const
{ return table_.local_iterator_to(value); }
//! <b>Effects</b>: Returns the number of buckets passed in the constructor
//! or the last rehash function.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type bucket_count() const
{ return table_.bucket_count(); }
@@ -805,33 +805,33 @@ class unordered_set_impl
//! <b>Requires</b>: n is in the range [0, this->bucket_count()).
//!
//! <b>Effects</b>: Returns the number of elements in the nth bucket.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type bucket_size(size_type n) const
{ return table_.bucket_size(n); }
//! <b>Effects</b>: Returns the index of the bucket in which elements
//! with keys equivalent to k would be found, if any such element existed.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the hash functor throws.
//!
//! <b>Note</b>: the return value is in the range [0, this->bucket_count()).
size_type bucket(const value_type& k) const
{ return table_.bucket(k); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
//! <b>Effects</b>: Returns the index of the bucket in which elements
//! with keys equivalent to k would be found, if any such element existed.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If hash_func throws.
//!
//! <b>Note</b>: the return value is in the range [0, this->bucket_count()).
@@ -841,9 +841,9 @@ class unordered_set_impl
//! <b>Effects</b>: Returns the bucket array pointer passed in the constructor
//! or the last rehash function.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bucket_ptr bucket_pointer() const
{ return table_.bucket_pointer(); }
@@ -852,13 +852,13 @@ class unordered_set_impl
//!
//! <b>Effects</b>: Returns a local_iterator pointing to the beginning
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
local_iterator begin(size_type n)
{ return table_.begin(n); }
@@ -866,13 +866,13 @@ class unordered_set_impl
//!
//! <b>Effects</b>: Returns a const_local_iterator pointing to the beginning
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
const_local_iterator begin(size_type n) const
{ return table_.begin(n); }
@@ -880,13 +880,13 @@ class unordered_set_impl
//!
//! <b>Effects</b>: Returns a const_local_iterator pointing to the beginning
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
const_local_iterator cbegin(size_type n) const
{ return table_.cbegin(n); }
@@ -894,13 +894,13 @@ class unordered_set_impl
//!
//! <b>Effects</b>: Returns a local_iterator pointing to the end
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
local_iterator end(size_type n)
{ return table_.end(n); }
@@ -908,13 +908,13 @@ class unordered_set_impl
//!
//! <b>Effects</b>: Returns a const_local_iterator pointing to the end
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
const_local_iterator end(size_type n) const
{ return table_.end(n); }
@@ -922,13 +922,13 @@ class unordered_set_impl
//!
//! <b>Effects</b>: Returns a const_local_iterator pointing to the end
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
const_local_iterator cend(size_type n) const
{ return table_.cend(n); }
@@ -938,22 +938,22 @@ class unordered_set_impl
//! n can be bigger or smaller than this->bucket_count().
//!
//! <b>Effects</b>: Updates the internal reference with the new bucket erases
- //! the values from the old bucket and inserts then in the new one.
+ //! the values from the old bucket and inserts then in the new one.
//!
//! If store_hash option is true, this method does not use the hash function.
- //!
+ //!
//! <b>Complexity</b>: Average case linear in this->size(), worst case quadratic.
- //!
+ //!
//! <b>Throws</b>: If the hasher functor throws. Basic guarantee.
void rehash(const bucket_traits &new_bucket_traits)
{ table_.rehash(new_bucket_traits); }
//! <b>Requires</b>:
//!
- //! <b>Effects</b>:
- //!
- //! <b>Complexity</b>:
- //!
+ //! <b>Effects</b>:
+ //!
+ //! <b>Complexity</b>:
+ //!
//! <b>Throws</b>:
//!
//! <b>Note</b>: this method is only available if incremental<true> option is activated.
@@ -966,22 +966,22 @@ class unordered_set_impl
//! <b>Requires</b>:
//!
- //! <b>Effects</b>:
- //!
- //! <b>Complexity</b>:
- //!
- //! <b>Throws</b>:
+ //! <b>Effects</b>:
+ //!
+ //! <b>Complexity</b>:
+ //!
+ //! <b>Throws</b>:
size_type split_count() const
{ return table_.split_count(); }
//! <b>Effects</b>: Returns the nearest new bucket count optimized for
//! the container that is bigger than n. This suggestion can be used
//! to create bucket arrays with a size that will usually improve
- //! container's performance. If such value does not exist, the
+ //! container's performance. If such value does not exist, the
//! higher possible value is returned.
- //!
+ //!
//! <b>Complexity</b>: Amortized constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static size_type suggested_upper_bucket_count(size_type n)
{ return table_type::suggested_upper_bucket_count(n); }
@@ -989,11 +989,11 @@ class unordered_set_impl
//! <b>Effects</b>: Returns the nearest new bucket count optimized for
//! the container that is smaller than n. This suggestion can be used
//! to create bucket arrays with a size that will usually improve
- //! container's performance. If such value does not exist, the
+ //! container's performance. If such value does not exist, the
//! lower possible value is returned.
- //!
+ //!
//! <b>Complexity</b>: Amortized constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static size_type suggested_lower_bucket_count(size_type n)
{ return table_type::suggested_lower_bucket_count(n); }
@@ -1016,7 +1016,7 @@ struct make_unordered_set
/// @cond
typedef unordered_set_impl
< typename make_hashtable_opt
- <T, true,
+ <T, true,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
#else
@@ -1036,7 +1036,7 @@ template<class T, class O1, class O2, class O3, class O4, class O5, class O6, cl
template<class T, class ...Options>
#endif
class unordered_set
- : public make_unordered_set<T,
+ : public make_unordered_set<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
#else
@@ -1045,7 +1045,7 @@ class unordered_set
>::type
{
typedef typename make_unordered_set
- <T,
+ <T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
#else
@@ -1070,7 +1070,7 @@ class unordered_set
unordered_set ( const bucket_traits &b_traits
, const hasher & hash_func = hasher()
, const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: Base(b_traits, hash_func, equal_func, v_traits)
{}
@@ -1080,7 +1080,7 @@ class unordered_set
, const bucket_traits &b_traits
, const hasher & hash_func = hasher()
, const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: Base(b, e, b_traits, hash_func, equal_func, v_traits)
{}
@@ -1095,7 +1095,7 @@ class unordered_set
#endif
-//! The class template unordered_multiset is an intrusive container, that mimics most of
+//! The class template unordered_multiset is an intrusive container, that mimics most of
//! the interface of std::tr1::unordered_multiset as described in the C++ TR1.
//!
//! unordered_multiset is a semi-intrusive container: each object to be stored in the
@@ -1184,34 +1184,34 @@ class unordered_multiset_impl
//!
//! <b>Effects</b>: Constructs an empty unordered_multiset, storing a reference
//! to the bucket array and copies of the hasher and equal functors.
- //!
- //! <b>Complexity</b>: Constant.
- //!
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor or invocation of Hash or Equal throws.
+ //! or the copy constructor or invocation of Hash or Equal throws.
//!
//! <b>Notes</b>: buckets array must be disposed only after
- //! *this is disposed.
+ //! *this is disposed.
unordered_multiset_impl ( const bucket_traits &b_traits
, const hasher & hash_func = hasher()
, const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: table_(b_traits, hash_func, equal_func, v_traits)
{}
//! <b>Requires</b>: buckets must not be being used by any other resource
//! and Dereferencing iterator must yield an lvalue of type value_type.
- //!
- //! <b>Effects</b>: Constructs an empty unordered_multiset and inserts elements from
+ //!
+ //! <b>Effects</b>: Constructs an empty unordered_multiset and inserts elements from
//! [b, e).
- //!
+ //!
//! <b>Complexity</b>: If N is std::distance(b, e): Average case is O(N)
//! (with a good hash function and with buckets_len >= N),worst case O(N2).
- //!
+ //!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or the copy constructor or invocation of hasher or key_equal throws.
+ //! or the copy constructor or invocation of hasher or key_equal throws.
//!
//! <b>Notes</b>: buckets array must be disposed only after
//! *this is disposed.
@@ -1221,36 +1221,36 @@ class unordered_multiset_impl
, const bucket_traits &b_traits
, const hasher & hash_func = hasher()
, const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: table_(b_traits, hash_func, equal_func, v_traits)
{ table_.insert_equal(b, e); }
//! <b>Effects</b>: to-do
- //!
- unordered_multiset_impl(BOOST_RV_REF(unordered_multiset_impl) x)
+ //!
+ unordered_multiset_impl(BOOST_RV_REF(unordered_multiset_impl) x)
: table_(::boost::move(x.table_))
{}
//! <b>Effects</b>: to-do
- //!
- unordered_multiset_impl& operator=(BOOST_RV_REF(unordered_multiset_impl) x)
+ //!
+ unordered_multiset_impl& operator=(BOOST_RV_REF(unordered_multiset_impl) x)
{ table_ = ::boost::move(x.table_); return *this; }
- //! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_multiset
+ //! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_multiset
//! are not deleted (i.e. no destructors are called).
- //!
- //! <b>Complexity</b>: Linear to the number of elements in the unordered_multiset, if
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in the unordered_multiset, if
//! it's a safe-mode or auto-unlink value. Otherwise constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- ~unordered_multiset_impl()
+ ~unordered_multiset_impl()
{}
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the unordered_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant time if `cache_begin<>` is true. Amortized
//! constant time with worst case (empty unordered_set) O(this->bucket_count())
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator begin()
{ return table_.begin(); }
@@ -1260,7 +1260,7 @@ class unordered_multiset_impl
//!
//! <b>Complexity</b>: Constant time if `cache_begin<>` is true. Amortized
//! constant time with worst case (empty unordered_set) O(this->bucket_count())
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator begin() const
{ return table_.begin(); }
@@ -1270,77 +1270,77 @@ class unordered_multiset_impl
//!
//! <b>Complexity</b>: Constant time if `cache_begin<>` is true. Amortized
//! constant time with worst case (empty unordered_set) O(this->bucket_count())
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cbegin() const
{ return table_.cbegin(); }
//! <b>Effects</b>: Returns an iterator pointing to the end of the unordered_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
iterator end()
{ return table_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the unordered_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator end() const
{ return table_.end(); }
//! <b>Effects</b>: Returns a const_iterator pointing to the end of the unordered_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_iterator cend() const
{ return table_.cend(); }
//! <b>Effects</b>: Returns the hasher object used by the unordered_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If hasher copy-constructor throws.
hasher hash_function() const
{ return table_.hash_function(); }
//! <b>Effects</b>: Returns the key_equal object used by the unordered_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If key_equal copy-constructor throws.
key_equal key_eq() const
{ return table_.key_eq(); }
//! <b>Effects</b>: Returns true if the container is empty.
- //!
+ //!
//! <b>Complexity</b>: if constant-time size and cache_last options are disabled,
//! average constant time (worst case, with empty() == true: O(this->bucket_count()).
//! Otherwise constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bool empty() const
{ return table_.empty(); }
//! <b>Effects</b>: Returns the number of elements stored in the unordered_multiset.
- //!
+ //!
//! <b>Complexity</b>: Linear to elements contained in *this if
//! constant-time size option is disabled. Constant-time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type size() const
{ return table_.size(); }
//! <b>Requires</b>: the hasher and the equality function unqualified swap
//! call should not throw.
- //!
+ //!
//! <b>Effects</b>: Swaps the contents of two unordered_multisets.
//! Swaps also the contained bucket array and equality and hasher functors.
//!
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If the swap() call for the comparison or hash functors
@@ -1353,7 +1353,7 @@ class unordered_multiset_impl
//! hash than the original node.
//!
//! <b>Effects</b>: Erases all the elements from *this
- //! calling Disposer::operator()(pointer), clones all the
+ //! calling Disposer::operator()(pointer), clones all the
//! elements from src calling Cloner::operator()(const_reference )
//! and inserts them on *this. The hash function and the equality
//! predicate are copied from the source.
@@ -1362,9 +1362,9 @@ class unordered_multiset_impl
//!
//! If any operation throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
- //!
+ //!
//! <b>Throws</b>: If cloner or hasher throw or hash or equality predicate copying
//! throws. Basic guarantee.
template <class Cloner, class Disposer>
@@ -1372,92 +1372,92 @@ class unordered_multiset_impl
{ table_.clone_from(src.table_, cloner, disposer); }
//! <b>Requires</b>: value must be an lvalue
- //!
+ //!
//! <b>Effects</b>: Inserts value into the unordered_multiset.
//!
//! <b>Returns</b>: An iterator to the new inserted value.
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws. Strong guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
iterator insert(reference value)
{ return table_.insert_equal(value); }
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
//! of type value_type.
- //!
+ //!
//! <b>Effects</b>: Equivalent to this->insert(t) for each element in [b, e).
- //!
+ //!
//! <b>Complexity</b>: Average case is O(N), where N is the
//! size of the range.
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! No copy-constructors are called.
template<class Iterator>
void insert(Iterator b, Iterator e)
{ table_.insert_equal(b, e); }
- //! <b>Effects</b>: Erases the element pointed to by i.
- //!
+ //! <b>Effects</b>: Erases the element pointed to by i.
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased element. No destructors are called.
void erase(const_iterator i)
{ table_.erase(i); }
- //! <b>Effects</b>: Erases the range pointed to by b end e.
- //!
+ //! <b>Effects</b>: Erases the range pointed to by b end e.
+ //!
//! <b>Complexity</b>: Average case O(std::distance(b, e)),
//! worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void erase(const_iterator b, const_iterator e)
{ table_.erase(b, e); }
//! <b>Effects</b>: Erases all the elements with the given value.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const_reference value)
{ return table_.erase(value); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "key_value_equal" must be a equality function that induces
+ //! "key_value_equal" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "key_value_equal" compares an arbitrary key with the contained values.
//!
//! <b>Effects</b>: Erases all the elements that have the same hash and
//! compare equal with the given key.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the hash_func or the equal_func functors throws.
//! Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyHasher, class KeyValueEqual>
@@ -1466,14 +1466,14 @@ class unordered_multiset_impl
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
- //! <b>Effects</b>: Erases the element pointed to by i.
+ //! <b>Effects</b>: Erases the element pointed to by i.
//! Disposer::operator()(pointer) is called for the removed element.
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
- //! <b>Note</b>: Invalidates the iterators
+ //!
+ //! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
void erase_and_dispose(const_iterator i, Disposer disposer
@@ -1493,12 +1493,12 @@ class unordered_multiset_impl
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Complexity</b>: Average case O(std::distance(b, e)),
//! worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
@@ -1509,14 +1509,14 @@ class unordered_multiset_impl
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -1530,12 +1530,12 @@ class unordered_multiset_impl
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If hash_func or equal_func throw. Basic guarantee.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyHasher, class KeyValueEqual, class Disposer>
@@ -1543,26 +1543,26 @@ class unordered_multiset_impl
{ return table_.erase_and_dispose(key, hash_func, equal_func, disposer); }
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
{ return table_.clear(); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
- //!
+ //!
//! <b>Effects</b>: Erases all the elements of the container.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! Disposer::operator()(pointer) is called for the removed elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
@@ -1570,53 +1570,53 @@ class unordered_multiset_impl
{ return table_.clear_and_dispose(disposer); }
//! <b>Effects</b>: Returns the number of contained elements with the given key
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
size_type count(const_reference value) const
{ return table_.count(value); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "key_value_equal" must be a equality function that induces
+ //! "key_value_equal" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "key_value_equal" compares an arbitrary key with the contained values.
//!
//! <b>Effects</b>: Returns the number of contained elements with the given key
//!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
template<class KeyType, class KeyHasher, class KeyValueEqual>
size_type count(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func) const
{ return table_.count(key, hash_func, equal_func); }
- //! <b>Effects</b>: Finds an iterator to the first element whose value is
+ //! <b>Effects</b>: Finds an iterator to the first element whose value is
//! "value" or end() if that element does not exist.
//!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
iterator find(const_reference value)
{ return table_.find(value); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "key_value_equal" must be a equality function that induces
+ //! "key_value_equal" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "key_value_equal" compares an arbitrary key with the contained values.
//!
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
//! "key" according to the given hasher and equality functor or end() if
//! that element does not exist.
//!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1626,29 +1626,29 @@ class unordered_multiset_impl
iterator find(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func)
{ return table_.find(key, hash_func, equal_func); }
- //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
+ //! <b>Effects</b>: Finds a const_iterator to the first element whose key is
//! "key" or end() if that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
const_iterator find(const_reference value) const
{ return table_.find(value); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "key_value_equal" must be a equality function that induces
+ //! "key_value_equal" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "key_value_equal" compares an arbitrary key with the contained values.
//!
- //! <b>Effects</b>: Finds an iterator to the first element whose key is
+ //! <b>Effects</b>: Finds an iterator to the first element whose key is
//! "key" according to the given hasher and equality functor or end() if
//! that element does not exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1659,30 +1659,30 @@ class unordered_multiset_impl
{ return table_.find(key, hash_func, equal_func); }
//! <b>Effects</b>: Returns a range containing all elements with values equivalent
- //! to value. Returns std::make_pair(this->end(), this->end()) if no such
+ //! to value. Returns std::make_pair(this->end(), this->end()) if no such
//! elements exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)). Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
std::pair<iterator,iterator> equal_range(const_reference value)
{ return table_.equal_range(value); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "key_value_equal" must be a equality function that induces
+ //! "key_value_equal" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "key_value_equal" compares an arbitrary key with the contained values.
//!
//! <b>Effects</b>: Returns a range containing all elements with equivalent
- //! keys. Returns std::make_pair(this->end(), this->end()) if no such
+ //! keys. Returns std::make_pair(this->end(), this->end()) if no such
//! elements exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(key, hash_func, equal_func)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1694,31 +1694,31 @@ class unordered_multiset_impl
{ return table_.equal_range(key, hash_func, equal_func); }
//! <b>Effects</b>: Returns a range containing all elements with values equivalent
- //! to value. Returns std::make_pair(this->end(), this->end()) if no such
+ //! to value. Returns std::make_pair(this->end(), this->end()) if no such
//! elements exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(value)). Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
std::pair<const_iterator, const_iterator>
equal_range(const_reference value) const
{ return table_.equal_range(value); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
- //! "key_value_equal" must be a equality function that induces
+ //! "key_value_equal" must be a equality function that induces
//! the same equality as key_equal. The difference is that
//! "key_value_equal" compares an arbitrary key with the contained values.
//!
//! <b>Effects</b>: Returns a range containing all elements with equivalent
- //! keys. Returns std::make_pair(this->end(), this->end()) if no such
+ //! keys. Returns std::make_pair(this->end(), this->end()) if no such
//! elements exist.
- //!
+ //!
//! <b>Complexity</b>: Average case O(this->count(key, hash_func, equal_func)).
//! Worst case O(this->size()).
- //!
+ //!
//! <b>Throws</b>: If the internal hasher or the equality functor throws.
//!
//! <b>Note</b>: This function is used when constructing a value_type
@@ -1731,38 +1731,38 @@ class unordered_multiset_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_multiset of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid iterator belonging to the unordered_multiset
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the hash function throws.
iterator iterator_to(reference value)
{ return table_.iterator_to(value); }
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_multiset of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_iterator belonging to the
//! unordered_multiset that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the hash function throws.
const_iterator iterator_to(const_reference value) const
{ return table_.iterator_to(value); }
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid local_iterator belonging to the unordered_set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static local_iterator s_local_iterator_to(reference value)
@@ -1770,14 +1770,14 @@ class unordered_multiset_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_local_iterator belonging to
//! the unordered_set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: This static function is available only if the <i>value traits</i>
//! is stateless.
static const_local_iterator s_local_iterator_to(const_reference value)
@@ -1785,33 +1785,33 @@ class unordered_multiset_impl
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid local_iterator belonging to the unordered_set
//! that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
local_iterator local_iterator_to(reference value)
{ return table_.local_iterator_to(value); }
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
- //!
+ //!
//! <b>Effects</b>: Returns: a valid const_local_iterator belonging to
//! the unordered_set that points to the value
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
const_local_iterator local_iterator_to(const_reference value) const
{ return table_.local_iterator_to(value); }
//! <b>Effects</b>: Returns the number of buckets passed in the constructor
//! or the last rehash function.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type bucket_count() const
{ return table_.bucket_count(); }
@@ -1819,33 +1819,33 @@ class unordered_multiset_impl
//! <b>Requires</b>: n is in the range [0, this->bucket_count()).
//!
//! <b>Effects</b>: Returns the number of elements in the nth bucket.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
size_type bucket_size(size_type n) const
{ return table_.bucket_size(n); }
//! <b>Effects</b>: Returns the index of the bucket in which elements
//! with keys equivalent to k would be found, if any such element existed.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the hash functor throws.
//!
//! <b>Note</b>: the return value is in the range [0, this->bucket_count()).
size_type bucket(const value_type& k) const
{ return table_.bucket(k); }
- //! <b>Requires</b>: "hash_func" must be a hash function that induces
+ //! <b>Requires</b>: "hash_func" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hash_func" hashes the given key instead of the value_type.
//!
//! <b>Effects</b>: Returns the index of the bucket in which elements
//! with keys equivalent to k would be found, if any such element existed.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: If the hash functor throws.
//!
//! <b>Note</b>: the return value is in the range [0, this->bucket_count()).
@@ -1855,9 +1855,9 @@ class unordered_multiset_impl
//! <b>Effects</b>: Returns the bucket array pointer passed in the constructor
//! or the last rehash function.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
bucket_ptr bucket_pointer() const
{ return table_.bucket_pointer(); }
@@ -1866,13 +1866,13 @@ class unordered_multiset_impl
//!
//! <b>Effects</b>: Returns a local_iterator pointing to the beginning
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
local_iterator begin(size_type n)
{ return table_.begin(n); }
@@ -1880,13 +1880,13 @@ class unordered_multiset_impl
//!
//! <b>Effects</b>: Returns a const_local_iterator pointing to the beginning
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
const_local_iterator begin(size_type n) const
{ return table_.begin(n); }
@@ -1894,13 +1894,13 @@ class unordered_multiset_impl
//!
//! <b>Effects</b>: Returns a const_local_iterator pointing to the beginning
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
const_local_iterator cbegin(size_type n) const
{ return table_.cbegin(n); }
@@ -1908,13 +1908,13 @@ class unordered_multiset_impl
//!
//! <b>Effects</b>: Returns a local_iterator pointing to the end
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
local_iterator end(size_type n)
{ return table_.end(n); }
@@ -1922,13 +1922,13 @@ class unordered_multiset_impl
//!
//! <b>Effects</b>: Returns a const_local_iterator pointing to the end
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
const_local_iterator end(size_type n) const
{ return table_.end(n); }
@@ -1936,13 +1936,13 @@ class unordered_multiset_impl
//!
//! <b>Effects</b>: Returns a const_local_iterator pointing to the end
//! of the sequence stored in the bucket n.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Note</b>: [this->begin(n), this->end(n)) is a valid range
- //! containing all of the elements in the nth bucket.
+ //! containing all of the elements in the nth bucket.
const_local_iterator cend(size_type n) const
{ return table_.cend(n); }
@@ -1952,22 +1952,22 @@ class unordered_multiset_impl
//! n can be bigger or smaller than this->bucket_count().
//!
//! <b>Effects</b>: Updates the internal reference with the new bucket erases
- //! the values from the old bucket and inserts then in the new one.
+ //! the values from the old bucket and inserts then in the new one.
//!
//! If store_hash option is true, this method does not use the hash function.
- //!
+ //!
//! <b>Complexity</b>: Average case linear in this->size(), worst case quadratic.
- //!
+ //!
//! <b>Throws</b>: If the hasher functor throws.
void rehash(const bucket_traits &new_bucket_traits)
{ table_.rehash(new_bucket_traits); }
//! <b>Requires</b>:
//!
- //! <b>Effects</b>:
- //!
- //! <b>Complexity</b>:
- //!
+ //! <b>Effects</b>:
+ //!
+ //! <b>Complexity</b>:
+ //!
//! <b>Throws</b>:
//!
//! <b>Note</b>: this method is only available if incremental<true> option is activated.
@@ -1980,22 +1980,22 @@ class unordered_multiset_impl
//! <b>Requires</b>:
//!
- //! <b>Effects</b>:
- //!
- //! <b>Complexity</b>:
- //!
- //! <b>Throws</b>:
+ //! <b>Effects</b>:
+ //!
+ //! <b>Complexity</b>:
+ //!
+ //! <b>Throws</b>:
size_type split_count() const
{ return table_.split_count(); }
//! <b>Effects</b>: Returns the nearest new bucket count optimized for
//! the container that is bigger than n. This suggestion can be used
//! to create bucket arrays with a size that will usually improve
- //! container's performance. If such value does not exist, the
+ //! container's performance. If such value does not exist, the
//! higher possible value is returned.
- //!
+ //!
//! <b>Complexity</b>: Amortized constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static size_type suggested_upper_bucket_count(size_type n)
{ return table_type::suggested_upper_bucket_count(n); }
@@ -2003,11 +2003,11 @@ class unordered_multiset_impl
//! <b>Effects</b>: Returns the nearest new bucket count optimized for
//! the container that is smaller than n. This suggestion can be used
//! to create bucket arrays with a size that will usually improve
- //! container's performance. If such value does not exist, the
+ //! container's performance. If such value does not exist, the
//! lower possible value is returned.
- //!
+ //!
//! <b>Complexity</b>: Amortized constant time.
- //!
+ //!
//! <b>Throws</b>: Nothing.
static size_type suggested_lower_bucket_count(size_type n)
{ return table_type::suggested_lower_bucket_count(n); }
@@ -2030,7 +2030,7 @@ struct make_unordered_multiset
/// @cond
typedef unordered_multiset_impl
< typename make_hashtable_opt
- <T, false,
+ <T, false,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
#else
@@ -2050,7 +2050,7 @@ template<class T, class O1, class O2, class O3, class O4, class O5, class O6, cl
template<class T, class ...Options>
#endif
class unordered_multiset
- : public make_unordered_multiset<T,
+ : public make_unordered_multiset<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
#else
@@ -2059,7 +2059,7 @@ class unordered_multiset
>::type
{
typedef typename make_unordered_multiset
- <T,
+ <T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
#else
@@ -2083,7 +2083,7 @@ class unordered_multiset
unordered_multiset( const bucket_traits &b_traits
, const hasher & hash_func = hasher()
, const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: Base(b_traits, hash_func, equal_func, v_traits)
{}
@@ -2093,7 +2093,7 @@ class unordered_multiset
, const bucket_traits &b_traits
, const hasher & hash_func = hasher()
, const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
+ , const value_traits &v_traits = value_traits())
: Base(b, e, b_traits, hash_func, equal_func, v_traits)
{}
@@ -2107,8 +2107,8 @@ class unordered_multiset
#endif
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
diff --git a/boost/intrusive/unordered_set_hook.hpp b/boost/intrusive/unordered_set_hook.hpp
index 2912d32be7..c7e95b222c 100644
--- a/boost/intrusive/unordered_set_hook.hpp
+++ b/boost/intrusive/unordered_set_hook.hpp
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -95,10 +95,10 @@ struct unordered_node_traits
{ n->prev_in_group_ = prev; }
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)
- { n->hash_ = h; }
+ { n->hash_ = h; }
};
template<class NodeTraits>
@@ -147,12 +147,12 @@ struct get_uset_node_algo
{
typedef typename detail::if_c
< (StoreHash || OptimizeMultiKey)
- , unordered_node_traits<VoidPointer, StoreHash, OptimizeMultiKey>
- , slist_node_traits<VoidPointer>
+ , unordered_node_traits<VoidPointer, StoreHash, OptimizeMultiKey>
+ , slist_node_traits<VoidPointer>
>::type node_traits_type;
typedef typename detail::if_c
< OptimizeMultiKey
- , unordered_algorithms<node_traits_type>
+ , unordered_algorithms<node_traits_type>
, circular_slist_algorithms<node_traits_type>
>::type type;
};
@@ -169,7 +169,7 @@ struct make_unordered_set_base_hook
{
/// @cond
typedef typename pack_options
- < hook_defaults,
+ < hook_defaults,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
@@ -190,16 +190,16 @@ struct make_unordered_set_base_hook
typedef implementation_defined type;
};
-//! 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
+//! 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
//! 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<>,
//! \c link_mode<>, \c store_hash<> and \c optimize_multikey<>.
//!
-//! \c tag<> defines a tag to identify the node.
-//! 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
+//! \c tag<> defines a tag to identify the node.
+//! 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
//! unique tag.
//!
//! \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:
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
unordered_set_base_hook();
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
- //!
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
//! <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
//! move-semantics.
unordered_set_base_hook(const unordered_set_base_hook& );
//! <b>Effects</b>: Empty function. The argument is ignored.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Rationale</b>: Providing an assignment operator
- //! makes classes using the hook STL-compliant without forcing the
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Rationale</b>: Providing an assignment operator
+ //! makes classes using the hook STL-compliant without forcing the
//! user to do some additional work. \c swap can be used to emulate
//! move-semantics.
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
//! 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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
~unordered_set_base_hook();
- //! <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
- //! 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
- //! 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
- //! after the swap-operation the other element is not in a container.
- //! Iterators to e1 and e2 related to those nodes are invalidated.
+ //! <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
+ //! 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
+ //! 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
+ //! after the swap-operation the other element is not in a container.
+ //! 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);
//! <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
- //! otherwise. This function can be used to test whether \c unordered_set::iterator_to
- //! will return a valid iterator.
+ //! otherwise. This function can be used to test whether \c unordered_set::iterator_to
+ //! will return a valid iterator.
//!
- //! <b>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
bool is_linked() const;
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
void unlink();
#endif
};
@@ -308,7 +308,7 @@ struct make_unordered_set_member_hook
{
/// @cond
typedef typename pack_options
- < hook_defaults,
+ < hook_defaults,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#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
//! 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.
-//!
+//!
//! The hook admits the following options: \c void_pointer<>,
//! \c link_mode<> and \c store_hash<>.
//!
@@ -362,27 +362,27 @@ class unordered_set_member_hook
public:
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
//! initializes the node to an unlinked state.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
unordered_set_member_hook();
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
- //!
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
//! <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
//! move-semantics.
unordered_set_member_hook(const unordered_set_member_hook& );
//! <b>Effects</b>: Empty function. The argument is ignored.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Rationale</b>: Providing an assignment operator
- //! makes classes using the hook STL-compliant without forcing the
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Rationale</b>: Providing an assignment operator
+ //! makes classes using the hook STL-compliant without forcing the
//! user to do some additional work. \c swap can be used to emulate
//! move-semantics.
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
//! 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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
~unordered_set_member_hook();
- //! <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
- //! 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
- //! 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
- //! after the swap-operation the other element is not in a container.
- //! Iterators to e1 and e2 related to those nodes are invalidated.
+ //! <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
+ //! 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
+ //! 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
+ //! after the swap-operation the other element is not in a container.
+ //! 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);
//! <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
- //! otherwise. This function can be used to test whether \c unordered_set::iterator_to
- //! will return a valid iterator.
+ //! otherwise. This function can be used to test whether \c unordered_set::iterator_to
+ //! will return a valid iterator.
//!
- //! <b>Complexity</b>: Constant
+ //! <b>Complexity</b>: Constant
bool is_linked() const;
//! <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.
- //!
- //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Throws</b>: Nothing.
void unlink();
#endif
};
-} //namespace intrusive
-} //namespace boost
+} //namespace intrusive
+} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>