summaryrefslogtreecommitdiff
path: root/boost/intrusive
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2013-08-26 12:15:55 (GMT)
committerAnas Nashif <anas.nashif@intel.com>2013-08-26 12:15:55 (GMT)
commitbb4dd8289b351fae6b55e303f189127a394a1edd (patch)
tree77c9c35a31b1459dd7988c2448e797d142530c41 /boost/intrusive
parent1a78a62555be32868418fe52f8e330c9d0f95d5a (diff)
downloadboost-bb4dd8289b351fae6b55e303f189127a394a1edd.zip
boost-bb4dd8289b351fae6b55e303f189127a394a1edd.tar.gz
boost-bb4dd8289b351fae6b55e303f189127a394a1edd.tar.bz2
Imported Upstream version 1.51.0upstream/1.51.0refs/changes/75/8775/1
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 cccc820..7d60de0 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 92baf47..91e2dbb 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 23b1f0b..825921f 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 20903dd..84376a8 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 9b917c7..11463c7 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 bf8e2de..682426a 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 c5de423..282f474 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 b843590..c39b3d0 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 38c5aa5..0aae01b 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 bda9ad3..b274135 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 cfe392b..33de97f 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 dc600e6..aec0dab 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 6765dfa..1b5c27f 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 15d6b3f..942b35a 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 bb126fc..7d15336 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 4277cb5..d653030 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 d4c2d15..850d074 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 e00a7ef..08cee2d 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 fc35610..5ddd520 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 33811e3..6516e28 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 ac6ab81..86e6074 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 e38f4de..8677c66 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 df99912..d406af6 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 ad026c6..1a6431b 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 075381c..02b1361 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 c06d932..2afffb4 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 de66280..348b104 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 dbe0130..b76582b 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 5b96c09..0eddbcd 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 15ef3ab..488db9a 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 8d31d9d..c92d39b 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 ccbe70c..09fa7a4 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 c041620..c6bc798 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 5de529f..87cab4b 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 bade5cb..2435a08 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 dc18566..c95767e 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 f335655..db4092d 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 17012c9..c04f775 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 dbbf7c9..5450bc5 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 ed93434..b674868 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 378c4e0..0462dbd 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 4cdeccd..e657438 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 882c073..f4658e5 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 10b2fe0..a2a9f1b 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 9f7d2fa..3ed1afb 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 26dfb4d..1c0c30e 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 de012c2..451a550 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 9b02070..9a61560 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 35746a2..2634b42 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 fb59496..9b020cc 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)).
- //!
+ //!
<