|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r79557 - in branches/release/boost/intrusive: . detail
From: igaztanaga_at_[hidden]
Date: 2012-07-16 04:39:35
Author: igaztanaga
Date: 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
New Revision: 79557
URL: http://svn.boost.org/trac/boost/changeset/79557
Log:
Merged from trunk
Properties modified:
branches/release/boost/intrusive/ (props changed)
Text files modified:
branches/release/boost/intrusive/any_hook.hpp | 4
branches/release/boost/intrusive/avl_set.hpp | 190 +++++++++++++++++++++++++++++++++++++--
branches/release/boost/intrusive/avl_set_hook.hpp | 2
branches/release/boost/intrusive/avltree.hpp | 118 ++++++++++++++++++++++--
branches/release/boost/intrusive/avltree_algorithms.hpp | 41 ++++++-
branches/release/boost/intrusive/bs_set_hook.hpp | 2
branches/release/boost/intrusive/circular_list_algorithms.hpp | 6
branches/release/boost/intrusive/circular_slist_algorithms.hpp | 4
branches/release/boost/intrusive/derivation_value_traits.hpp | 2
branches/release/boost/intrusive/detail/any_node_and_algorithms.hpp | 6
branches/release/boost/intrusive/detail/assert.hpp | 2
branches/release/boost/intrusive/detail/avltree_node.hpp | 2
branches/release/boost/intrusive/detail/clear_on_destructor_base.hpp | 2
branches/release/boost/intrusive/detail/common_slist_algorithms.hpp | 14 +-
branches/release/boost/intrusive/detail/config_begin.hpp | 2
branches/release/boost/intrusive/detail/config_end.hpp | 2
branches/release/boost/intrusive/detail/ebo_functor_holder.hpp | 2
branches/release/boost/intrusive/detail/function_detector.hpp | 2
branches/release/boost/intrusive/detail/generic_hook.hpp | 2
branches/release/boost/intrusive/detail/has_member_function_callable_with.hpp | 6
branches/release/boost/intrusive/detail/hashtable_node.hpp | 4
branches/release/boost/intrusive/detail/is_stateful_value_traits.hpp | 2
branches/release/boost/intrusive/detail/list_node.hpp | 6
branches/release/boost/intrusive/detail/memory_util.hpp | 16 +-
branches/release/boost/intrusive/detail/mpl.hpp | 14 ++
branches/release/boost/intrusive/detail/parent_from_member.hpp | 22 +++-
branches/release/boost/intrusive/detail/preprocessor.hpp | 2
branches/release/boost/intrusive/detail/rbtree_node.hpp | 2
branches/release/boost/intrusive/detail/slist_node.hpp | 8
branches/release/boost/intrusive/detail/transform_iterator.hpp | 2
branches/release/boost/intrusive/detail/tree_algorithms.hpp | 178 +++++++++++++++++++++++-------------
branches/release/boost/intrusive/detail/tree_node.hpp | 6
branches/release/boost/intrusive/detail/utilities.hpp | 8
branches/release/boost/intrusive/detail/workaround.hpp | 2
branches/release/boost/intrusive/hashtable.hpp | 36 +++---
branches/release/boost/intrusive/intrusive_fwd.hpp | 2
branches/release/boost/intrusive/linear_slist_algorithms.hpp | 6
branches/release/boost/intrusive/link_mode.hpp | 2
branches/release/boost/intrusive/list.hpp | 22 ++--
branches/release/boost/intrusive/list_hook.hpp | 2
branches/release/boost/intrusive/member_value_traits.hpp | 2
branches/release/boost/intrusive/options.hpp | 2
branches/release/boost/intrusive/parent_from_member.hpp | 2
branches/release/boost/intrusive/pointer_plus_bits.hpp | 2
branches/release/boost/intrusive/pointer_traits.hpp | 4
branches/release/boost/intrusive/rbtree.hpp | 116 ++++++++++++++++++++++-
branches/release/boost/intrusive/rbtree_algorithms.hpp | 41 ++++++-
branches/release/boost/intrusive/set.hpp | 192 +++++++++++++++++++++++++++++++++++++--
branches/release/boost/intrusive/set_hook.hpp | 2
branches/release/boost/intrusive/sg_set.hpp | 190 +++++++++++++++++++++++++++++++++++++--
branches/release/boost/intrusive/sgtree.hpp | 130 +++++++++++++++++++++++---
branches/release/boost/intrusive/sgtree_algorithms.hpp | 39 ++++++-
branches/release/boost/intrusive/slist.hpp | 16 +-
branches/release/boost/intrusive/slist_hook.hpp | 2
branches/release/boost/intrusive/splay_set.hpp | 192 +++++++++++++++++++++++++++++++++++++--
branches/release/boost/intrusive/splay_set_hook.hpp | 2
branches/release/boost/intrusive/splaytree.hpp | 118 ++++++++++++++++++++++--
branches/release/boost/intrusive/splaytree_algorithms.hpp | 71 +++++++++++---
branches/release/boost/intrusive/treap.hpp | 118 ++++++++++++++++++++++--
branches/release/boost/intrusive/treap_algorithms.hpp | 43 +++++++-
branches/release/boost/intrusive/treap_set.hpp | 190 +++++++++++++++++++++++++++++++++++++--
branches/release/boost/intrusive/trivial_value_traits.hpp | 2
branches/release/boost/intrusive/unordered_set.hpp | 22 ++--
branches/release/boost/intrusive/unordered_set_hook.hpp | 6
64 files changed, 1905 insertions(+), 352 deletions(-)
Modified: branches/release/boost/intrusive/any_hook.hpp
==============================================================================
--- branches/release/boost/intrusive/any_hook.hpp (original)
+++ branches/release/boost/intrusive/any_hook.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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 @@
Options...
#endif
>::type packed_options;
-
+
typedef detail::generic_hook
< get_any_node_algo<typename packed_options::void_pointer>
, typename packed_options::tag
Modified: branches/release/boost/intrusive/avl_set.hpp
==============================================================================
--- branches/release/boost/intrusive/avl_set.hpp (original)
+++ branches/release/boost/intrusive/avl_set.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -80,7 +80,7 @@
public:
//! <b>Effects</b>: Constructs an empty avl_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -111,13 +111,13 @@
{}
//! <b>Effects</b>: to-do
- //!
+ //!
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)
{ tree_ = ::boost::move(x.tree_); return *this; }
@@ -343,7 +343,7 @@
//!
//! 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.
@@ -453,7 +453,7 @@
//! 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>
@@ -969,6 +969,91 @@
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.
//!
@@ -1290,7 +1375,7 @@
public:
//! <b>Effects</b>: Constructs an empty avl_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -1321,13 +1406,13 @@
{}
//! <b>Effects</b>: to-do
- //!
+ //!
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)
{ tree_ = ::boost::move(x.tree_); return *this; }
@@ -1553,7 +1638,7 @@
//!
//! 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.
@@ -2086,6 +2171,91 @@
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.
//!
Modified: branches/release/boost/intrusive/avl_set_hook.hpp
==============================================================================
--- branches/release/boost/intrusive/avl_set_hook.hpp (original)
+++ branches/release/boost/intrusive/avl_set_hook.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/avltree.hpp
==============================================================================
--- branches/release/boost/intrusive/avltree.hpp (original)
+++ branches/release/boost/intrusive/avltree.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -160,7 +160,7 @@
{}
node_plus_pred_t node_plus_pred_;
} data_;
-
+
const value_compare &priv_comp() const
{ return data_.node_plus_pred_.get(); }
@@ -213,7 +213,7 @@
typedef typename node_algorithms::insert_commit_data insert_commit_data;
//! <b>Effects</b>: Constructs an empty tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -222,8 +222,8 @@
avltree_impl( const value_compare &cmp = value_compare()
, 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));
}
@@ -254,17 +254,17 @@
}
//! <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)
{ this->swap(x); return *this; }
@@ -689,7 +689,7 @@
//! 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>
@@ -1228,6 +1228,104 @@
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.
//!
@@ -1238,7 +1336,7 @@
//!
//! 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.
Modified: branches/release/boost/intrusive/avltree_algorithms.hpp
==============================================================================
--- branches/release/boost/intrusive/avltree_algorithms.hpp (original)
+++ branches/release/boost/intrusive/avltree_algorithms.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -88,7 +88,7 @@
avltree_node_cloner(F f)
: base_t(f)
{}
-
+
node_ptr operator()(const node_ptr &p)
{
node_ptr n = base_t::get()(p);
@@ -149,7 +149,7 @@
{
if(node1 == node2)
return;
-
+
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
swap_nodes(node1, header1, node2, header2);
}
@@ -364,7 +364,7 @@
//! <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
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
@@ -464,6 +464,31 @@
(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
@@ -511,7 +536,7 @@
//! 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).
@@ -534,7 +559,7 @@
//! "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.
@@ -554,7 +579,7 @@
//! <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.
@@ -573,7 +598,7 @@
//! <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.
Modified: branches/release/boost/intrusive/bs_set_hook.hpp
==============================================================================
--- branches/release/boost/intrusive/bs_set_hook.hpp (original)
+++ branches/release/boost/intrusive/bs_set_hook.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/circular_list_algorithms.hpp
==============================================================================
--- branches/release/boost/intrusive/circular_list_algorithms.hpp (original)
+++ branches/release/boost/intrusive/circular_list_algorithms.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -73,7 +73,7 @@
//! <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
@@ -354,7 +354,7 @@
{
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);
Modified: branches/release/boost/intrusive/circular_slist_algorithms.hpp
==============================================================================
--- branches/release/boost/intrusive/circular_slist_algorithms.hpp (original)
+++ branches/release/boost/intrusive/circular_slist_algorithms.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -382,7 +382,7 @@
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)){
Modified: branches/release/boost/intrusive/derivation_value_traits.hpp
==============================================================================
--- branches/release/boost/intrusive/derivation_value_traits.hpp (original)
+++ branches/release/boost/intrusive/derivation_value_traits.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/detail/any_node_and_algorithms.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/any_node_and_algorithms.hpp (original)
+++ branches/release/boost/intrusive/detail/any_node_and_algorithms.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -100,10 +100,10 @@
{ 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; }
};
Modified: branches/release/boost/intrusive/detail/assert.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/assert.hpp (original)
+++ branches/release/boost/intrusive/detail/assert.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/detail/avltree_node.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/avltree_node.hpp (original)
+++ branches/release/boost/intrusive/detail/avltree_node.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/detail/clear_on_destructor_base.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/clear_on_destructor_base.hpp (original)
+++ branches/release/boost/intrusive/detail/clear_on_destructor_base.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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)
//
Modified: branches/release/boost/intrusive/detail/common_slist_algorithms.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/common_slist_algorithms.hpp (original)
+++ branches/release/boost/intrusive/detail/common_slist_algorithms.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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 @@
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 @@
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 @@
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) {
Modified: branches/release/boost/intrusive/detail/config_begin.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/config_begin.hpp (original)
+++ branches/release/boost/intrusive/detail/config_begin.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/detail/config_end.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/config_end.hpp (original)
+++ branches/release/boost/intrusive/detail/config_end.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/detail/ebo_functor_holder.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/ebo_functor_holder.hpp (original)
+++ branches/release/boost/intrusive/detail/ebo_functor_holder.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/detail/function_detector.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/function_detector.hpp (original)
+++ branches/release/boost/intrusive/detail/function_detector.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/detail/generic_hook.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/generic_hook.hpp (original)
+++ branches/release/boost/intrusive/detail/generic_hook.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/detail/has_member_function_callable_with.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/has_member_function_callable_with.hpp (original)
+++ branches/release/boost/intrusive/detail/has_member_function_callable_with.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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)
//
@@ -158,7 +158,7 @@
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);
};
@@ -224,7 +224,7 @@
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);
};
Modified: branches/release/boost/intrusive/detail/hashtable_node.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/hashtable_node.hpp (original)
+++ branches/release/boost/intrusive/detail/hashtable_node.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -182,7 +182,7 @@
public:
hashtable_iterator& operator++()
{ this->increment(); return *this; }
-
+
hashtable_iterator operator++(int)
{
hashtable_iterator result (*this);
Modified: branches/release/boost/intrusive/detail/is_stateful_value_traits.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/is_stateful_value_traits.hpp (original)
+++ branches/release/boost/intrusive/detail/is_stateful_value_traits.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/detail/list_node.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/list_node.hpp (original)
+++ branches/release/boost/intrusive/detail/list_node.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -110,7 +110,7 @@
//members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
return static_cast<list_iterator&> (*this);
}
-
+
list_iterator operator++(int)
{
list_iterator result (*this);
@@ -123,7 +123,7 @@
members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_);
return static_cast<list_iterator&> (*this);
}
-
+
list_iterator operator--(int)
{
list_iterator result (*this);
Modified: branches/release/boost/intrusive/detail/memory_util.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/memory_util.hpp (original)
+++ branches/release/boost/intrusive/detail/memory_util.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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 @@
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 @@
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 @@
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;
Modified: branches/release/boost/intrusive/detail/mpl.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/mpl.hpp (original)
+++ branches/release/boost/intrusive/detail/mpl.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -156,10 +156,14 @@
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 @@
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 @@
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; };
Modified: branches/release/boost/intrusive/detail/parent_from_member.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/parent_from_member.hpp (original)
+++ branches/release/boost/intrusive/detail/parent_from_member.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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,16 +31,28 @@
//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
}
Modified: branches/release/boost/intrusive/detail/preprocessor.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/preprocessor.hpp (original)
+++ branches/release/boost/intrusive/detail/preprocessor.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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)
//
Modified: branches/release/boost/intrusive/detail/rbtree_node.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/rbtree_node.hpp (original)
+++ branches/release/boost/intrusive/detail/rbtree_node.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/detail/slist_node.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/slist_node.hpp (original)
+++ branches/release/boost/intrusive/detail/slist_node.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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,10 +43,10 @@
<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
@@ -100,7 +100,7 @@
members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
return static_cast<slist_iterator&> (*this);
}
-
+
slist_iterator operator++(int)
{
slist_iterator result (*this);
Modified: branches/release/boost/intrusive/detail/transform_iterator.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/transform_iterator.hpp (original)
+++ branches/release/boost/intrusive/detail/transform_iterator.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/detail/tree_algorithms.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/tree_algorithms.hpp (original)
+++ branches/release/boost/intrusive/detail/tree_algorithms.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -192,7 +192,7 @@
{
if(node1 == node2)
return;
-
+
node_ptr header1(get_header(node1)), header2(get_header(node2));
swap_nodes(node1, header1, node2, header2);
}
@@ -216,7 +216,7 @@
{
if(node1 == node2)
return;
-
+
//node1 and node2 must not be header nodes
//BOOST_INTRUSIVE_INVARIANT_ASSERT((header1 != node1 && header2 != node2));
if(header1 != header2){
@@ -388,7 +388,7 @@
{
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);
@@ -688,7 +688,7 @@
{
if(header1 == header2)
return;
-
+
node_ptr tmp;
//Parent swap
@@ -765,55 +765,73 @@
//! 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,6 +842,26 @@
//! 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.
@@ -835,18 +873,7 @@
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.
@@ -864,18 +891,7 @@
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.
@@ -1174,7 +1190,7 @@
//! <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
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
@@ -1536,7 +1552,7 @@
//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;
@@ -1596,6 +1612,40 @@
}
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)
Modified: branches/release/boost/intrusive/detail/tree_node.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/tree_node.hpp (original)
+++ branches/release/boost/intrusive/detail/tree_node.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -119,7 +119,7 @@
members_.nodeptr_ = node_algorithms::next_node(members_.nodeptr_);
return static_cast<tree_iterator&> (*this);
}
-
+
tree_iterator operator++(int)
{
tree_iterator result (*this);
@@ -132,7 +132,7 @@
members_.nodeptr_ = node_algorithms::prev_node(members_.nodeptr_);
return static_cast<tree_iterator&> (*this);
}
-
+
tree_iterator operator--(int)
{
tree_iterator result (*this);
Modified: branches/release/boost/intrusive/detail/utilities.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/utilities.hpp (original)
+++ branches/release/boost/intrusive/detail/utilities.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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 @@
key_nodeptr_comp(KeyValueCompare kcomp, const Container *cont)
: base_t(kcomp), cont_(cont)
{}
-
+
template<class T>
struct is_node_ptr
{
@@ -504,7 +504,7 @@
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 @@
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);
}
Modified: branches/release/boost/intrusive/detail/workaround.hpp
==============================================================================
--- branches/release/boost/intrusive/detail/workaround.hpp (original)
+++ branches/release/boost/intrusive/detail/workaround.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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)
//
Modified: branches/release/boost/intrusive/hashtable.hpp
==============================================================================
--- branches/release/boost/intrusive/hashtable.hpp (original)
+++ branches/release/boost/intrusive/hashtable.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -490,7 +490,7 @@
//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 @@
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)); }
@@ -879,7 +879,7 @@
//!
//! <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>Throws</b>: If value_traits::node_traits::node
@@ -905,7 +905,7 @@
}
//! <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,7 +927,7 @@
}
//! <b>Effects</b>: to-do
- //!
+ //!
hashtable_impl& operator=(BOOST_RV_REF(hashtable_impl) x)
{ this->swap(x); return *this; }
@@ -1131,7 +1131,7 @@
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
@@ -1839,7 +1839,7 @@
{
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
@@ -1858,7 +1858,7 @@
{
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
@@ -1873,7 +1873,7 @@
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
@@ -1889,7 +1889,7 @@
{
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
@@ -2058,7 +2058,7 @@
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))));
@@ -2220,7 +2220,7 @@
//!
//! 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
@@ -2613,7 +2613,7 @@
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){
@@ -2720,7 +2720,7 @@
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 @@
if(constant_time_size && this->empty()){
return priv_invalid_local_it();
}
-
+
siterator it = previt;
++it;
@@ -3008,7 +3008,7 @@
++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()
@@ -3061,7 +3061,7 @@
, 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
Modified: branches/release/boost/intrusive/intrusive_fwd.hpp
==============================================================================
--- branches/release/boost/intrusive/intrusive_fwd.hpp (original)
+++ branches/release/boost/intrusive/intrusive_fwd.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/linear_slist_algorithms.hpp
==============================================================================
--- branches/release/boost/intrusive/linear_slist_algorithms.hpp (original)
+++ branches/release/boost/intrusive/linear_slist_algorithms.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -255,7 +255,7 @@
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());
@@ -300,7 +300,7 @@
//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)){
Modified: branches/release/boost/intrusive/link_mode.hpp
==============================================================================
--- branches/release/boost/intrusive/link_mode.hpp (original)
+++ branches/release/boost/intrusive/link_mode.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/list.hpp
==============================================================================
--- branches/release/boost/intrusive/list.hpp (original)
+++ branches/release/boost/intrusive/list.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -204,16 +204,16 @@
//! 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).
@@ -227,17 +227,17 @@
}
//! <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)
{ this->swap(x); return *this; }
@@ -470,7 +470,7 @@
//! <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
@@ -479,7 +479,7 @@
//! <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
@@ -488,7 +488,7 @@
//! <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
@@ -771,7 +771,7 @@
//!
//! 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.
Modified: branches/release/boost/intrusive/list_hook.hpp
==============================================================================
--- branches/release/boost/intrusive/list_hook.hpp (original)
+++ branches/release/boost/intrusive/list_hook.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/member_value_traits.hpp
==============================================================================
--- branches/release/boost/intrusive/member_value_traits.hpp (original)
+++ branches/release/boost/intrusive/member_value_traits.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/options.hpp
==============================================================================
--- branches/release/boost/intrusive/options.hpp (original)
+++ branches/release/boost/intrusive/options.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/parent_from_member.hpp
==============================================================================
--- branches/release/boost/intrusive/parent_from_member.hpp (original)
+++ branches/release/boost/intrusive/parent_from_member.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/pointer_plus_bits.hpp
==============================================================================
--- branches/release/boost/intrusive/pointer_plus_bits.hpp (original)
+++ branches/release/boost/intrusive/pointer_plus_bits.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/pointer_traits.hpp
==============================================================================
--- branches/release/boost/intrusive/pointer_traits.hpp (original)
+++ branches/release/boost/intrusive/pointer_traits.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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)
//
@@ -232,7 +232,7 @@
template <class U> struct rebind_pointer
{ typedef U* type; };
-
+
//! <b>Returns</b>: addressof(r)
//!
static pointer pointer_to(reference r)
Modified: branches/release/boost/intrusive/rbtree.hpp
==============================================================================
--- branches/release/boost/intrusive/rbtree.hpp (original)
+++ branches/release/boost/intrusive/rbtree.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -218,7 +218,7 @@
typedef typename node_algorithms::insert_commit_data insert_commit_data;
//! <b>Effects</b>: Constructs an empty tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -227,8 +227,8 @@
rbtree_impl( const value_compare &cmp = value_compare()
, 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));
}
@@ -259,17 +259,17 @@
}
//! <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)
{ this->swap(x); return *this; }
@@ -694,7 +694,7 @@
//! 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>
@@ -1232,6 +1232,104 @@
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.
//!
@@ -1242,7 +1340,7 @@
//!
//! 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.
Modified: branches/release/boost/intrusive/rbtree_algorithms.hpp
==============================================================================
--- branches/release/boost/intrusive/rbtree_algorithms.hpp (original)
+++ branches/release/boost/intrusive/rbtree_algorithms.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -135,7 +135,7 @@
rbtree_node_cloner(F f)
: base_t(f)
{}
-
+
node_ptr operator()(const node_ptr & p)
{
node_ptr n = base_t::get()(p);
@@ -201,7 +201,7 @@
{
if(node1 == node2)
return;
-
+
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
swap_nodes(node1, header1, node2, header2);
}
@@ -418,7 +418,7 @@
//! <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
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
@@ -518,6 +518,31 @@
(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
@@ -565,7 +590,7 @@
//! 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).
@@ -588,7 +613,7 @@
//! "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.
@@ -608,7 +633,7 @@
//! <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.
@@ -627,7 +652,7 @@
//! <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.
Modified: branches/release/boost/intrusive/set.hpp
==============================================================================
--- branches/release/boost/intrusive/set.hpp (original)
+++ branches/release/boost/intrusive/set.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -87,7 +87,7 @@
public:
//! <b>Effects</b>: Constructs an empty set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -118,13 +118,13 @@
{}
//! <b>Effects</b>: to-do
- //!
+ //!
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)
{ tree_ = ::boost::move(x.tree_); return *this; }
@@ -350,7 +350,7 @@
//!
//! 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.
@@ -460,7 +460,7 @@
//! 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>
@@ -976,6 +976,91 @@
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.
//!
@@ -1303,7 +1388,7 @@
public:
//! <b>Effects</b>: Constructs an empty multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -1334,13 +1419,13 @@
{}
//! <b>Effects</b>: to-do
- //!
+ //!
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)
{ tree_ = ::boost::move(x.tree_); return *this; }
@@ -1566,7 +1651,7 @@
//!
//! 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.
@@ -2096,6 +2181,91 @@
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.
//!
@@ -2330,7 +2500,7 @@
Options...
#endif
>::type Base;
-
+
BOOST_MOVABLE_BUT_NOT_COPYABLE(multiset)
public:
Modified: branches/release/boost/intrusive/set_hook.hpp
==============================================================================
--- branches/release/boost/intrusive/set_hook.hpp (original)
+++ branches/release/boost/intrusive/set_hook.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/sg_set.hpp
==============================================================================
--- branches/release/boost/intrusive/sg_set.hpp (original)
+++ branches/release/boost/intrusive/sg_set.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -78,7 +78,7 @@
public:
//! <b>Effects</b>: Constructs an empty sg_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -109,13 +109,13 @@
{}
//! <b>Effects</b>: to-do
- //!
+ //!
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)
{ tree_ = ::boost::move(x.tree_); return *this; }
@@ -341,7 +341,7 @@
//!
//! 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.
@@ -451,7 +451,7 @@
//! 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>
@@ -967,6 +967,91 @@
equal_range(const KeyType& key, KeyValueCompare comp) const
{ return tree_.equal_range(key, comp); }
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator, const_iterator>
+ bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator, const_iterator>
+ bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: value must be an lvalue and shall be in a sg_set of
//! appropriate type. Otherwise the behavior is undefined.
//!
@@ -1326,7 +1411,7 @@
public:
//! <b>Effects</b>: Constructs an empty sg_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -1357,13 +1442,13 @@
{}
//! <b>Effects</b>: to-do
- //!
+ //!
sg_multiset_impl(BOOST_RV_REF(sg_multiset_impl) x)
: tree_(::boost::move(x.tree_))
{}
//! <b>Effects</b>: to-do
- //!
+ //!
sg_multiset_impl& operator=(BOOST_RV_REF(sg_multiset_impl) x)
{ tree_ = ::boost::move(x.tree_); return *this; }
@@ -1589,7 +1674,7 @@
//!
//! 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.
@@ -2119,6 +2204,91 @@
equal_range(const KeyType& key, KeyValueCompare comp) const
{ return tree_.equal_range(key, comp); }
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator, const_iterator>
+ bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator, const_iterator>
+ bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: value must be an lvalue and shall be in a sg_multiset of
//! appropriate type. Otherwise the behavior is undefined.
//!
Modified: branches/release/boost/intrusive/sgtree.hpp
==============================================================================
--- branches/release/boost/intrusive/sgtree.hpp (original)
+++ branches/release/boost/intrusive/sgtree.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2009
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -48,7 +48,7 @@
namespace detail{
-//! Returns floor(log(n)/log(sqrt(2))) -> floor(2*log2(n))
+//! Returns floor(log2(n)/log2(sqrt(2))) -> floor(2*log2(n))
//! Undefined if N is 0.
//!
//! This function does not use float point operations.
@@ -83,9 +83,9 @@
std::size_t operator()(std::size_t n) const
{
- //Returns floor(log1/alpha(n)) ->
- // floor(log(n)/log(1/alpha)) ->
- // floor(log(n)/(-log(alpha)))
+ //Returns floor(log2(1/alpha(n))) ->
+ // floor(log2(n)/log(1/alpha)) ->
+ // floor(log2(n)/(-log2(alpha)))
//return static_cast<std::size_t>(std::log(float(n))*inv_minus_logalpha_);
return static_cast<std::size_t>(detail::fast_log2(float(n))*inv_minus_logalpha_);
}
@@ -103,7 +103,7 @@
alpha_by_max_size_t(float alpha)
: alpha_(alpha)
{}
-
+
float operator()(std::size_t max_tree_size) const
{ return float(max_tree_size)*alpha_; }
@@ -299,7 +299,7 @@
void priv_alpha(float alpha)
{ return this->priv_alpha_traits().set_alpha(alpha); }
-
+
const value_compare &priv_comp() const
{ return data_.node_plus_pred_.get(); }
@@ -364,7 +364,7 @@
typedef typename node_algorithms::insert_commit_data insert_commit_data;
//! <b>Effects</b>: Constructs an empty tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -373,8 +373,8 @@
sgtree_impl( const value_compare &cmp = value_compare()
, 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));
}
@@ -405,17 +405,17 @@
}
//! <b>Effects</b>: to-do
- //!
+ //!
sgtree_impl(BOOST_RV_REF(sgtree_impl) x)
: data_(::boost::move(x.priv_comp()), ::boost::move(x.priv_value_traits()))
{
- node_algorithms::init_header(this->priv_header_ptr());
+ node_algorithms::init_header(this->priv_header_ptr());
this->priv_size_traits().set_size(size_type(0));
this->swap(x);
}
//! <b>Effects</b>: to-do
- //!
+ //!
sgtree_impl& operator=(BOOST_RV_REF(sgtree_impl) x)
{ this->swap(x); return *this; }
@@ -848,7 +848,7 @@
//! 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>
@@ -1040,7 +1040,7 @@
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyValueCompare>
- size_type erase(const KeyType& key, KeyValueCompare comp
+ size_type erase(const KeyType& key, KeyValueCompare comp
/// @cond
, typename detail::enable_if_c<!detail::is_convertible<KeyValueCompare, const_iterator>::value >::type * = 0
/// @endcond
@@ -1404,6 +1404,104 @@
return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
}
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ {
+ detail::key_nodeptr_comp<KeyValueCompare, sgtree_impl>
+ key_node_comp(comp, this);
+ std::pair<node_ptr, node_ptr> ret
+ (node_algorithms::bounded_range
+ (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed));
+ return std::pair<iterator, iterator>(iterator(ret.first, this), iterator(ret.second, this));
+ }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator,const_iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator,const_iterator> bounded_range
+ (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ {
+ detail::key_nodeptr_comp<KeyValueCompare, sgtree_impl>
+ key_node_comp(comp, this);
+ std::pair<node_ptr, node_ptr> ret
+ (node_algorithms::bounded_range
+ (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed));
+ return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
+ }
+
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//! Cloner should yield to nodes equivalent to the original nodes.
//!
@@ -1414,7 +1512,7 @@
//!
//! 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.
Modified: branches/release/boost/intrusive/sgtree_algorithms.hpp
==============================================================================
--- branches/release/boost/intrusive/sgtree_algorithms.hpp (original)
+++ branches/release/boost/intrusive/sgtree_algorithms.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -119,7 +119,7 @@
{
if(node1 == node2)
return;
-
+
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
swap_nodes(node1, header1, node2, header2);
}
@@ -322,7 +322,7 @@
//! <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
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
@@ -421,6 +421,31 @@
(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
@@ -472,7 +497,7 @@
//! 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).
@@ -544,7 +569,7 @@
//! "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.
@@ -567,7 +592,7 @@
//! <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.
@@ -589,7 +614,7 @@
//! <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.
Modified: branches/release/boost/intrusive/slist.hpp
==============================================================================
--- branches/release/boost/intrusive/slist.hpp (original)
+++ branches/release/boost/intrusive/slist.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -287,7 +287,7 @@
//!
//! <b>Effects</b>: Constructs a list equal to [first,last).
//!
- //! <b>Complexity</b>: Linear in std::distance(b, e). No copy constructors are called.
+ //! <b>Complexity</b>: Linear in std::distance(b, e). No copy constructors are called.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks).
@@ -300,17 +300,17 @@
}
//! <b>Effects</b>: to-do
- //!
+ //!
slist_impl(BOOST_RV_REF(slist_impl) x)
: data_(::boost::move(x.priv_value_traits()))
{
this->priv_size_traits().set_size(size_type(0));
- node_algorithms::init_header(this->get_root_node());
+ node_algorithms::init_header(this->get_root_node());
this->swap(x);
}
//! <b>Effects</b>: to-do
- //!
+ //!
slist_impl& operator=(BOOST_RV_REF(slist_impl) x)
{ this->swap(x); return *this; }
@@ -700,7 +700,7 @@
//!
//! 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.
@@ -1517,7 +1517,7 @@
void remove_and_dispose_if(Pred pred, Disposer disposer)
{
const_iterator bcur(this->before_begin()), cur(this->begin()), e(this->end());
-
+
while(cur != e){
if (pred(*cur)){
cur = this->erase_after_and_dispose(bcur, disposer);
@@ -1837,7 +1837,7 @@
void priv_shift_forward(size_type n, detail::bool_<false>)
{
- node_ptr last = node_algorithms::move_backwards(this->get_root_node(), (std::size_t)n);
+ node_ptr last = node_algorithms::move_backwards(this->get_root_node(), (std::size_t)n);
if(cache_last && last){
this->set_last_node(last);
}
Modified: branches/release/boost/intrusive/slist_hook.hpp
==============================================================================
--- branches/release/boost/intrusive/slist_hook.hpp (original)
+++ branches/release/boost/intrusive/slist_hook.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/splay_set.hpp
==============================================================================
--- branches/release/boost/intrusive/splay_set.hpp (original)
+++ branches/release/boost/intrusive/splay_set.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -80,7 +80,7 @@
public:
//! <b>Effects</b>: Constructs an empty splay_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -111,13 +111,13 @@
{}
//! <b>Effects</b>: to-do
- //!
+ //!
splay_set_impl(BOOST_RV_REF(splay_set_impl) x)
: tree_(::boost::move(x.tree_))
{}
//! <b>Effects</b>: to-do
- //!
+ //!
splay_set_impl& operator=(BOOST_RV_REF(splay_set_impl) x)
{ tree_ = ::boost::move(x.tree_); return *this; }
@@ -343,7 +343,7 @@
//!
//! 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.
@@ -452,7 +452,7 @@
//! If the check is successful, the user can construct the value_type and use
//! "insert_commit" to insert the object in constant-time. This can give a total
//! constant-time complexity to the insertion: check(O(1)) + commit(O(1)).
- //!
+ //!
//! "commit_data" remains valid for a subsequent "insert_commit" only if no more
//! objects are inserted or erased from the splay_set.
template<class KeyType, class KeyValueCompare>
@@ -934,6 +934,92 @@
equal_range_dont_splay(const KeyType& key, KeyValueCompare comp) const
{ return tree_.equal_range_dont_splay(key, comp); }
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator, const_iterator>
+ bounded_range_dont_splay_dont_splay
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range_dont_splay(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator, const_iterator>
+ bounded_range_dont_splay
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range_dont_splay(lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: value must be an lvalue and shall be in a splay_set of
//! appropriate type. Otherwise the behavior is undefined.
//!
@@ -1312,7 +1398,7 @@
public:
//! <b>Effects</b>: Constructs an empty splay_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -1343,13 +1429,13 @@
{}
//! <b>Effects</b>: to-do
- //!
+ //!
splay_multiset_impl(BOOST_RV_REF(splay_multiset_impl) x)
: tree_(::boost::move(x.tree_))
{}
//! <b>Effects</b>: to-do
- //!
+ //!
splay_multiset_impl& operator=(BOOST_RV_REF(splay_multiset_impl) x)
{ tree_ = ::boost::move(x.tree_); return *this; }
@@ -1575,7 +1661,7 @@
//!
//! 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.
@@ -2073,6 +2159,92 @@
equal_range_dont_splay(const KeyType& key, KeyValueCompare comp) const
{ return tree_.equal_range_dont_splay(key, comp); }
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator, const_iterator>
+ bounded_range_dont_splay
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range_dont_splay(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator, const_iterator>
+ bounded_range_dont_splay
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range_dont_splay(lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
//! appropriate type. Otherwise the behavior is undefined.
//!
Modified: branches/release/boost/intrusive/splay_set_hook.hpp
==============================================================================
--- branches/release/boost/intrusive/splay_set_hook.hpp (original)
+++ branches/release/boost/intrusive/splay_set_hook.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/splaytree.hpp
==============================================================================
--- branches/release/boost/intrusive/splaytree.hpp (original)
+++ branches/release/boost/intrusive/splaytree.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -155,7 +155,7 @@
{}
node_plus_pred_t node_plus_pred_;
} data_;
-
+
const value_compare &priv_comp() const
{ return data_.node_plus_pred_.get(); }
@@ -208,7 +208,7 @@
typedef typename node_algorithms::insert_commit_data insert_commit_data;
//! <b>Effects</b>: Constructs an empty tree.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -217,8 +217,8 @@
splaytree_impl( const value_compare &cmp = value_compare()
, 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));
}
@@ -249,17 +249,17 @@
}
//! <b>Effects</b>: to-do
- //!
+ //!
splaytree_impl(BOOST_RV_REF(splaytree_impl) x)
: data_(::boost::move(x.priv_comp()), ::boost::move(x.priv_value_traits()))
{
- node_algorithms::init_header(this->priv_header_ptr());
+ node_algorithms::init_header(this->priv_header_ptr());
this->priv_size_traits().set_size(size_type(0));
this->swap(x);
}
//! <b>Effects</b>: to-do
- //!
+ //!
splaytree_impl& operator=(BOOST_RV_REF(splaytree_impl) x)
{ this->swap(x); return *this; }
@@ -680,7 +680,7 @@
//! 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>
@@ -1169,6 +1169,104 @@
return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
}
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ {
+ detail::key_nodeptr_comp<KeyValueCompare, splaytree_impl>
+ key_node_comp(comp, this);
+ std::pair<node_ptr, node_ptr> ret
+ (node_algorithms::bounded_range
+ (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed));
+ return std::pair<iterator, iterator>(iterator(ret.first, this), iterator(ret.second, this));
+ }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator,const_iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return this->bounded_range_dont_splay(lower_value, upper_value, priv_comp(), left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator,const_iterator> bounded_range
+ (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ {
+ detail::key_nodeptr_comp<KeyValueCompare, splaytree_impl>
+ key_node_comp(comp, this);
+ std::pair<node_ptr, node_ptr> ret
+ (node_algorithms::bounded_range
+ (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed, false));
+ return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
+ }
+
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//! Cloner should yield to nodes equivalent to the original nodes.
//!
@@ -1179,7 +1277,7 @@
//!
//! 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.
Modified: branches/release/boost/intrusive/splaytree_algorithms.hpp
==============================================================================
--- branches/release/boost/intrusive/splaytree_algorithms.hpp (original)
+++ branches/release/boost/intrusive/splaytree_algorithms.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007.
+// (C) Copyright Ion Gaztanaga 2007-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,8 +15,8 @@
// The code has been modified and (supposely) improved by Ion Gaztanaga.
// Here is the header of the file used as base code:
//
-// splay_tree.h -- implementation of a STL complatible splay tree.
-//
+// splay_tree.h -- implementation of a STL compatible splay tree.
+//
// Copyright (c) 2004 Ralf Mattethat
//
// Permission to copy, use, modify, sell and distribute this software
@@ -24,7 +24,7 @@
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
-// Please send questions, comments, complaints, performance data, etc to
+// Please send questions, comments, complaints, performance data, etc to
// ralf.mattethat_at_[hidden]
//
// Requirements for element type
@@ -95,7 +95,7 @@
//! A splay tree is an implementation of a binary search tree. The tree is
//! self balancing using the splay algorithm as described in
-//!
+//!
//! "Self-Adjusting Binary Search Trees
//! by Daniel Dominic Sleator and Robert Endre Tarjan
//! AT&T Bell Laboratories, Murray Hill, NJ
@@ -190,7 +190,7 @@
{
if(node1 == node2)
return;
-
+
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
swap_nodes(node1, header1, node2, header2);
}
@@ -477,6 +477,38 @@
//! KeyNodePtrCompare is a function object that induces a strict weak
//! ordering compatible with the strict weak ordering used to create the
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyNodePtrCompare>
+ static std::pair<node_ptr, node_ptr> bounded_range
+ (const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp
+ , bool left_closed, bool right_closed, bool splay = true)
+ {
+ std::pair<node_ptr, node_ptr> ret =
+ tree_algorithms::bounded_range(header, lower_key, upper_key, comp, left_closed, right_closed);
+
+ if(splay)
+ splay_up(ret.first, uncast(header));
+ return ret;
+ }
+
+ //! <b>Requires</b>: "header" must be the header node of a tree.
+ //! KeyNodePtrCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
//!
//! <b>Effects</b>: Returns an node_ptr to the first element that is
//! not less than "key" according to "comp" or "header" if that element does
@@ -525,7 +557,7 @@
//! 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).
@@ -548,7 +580,7 @@
//! "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.
@@ -568,7 +600,7 @@
//! <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.
@@ -587,7 +619,7 @@
//! <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.
@@ -650,7 +682,7 @@
//! <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
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
@@ -723,13 +755,13 @@
node_ptr t(header);
if( n == t ) return;
-
+
for( ;; ){
node_ptr p(NodeTraits::get_parent(n));
node_ptr g(NodeTraits::get_parent(p));
if( p == t ) break;
-
+
if( g == t ){
// zig
rotate(n);
@@ -772,10 +804,11 @@
node_ptr leftmost (NodeTraits::get_left(header));
node_ptr rightmost(NodeTraits::get_right(header));
{
+ //Anti-exception rollback, recovers the original header node if an exception is thrown.
detail::splaydown_rollback<NodeTraits> rollback(&t, header, leftmost, rightmost);
- node_ptr null = header;
- node_ptr l = null;
- node_ptr r = null;
+ node_ptr null_node = header;
+ node_ptr l = null_node;
+ node_ptr r = null_node;
for( ;; ){
if(comp(key, t)){
@@ -827,10 +860,12 @@
}
}
- assemble(t, l, r, null);
+ assemble(t, l, r, null_node);
rollback.release();
}
+ //Now recover the original header except for the
+ //splayed root node.
//t is the current root
NodeTraits::set_parent(header, t);
NodeTraits::set_parent(t, header);
@@ -929,7 +964,7 @@
//Test if g is header before breaking tree
//invariants that would make is_header invalid
bool g_is_header = is_header(g);
-
+
if(NodeTraits::get_left(p) == n){
NodeTraits::set_left(p, NodeTraits::get_right(n));
if(NodeTraits::get_left(p) != node_ptr())
Modified: branches/release/boost/intrusive/treap.hpp
==============================================================================
--- branches/release/boost/intrusive/treap.hpp (original)
+++ branches/release/boost/intrusive/treap.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2008
+// (C) Copyright Ion Gaztanaga 2008-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -167,7 +167,7 @@
{}
node_plus_pred_t node_plus_pred_;
} data_;
-
+
const value_compare &priv_comp() const
{ return data_.node_plus_pred_.get(); }
@@ -226,7 +226,7 @@
typedef typename node_algorithms::insert_commit_data insert_commit_data;
//! <b>Effects</b>: Constructs an empty treap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -236,8 +236,8 @@
, const priority_compare &pcmp = priority_compare()
, const value_traits &v_traits = value_traits())
: data_(cmp, pcmp, v_traits)
- {
- node_algorithms::init_header(this->priv_header_ptr());
+ {
+ node_algorithms::init_header(this->priv_header_ptr());
this->priv_size_traits().set_size(size_type(0));
}
@@ -270,19 +270,19 @@
}
//! <b>Effects</b>: to-do
- //!
+ //!
treap_impl(BOOST_RV_REF(treap_impl) x)
: data_( ::boost::move(x.priv_comp())
, ::boost::move(x.priv_pcomp())
, ::boost::move(x.priv_value_traits()))
{
- node_algorithms::init_header(this->priv_header_ptr());
+ node_algorithms::init_header(this->priv_header_ptr());
this->priv_size_traits().set_size(size_type(0));
this->swap(x);
}
//! <b>Effects</b>: to-do
- //!
+ //!
treap_impl& operator=(BOOST_RV_REF(treap_impl) x)
{ this->swap(x); return *this; }
@@ -786,7 +786,7 @@
//! If the check is successful, the user can construct the value_type and use
//! "insert_commit" to insert the object in constant-time. This can give a total
//! constant-time complexity to the insertion: check(O(1)) + commit(O(1)).
- //!
+ //!
//! "commit_data" remains valid for a subsequent "insert_commit" only if no more
//! objects are inserted or erased from the container.
template<class KeyType, class KeyValueCompare, class KeyValuePrioCompare>
@@ -1339,6 +1339,104 @@
return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
}
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ {
+ detail::key_nodeptr_comp<KeyValueCompare, treap_impl>
+ key_node_comp(comp, this);
+ std::pair<node_ptr, node_ptr> ret
+ (node_algorithms::bounded_range
+ (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed));
+ return std::pair<iterator, iterator>(iterator(ret.first, this), iterator(ret.second, this));
+ }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator,const_iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator,const_iterator> bounded_range
+ (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ {
+ detail::key_nodeptr_comp<KeyValueCompare, treap_impl>
+ key_node_comp(comp, this);
+ std::pair<node_ptr, node_ptr> ret
+ (node_algorithms::bounded_range
+ (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed));
+ return std::pair<const_iterator, const_iterator>(const_iterator(ret.first, this), const_iterator(ret.second, this));
+ }
+
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//! Cloner should yield to nodes equivalent to the original nodes.
//!
@@ -1349,7 +1447,7 @@
//!
//! 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.
Modified: branches/release/boost/intrusive/treap_algorithms.hpp
==============================================================================
--- branches/release/boost/intrusive/treap_algorithms.hpp (original)
+++ branches/release/boost/intrusive/treap_algorithms.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -92,7 +92,7 @@
tree_algorithms::erase(header_, z_);
}
}
-
+
void release()
{ remove_it_ = false; }
@@ -117,7 +117,7 @@
rotate_up_n(header_, p_, n_);
}
}
-
+
void release()
{ remove_it_ = false; }
@@ -199,7 +199,7 @@
{
if(node1 == node2)
return;
-
+
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
swap_nodes(node1, header1, node2, header2);
}
@@ -400,7 +400,7 @@
//! <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
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
@@ -499,6 +499,31 @@
(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
@@ -557,7 +582,7 @@
//! NodePtrPriorityCompare is a priority function object that induces a strict weak
//! ordering compatible with the one used to create the
//! the tree. NodePtrPriorityCompare compares two node_ptrs.
- //!
+ //!
//! <b>Effects</b>: Inserts new_node into the tree, using "hint" as a hint to
//! where it will be inserted. If "hint" is the upper_bound
//! the insertion takes constant time (two comparisons in the worst case).
@@ -585,7 +610,7 @@
//! NodePtrPriorityCompare is a priority function object that induces a strict weak
//! ordering compatible with the one used to create the
//! the tree. NodePtrPriorityCompare compares two node_ptrs.
- //!
+ //!
//! <b>Effects</b>: Inserts new_node into the tree before "pos"
//! and rotates the tree according to "pcomp".
//!
@@ -611,7 +636,7 @@
//! NodePtrPriorityCompare is a priority function object that induces a strict weak
//! ordering compatible with the one used to create the
//! the tree. NodePtrPriorityCompare compares two node_ptrs.
- //!
+ //!
//! <b>Effects</b>: Inserts x into the tree in the last position
//! and rotates the tree according to "pcomp".
//!
@@ -636,7 +661,7 @@
//! NodePtrPriorityCompare is a priority function object that induces a strict weak
//! ordering compatible with the one used to create the
//! the tree. NodePtrPriorityCompare compares two node_ptrs.
- //!
+ //!
//! <b>Effects</b>: Inserts x into the tree in the first position
//! and rotates the tree according to "pcomp".
//!
Modified: branches/release/boost/intrusive/treap_set.hpp
==============================================================================
--- branches/release/boost/intrusive/treap_set.hpp (original)
+++ branches/release/boost/intrusive/treap_set.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -81,7 +81,7 @@
public:
//! <b>Effects</b>: Constructs an empty treap_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -114,13 +114,13 @@
{}
//! <b>Effects</b>: to-do
- //!
+ //!
treap_set_impl(BOOST_RV_REF(treap_set_impl) x)
: tree_(::boost::move(x.tree_))
{}
//! <b>Effects</b>: to-do
- //!
+ //!
treap_set_impl& operator=(BOOST_RV_REF(treap_set_impl) x)
{ tree_ = ::boost::move(x.tree_); return *this; }
@@ -405,7 +405,7 @@
//!
//! 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.
@@ -524,7 +524,7 @@
//! If the check is successful, the user can construct the value_type and use
//! "insert_commit" to insert the object in constant-time. This can give a total
//! constant-time complexity to the insertion: check(O(1)) + commit(O(1)).
- //!
+ //!
//! "commit_data" remains valid for a subsequent "insert_commit" only if no more
//! objects are inserted or erased from the treap_set.
template<class KeyType, class KeyValueCompare, class KeyValuePriorityCompare>
@@ -1043,6 +1043,91 @@
equal_range(const KeyType& key, KeyValueCompare comp) const
{ return tree_.equal_range(key, comp); }
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator, const_iterator>
+ bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator, const_iterator>
+ bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: value must be an lvalue and shall be in a treap_set of
//! appropriate type. Otherwise the behavior is undefined.
//!
@@ -1407,7 +1492,7 @@
public:
//! <b>Effects</b>: Constructs an empty treap_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -1440,13 +1525,13 @@
{}
//! <b>Effects</b>: to-do
- //!
+ //!
treap_multiset_impl(BOOST_RV_REF(treap_multiset_impl) x)
: tree_(::boost::move(x.tree_))
{}
//! <b>Effects</b>: to-do
- //!
+ //!
treap_multiset_impl& operator=(BOOST_RV_REF(treap_multiset_impl) x)
{ tree_ = ::boost::move(x.tree_); return *this; }
@@ -1731,7 +1816,7 @@
//!
//! 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.
@@ -2265,6 +2350,91 @@
equal_range(const KeyType& key, KeyValueCompare comp) const
{ return tree_.equal_range(key, comp); }
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<iterator,iterator> bounded_range
+ (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<iterator,iterator> bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed)
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
+ //! <b>Requires</b>: 'lower_value' must not be greater than 'upper_value'. If
+ //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
+ //!
+ //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If the predicate throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_value and upper_value.
+ std::pair<const_iterator, const_iterator>
+ bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); }
+
+ //! <b>Requires</b>: KeyValueCompare is a function object that induces a strict weak
+ //! ordering compatible with the strict weak ordering used to create the
+ //! the tree.
+ //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
+ //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
+ //!
+ //! <b>Effects</b>: Returns an a pair with the following criteria:
+ //!
+ //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise
+ //!
+ //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise
+ //!
+ //! <b>Complexity</b>: Logarithmic.
+ //!
+ //! <b>Throws</b>: If "comp" throws.
+ //!
+ //! <b>Note</b>: This function can be more efficient than calling upper_bound
+ //! and lower_bound for lower_key and upper_key.
+ template<class KeyType, class KeyValueCompare>
+ std::pair<const_iterator, const_iterator>
+ bounded_range
+ (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const
+ { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); }
+
//! <b>Requires</b>: value must be an lvalue and shall be in a treap_multiset of
//! appropriate type. Otherwise the behavior is undefined.
//!
Modified: branches/release/boost/intrusive/trivial_value_traits.hpp
==============================================================================
--- branches/release/boost/intrusive/trivial_value_traits.hpp (original)
+++ branches/release/boost/intrusive/trivial_value_traits.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
Modified: branches/release/boost/intrusive/unordered_set.hpp
==============================================================================
--- branches/release/boost/intrusive/unordered_set.hpp (original)
+++ branches/release/boost/intrusive/unordered_set.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -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
@@ -113,7 +113,7 @@
//!
//! <b>Effects</b>: Constructs an empty unordered_set_impl, storing a reference
//! to the bucket array and copies of the hasher and equal functors.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -134,7 +134,7 @@
//!
//! <b>Effects</b>: Constructs an empty unordered_set and inserts elements from
//! [b, e).
- //!
+ //!
//! <b>Complexity</b>: If N is std::distance(b, e): Average case is O(N)
//! (with a good hash function and with buckets_len >= N),worst case O(N2).
//!
@@ -155,13 +155,13 @@
{ table_.insert_unique(b, e); }
//! <b>Effects</b>: to-do
- //!
+ //!
unordered_set_impl(BOOST_RV_REF(unordered_set_impl) x)
: table_(::boost::move(x.table_))
{}
//! <b>Effects</b>: to-do
- //!
+ //!
unordered_set_impl& operator=(BOOST_RV_REF(unordered_set_impl) x)
{ table_ = ::boost::move(x.table_); return *this; }
@@ -290,7 +290,7 @@
//!
//! If any operation throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
//! <b>Throws</b>: If cloner or hasher throw or hash or equality predicate copying
@@ -1184,7 +1184,7 @@
//!
//! <b>Effects</b>: Constructs an empty unordered_multiset, storing a reference
//! to the bucket array and copies of the hasher and equal functors.
- //!
+ //!
//! <b>Complexity</b>: Constant.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
@@ -1205,7 +1205,7 @@
//!
//! <b>Effects</b>: Constructs an empty unordered_multiset and inserts elements from
//! [b, e).
- //!
+ //!
//! <b>Complexity</b>: If N is std::distance(b, e): Average case is O(N)
//! (with a good hash function and with buckets_len >= N),worst case O(N2).
//!
@@ -1226,13 +1226,13 @@
{ table_.insert_equal(b, e); }
//! <b>Effects</b>: to-do
- //!
+ //!
unordered_multiset_impl(BOOST_RV_REF(unordered_multiset_impl) x)
: table_(::boost::move(x.table_))
{}
//! <b>Effects</b>: to-do
- //!
+ //!
unordered_multiset_impl& operator=(BOOST_RV_REF(unordered_multiset_impl) x)
{ table_ = ::boost::move(x.table_); return *this; }
@@ -1362,7 +1362,7 @@
//!
//! If any operation throws, all cloned elements are unlinked and disposed
//! calling Disposer::operator()(pointer).
- //!
+ //!
//! <b>Complexity</b>: Linear to erased plus inserted elements.
//!
//! <b>Throws</b>: If cloner or hasher throw or hash or equality predicate copying
Modified: branches/release/boost/intrusive/unordered_set_hook.hpp
==============================================================================
--- branches/release/boost/intrusive/unordered_set_hook.hpp (original)
+++ branches/release/boost/intrusive/unordered_set_hook.hpp 2012-07-16 04:39:22 EDT (Mon, 16 Jul 2012)
@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
-// (C) Copyright Ion Gaztanaga 2006-2009
+// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -95,10 +95,10 @@
{ n->prev_in_group_ = prev; }
static std::size_t get_hash(const const_node_ptr & n)
- { return n->hash_; }
+ { return n->hash_; }
static void set_hash(const node_ptr & n, std::size_t h)
- { n->hash_ = h; }
+ { n->hash_ = h; }
};
template<class NodeTraits>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk