mirror of
https://github.com/boostorg/intrusive.git
synced 2026-04-29 10:13:18 +02:00
- Implemented map and multimap-like interfaces.
- Refactored hashtable containers to reduce template instantiations.
This commit is contained in:
@@ -28,6 +28,9 @@ doxygen autodoc
|
||||
<doxygen:param>"PREDEFINED=\"BOOST_INTRUSIVE_DOXYGEN_INVOKED\" \\
|
||||
\"BOOST_INTRUSIVE_IMPDEF(T)=implementation_defined\" \\
|
||||
\"BOOST_INTRUSIVE_SEEDOC(T)=see_documentation\" \\
|
||||
\"BOOST_INTRUSIVE_DOC1ST(T1,T2)=T1\" \\
|
||||
\"BOOST_INTRUSIVE_DOCIGN(T)=\" \\
|
||||
\"BOOST_INTRUSIVE_I(T)=,\" \\
|
||||
\"BOOST_RV_REF(T)=T &&\" \\
|
||||
\"BOOST_RV_REF_BEG=\" \\
|
||||
\"BOOST_RV_REF_END=&&\" \\
|
||||
|
||||
+68
-3
@@ -6,9 +6,9 @@
|
||||
/]
|
||||
|
||||
[library Boost.Intrusive
|
||||
[quickbook 1.5]
|
||||
[quickbook 1.6]
|
||||
[authors [Krzikalla, Olaf], [Gaztanaga, Ion]]
|
||||
[copyright 2005 Olaf Krzikalla, 2006-2013 Ion Gaztanaga]
|
||||
[copyright 2005 Olaf Krzikalla, 2006-2015 Ion Gaztanaga]
|
||||
[id intrusive]
|
||||
[dirname intrusive]
|
||||
[purpose Intrusive containers]
|
||||
@@ -1098,6 +1098,11 @@ And they also can receive an additional option:
|
||||
in containers. The comparison functor must induce a strict weak ordering.
|
||||
Default: `compare< std::less<T> >`
|
||||
|
||||
* [*`key_of_value<class KeyOfValueFunctionObject>`]: A function object that will
|
||||
define the `key_type` of the value type to be stored. This type will allow a map-like interface. See
|
||||
[link intrusive.map_multimap Map and multimap-like interface with set and multiset]
|
||||
for details. Default: `key_type` is equal to `value_type` (set-like interface).
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:set_multiset_example Example]
|
||||
@@ -1323,6 +1328,11 @@ And they also can receive additional options:
|
||||
[@http://en.wikipedia.org/wiki/Linear_hashing `Linear hash` on Wikipedia]
|
||||
Default: `incremental<false>`
|
||||
|
||||
* [*`key_of_value<class KeyOfValueFunctionObject>`]: A function object that will
|
||||
define the `key_type` of the value type to be stored. This type will allow a map-like interface. See
|
||||
[link intrusive.map_multimap Map and multimap-like interface with set and multiset]
|
||||
for details. Default: `key_type` is equal to `value_type` (set-like interface).
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:unordered_set_unordered_multiset_example Example]
|
||||
@@ -1364,6 +1374,34 @@ the unordered container:
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:map_multimap Map and multimap-like interface for associative containers]
|
||||
|
||||
Implementing map-like intrusive containers is not a trivial task as
|
||||
STL's `std::map` and `std::multimap` containers store copies of a `value_type` which is defined
|
||||
as `std::pair<const key_type, mapped_type>`. To really mimick this interface in [*Boost.Intrusive]
|
||||
it shall require that objects stored in the intrusive containers contain that `std::pair` member with
|
||||
`pair.first` hardcoded as the key part and `pair.second` hardcoded as the `mapped_type`, which
|
||||
is limiting and also not very useful in practice. Any intrusive associative container can be used like
|
||||
a map using [link intrusive.advanced_lookups_insertions advanced lookup and insertions] and the user
|
||||
can change the key type in each lookup/insertion check call.
|
||||
|
||||
On the other hand, in many cases containers are indexed by a well-known key type, and the user is forced
|
||||
to write some repetitive code using advanced lookup and insertions. [*Boost.Intrusive]
|
||||
associative containers offer an alternative to build a useful map-like lookup interfaces
|
||||
without forcing users to define `value_type`s containing `std::pair`-like classes.
|
||||
The option is called [classref boost::intrusive::key_of_value].
|
||||
|
||||
If a user specifies that option when defining a `set/multiset` intrusive container, it specifies a function object
|
||||
that will tell the container which is the type of the ['key] that `value_type` holds and how to obtain it. This
|
||||
function object must be lightweight, `DefaultConstructible`, it shall define a `type` member that defines the type
|
||||
of the key and a member function to obtain a const reference to the key stored inside a `value_type`. Let's
|
||||
see an example of how a set can be configured as a map indexed by an integer stored in the `value_type`.
|
||||
|
||||
[import ../example/doc_map.cpp]
|
||||
[doc_map_code]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:avl_set_multiset Intrusive avl tree based associative containers: avl_set, avl_multiset and avltree]
|
||||
|
||||
Similar to red-black trees, AVL trees are balanced binary trees.
|
||||
@@ -1476,6 +1514,11 @@ And they also can receive an additional option:
|
||||
in containers. The comparison functor must induce a strict weak ordering.
|
||||
Default: `compare< std::less<T> >`
|
||||
|
||||
* [*`key_of_value<class KeyOfValueFunctionObject>`]: A function object that will
|
||||
define the `key_type` of the value type to be stored. This type will allow a map-like interface. See
|
||||
[link intrusive.map_multimap Map and multimap-like interface with set and multiset]
|
||||
for details. Default: `key_type` is equal to `value_type` (set-like interface).
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:avl_set_multiset_example Example]
|
||||
@@ -1573,6 +1616,11 @@ And they also can receive an additional option:
|
||||
in containers. The comparison functor must induce a strict weak ordering.
|
||||
Default: `compare< std::less<T> >`
|
||||
|
||||
* [*`key_of_value<class KeyOfValueFunctionObject>`]: A function object that will
|
||||
define the `key_type` of the value type to be stored. This type will allow a map-like interface. See
|
||||
[link intrusive.map_multimap Map and multimap-like interface with set and multiset]
|
||||
for details. Default: `key_type` is equal to `value_type` (set-like interface).
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:splay_set_multiset_example Example]
|
||||
@@ -1686,6 +1734,11 @@ And they also can receive additional options:
|
||||
performance. The fixed a factor that is used when this option is activated
|
||||
is ['1/sqrt(2) ~ 0,70711]. Default: `floating_point<true>`
|
||||
|
||||
* [*`key_of_value<class KeyOfValueFunctionObject>`]: A function object that will
|
||||
define the `key_type` of the value type to be stored. This type will allow a map-like interface. See
|
||||
[link intrusive.map_multimap Map and multimap-like interface with set and multiset]
|
||||
for details. Default: `key_type` is equal to `value_type` (set-like interface).
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:sg_set_multiset_example Example]
|
||||
@@ -1781,11 +1834,16 @@ And they also can receive additional options:
|
||||
in containers. The comparison functor must induce a strict weak ordering.
|
||||
Default: `priority< priority_compare<T> >`
|
||||
|
||||
* [*`key_of_value<class KeyOfValueFunctionObject>`]: A function object that will
|
||||
define the `key_type` of the value type to be stored. This type will allow a map-like interface. See
|
||||
[link intrusive.map_multimap Map and multimap-like interface with set and multiset]
|
||||
for details. Default: `key_type` is equal to `value_type` (set-like interface).
|
||||
|
||||
The default `priority_compare<T>` object function will call an unqualified function `priority_order`
|
||||
passing two constant `T` references as arguments and should return true if the first argument has
|
||||
higher priority (it will be searched faster), inducing strict weak ordering.
|
||||
The function will be found using ADL lookup so that
|
||||
the user just needs to define a `priority_order` function in the same namespace as his class:
|
||||
the user just needs to define a `priority_order` function in the same namespace as the class:
|
||||
|
||||
[c++]
|
||||
|
||||
@@ -3761,6 +3819,13 @@ to be inserted in intrusive containers are allocated using `std::vector` or `std
|
||||
|
||||
[section:release_notes Release Notes]
|
||||
|
||||
[section:release_notes_boost_1_59_00 Boost 1.59 Release]
|
||||
|
||||
* Implemented [link intrusive.map_multimap map and multimap-like interfaces].
|
||||
* Refactored hashtable containers to reduce template instantiations.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:release_notes_boost_1_58_00 Boost 1.58 Release]
|
||||
|
||||
* Reduced compile-time dependencies, headers, and the use of Boost.Preprocessor, specially for hooks and iterators.
|
||||
|
||||
+215
-175
@@ -40,15 +40,15 @@ namespace intrusive {
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
#endif
|
||||
class avl_set_impl
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
: public bstree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder>
|
||||
: public bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder>
|
||||
#endif
|
||||
{
|
||||
/// @cond
|
||||
typedef bstree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder> tree_type;
|
||||
typedef bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder> tree_type;
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_set_impl)
|
||||
|
||||
typedef tree_type implementation_defined;
|
||||
@@ -56,6 +56,8 @@ class avl_set_impl
|
||||
|
||||
public:
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::key_of_value key_of_value;
|
||||
typedef typename implementation_defined::value_traits value_traits;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
@@ -80,16 +82,16 @@ class avl_set_impl
|
||||
|
||||
public:
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::avltree(const value_compare &,const value_traits &)
|
||||
explicit avl_set_impl( const value_compare &cmp = value_compare()
|
||||
//! @copydoc ::boost::intrusive::avltree::avltree(const key_compare &,const value_traits &)
|
||||
explicit avl_set_impl( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::avltree(bool,Iterator,Iterator,const value_compare &,const value_traits &)
|
||||
//! @copydoc ::boost::intrusive::avltree::avltree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
|
||||
template<class Iterator>
|
||||
avl_set_impl( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(true, b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -171,11 +173,20 @@ class avl_set_impl
|
||||
//! @copydoc ::boost::intrusive::avltree::swap
|
||||
void swap(avl_set_impl& other);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::clone_from
|
||||
//! @copydoc ::boost::intrusive::avltree::clone_from(const avltree&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const avl_set_impl &src, Cloner cloner, Disposer disposer);
|
||||
|
||||
#endif //#ifdef BOOST_iNTRUSIVE_DOXYGEN_INVOKED
|
||||
#else
|
||||
|
||||
using tree_type::clone_from;
|
||||
|
||||
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::clone_from(avltree&&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(avl_set_impl) src, Cloner cloner, Disposer disposer)
|
||||
{ tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::insert_unique(reference)
|
||||
std::pair<iterator, bool> insert(reference value)
|
||||
@@ -185,18 +196,18 @@ class avl_set_impl
|
||||
iterator insert(const_iterator hint, reference value)
|
||||
{ return tree_type::insert_unique(hint, value); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::insert_unique_check(const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::avltree::insert_unique_check(const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_check
|
||||
(const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(key, key_value_comp, commit_data); }
|
||||
(const KeyType &key, KeyTypeKeyCompare comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(key, comp, commit_data); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::insert_unique_check(const_iterator,const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::avltree::insert_unique_check(const_iterator,const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_check
|
||||
(const_iterator hint, const KeyType &key
|
||||
,KeyValueCompare key_value_comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(hint, key, key_value_comp, commit_data); }
|
||||
,KeyTypeKeyCompare comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(hint, key, comp, commit_data); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::insert_unique(Iterator,Iterator)
|
||||
template<class Iterator>
|
||||
@@ -223,12 +234,12 @@ class avl_set_impl
|
||||
//! @copydoc ::boost::intrusive::avltree::erase(const_iterator,const_iterator)
|
||||
iterator erase(const_iterator b, const_iterator e);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::erase(const_reference)
|
||||
size_type erase(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::avltree::erase(const key_type &key)
|
||||
size_type erase(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::erase(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::avltree::erase(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const_iterator,Disposer)
|
||||
template<class Disposer>
|
||||
@@ -238,13 +249,13 @@ class avl_set_impl
|
||||
template<class Disposer>
|
||||
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const_reference, Disposer)
|
||||
//! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const key_type &, Disposer)
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer);
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
|
||||
//! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::clear
|
||||
void clear();
|
||||
@@ -255,100 +266,100 @@ class avl_set_impl
|
||||
|
||||
#endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::count(const_reference)const
|
||||
size_type count(const_reference value) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(value) != this->tree_type::cend()); }
|
||||
//! @copydoc ::boost::intrusive::avltree::count(const key_type &)const
|
||||
size_type count(const key_type &key) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(key) != this->tree_type::cend()); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp) const
|
||||
//! @copydoc ::boost::intrusive::avltree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(key, comp) != this->tree_type::cend()); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::lower_bound(const_reference)
|
||||
iterator lower_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::avltree::lower_bound(const key_type &)
|
||||
iterator lower_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::lower_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::avltree::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::lower_bound(const_reference)const
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::avltree::lower_bound(const key_type &)const
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::avltree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::upper_bound(const_reference)
|
||||
iterator upper_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::avltree::upper_bound(const key_type &)
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::upper_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::avltree::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::upper_bound(const_reference)const
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::avltree::upper_bound(const key_type &)const
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::avltree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::find(const_reference)
|
||||
iterator find(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::avltree::find(const key_type &)
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::find(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::avltree::find(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::find(const_reference)const
|
||||
const_iterator find(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::avltree::find(const key_type &)const
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::find(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::avltree::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
#endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const_reference)
|
||||
std::pair<iterator,iterator> equal_range(const_reference value)
|
||||
{ return this->tree_type::lower_bound_range(value); }
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const key_type &)
|
||||
std::pair<iterator,iterator> equal_range(const key_type &key)
|
||||
{ return this->tree_type::lower_bound_range(key); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp)
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp)
|
||||
{ return this->tree_type::lower_bound_range(key, comp); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const key_type &)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const_reference value) const
|
||||
{ return this->tree_type::lower_bound_range(value); }
|
||||
equal_range(const key_type &key) const
|
||||
{ return this->tree_type::lower_bound_range(key); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const KeyType& key, KeyValueCompare comp) const
|
||||
equal_range(const KeyType& key, KeyTypeKeyCompare comp) const
|
||||
{ return this->tree_type::lower_bound_range(key, comp); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::avltree::bounded_range(const key_type &,const key_type &,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::avltree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::avltree::bounded_range(const key_type &,const key_type &,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
bounded_range(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::avltree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -402,7 +413,7 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_avl_set
|
||||
{
|
||||
@@ -410,7 +421,7 @@ struct make_avl_set
|
||||
typedef typename pack_options
|
||||
< avltree_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -421,6 +432,7 @@ struct make_avl_set
|
||||
|
||||
typedef avl_set_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::size_type
|
||||
, packed_options::constant_time_size
|
||||
@@ -432,14 +444,14 @@ struct make_avl_set
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class avl_set
|
||||
: public make_avl_set<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -448,7 +460,7 @@ class avl_set
|
||||
typedef typename make_avl_set
|
||||
<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -456,7 +468,7 @@ class avl_set
|
||||
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_set)
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
typedef typename Base::const_iterator const_iterator;
|
||||
@@ -464,14 +476,14 @@ class avl_set
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
explicit avl_set( const value_compare &cmp = value_compare()
|
||||
explicit avl_set( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, v_traits)
|
||||
{}
|
||||
|
||||
template<class Iterator>
|
||||
avl_set( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -483,6 +495,14 @@ class avl_set
|
||||
avl_set& operator=(BOOST_RV_REF(avl_set) x)
|
||||
{ return static_cast<avl_set &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const avl_set &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(avl_set) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static avl_set &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<avl_set &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
@@ -512,15 +532,15 @@ class avl_set
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
#endif
|
||||
class avl_multiset_impl
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
: public bstree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder>
|
||||
: public bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder>
|
||||
#endif
|
||||
{
|
||||
/// @cond
|
||||
typedef bstree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder> tree_type;
|
||||
typedef bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder> tree_type;
|
||||
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_multiset_impl)
|
||||
typedef tree_type implementation_defined;
|
||||
@@ -528,6 +548,8 @@ class avl_multiset_impl
|
||||
|
||||
public:
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::key_of_value key_of_value;
|
||||
typedef typename implementation_defined::value_traits value_traits;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
@@ -551,16 +573,16 @@ class avl_multiset_impl
|
||||
static const bool constant_time_size = tree_type::constant_time_size;
|
||||
|
||||
public:
|
||||
//! @copydoc ::boost::intrusive::avltree::avltree(const value_compare &,const value_traits &)
|
||||
explicit avl_multiset_impl( const value_compare &cmp = value_compare()
|
||||
//! @copydoc ::boost::intrusive::avltree::avltree(const key_compare &,const value_traits &)
|
||||
explicit avl_multiset_impl( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::avltree(bool,Iterator,Iterator,const value_compare &,const value_traits &)
|
||||
//! @copydoc ::boost::intrusive::avltree::avltree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
|
||||
template<class Iterator>
|
||||
avl_multiset_impl( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(false, b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -641,11 +663,20 @@ class avl_multiset_impl
|
||||
//! @copydoc ::boost::intrusive::avltree::swap
|
||||
void swap(avl_multiset_impl& other);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::clone_from
|
||||
//! @copydoc ::boost::intrusive::avltree::clone_from(const avltree&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const avl_multiset_impl &src, Cloner cloner, Disposer disposer);
|
||||
|
||||
#endif //#ifdef BOOST_iNTRUSIVE_DOXYGEN_INVOKED
|
||||
#else
|
||||
|
||||
using tree_type::clone_from;
|
||||
|
||||
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::clone_from(avltree&&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(avl_multiset_impl) src, Cloner cloner, Disposer disposer)
|
||||
{ tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::insert_equal(reference)
|
||||
iterator insert(reference value)
|
||||
@@ -676,12 +707,12 @@ class avl_multiset_impl
|
||||
//! @copydoc ::boost::intrusive::avltree::erase(const_iterator,const_iterator)
|
||||
iterator erase(const_iterator b, const_iterator e);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::erase(const_reference)
|
||||
size_type erase(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::avltree::erase(const key_type &)
|
||||
size_type erase(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::erase(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::avltree::erase(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const_iterator,Disposer)
|
||||
template<class Disposer>
|
||||
@@ -691,13 +722,13 @@ class avl_multiset_impl
|
||||
template<class Disposer>
|
||||
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const_reference, Disposer)
|
||||
//! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const key_type &, Disposer)
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer);
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
|
||||
//! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::clear
|
||||
void clear();
|
||||
@@ -706,88 +737,88 @@ class avl_multiset_impl
|
||||
template<class Disposer>
|
||||
void clear_and_dispose(Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::count(const_reference)const
|
||||
size_type count(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::avltree::count(const key_type &)const
|
||||
size_type count(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::avltree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::lower_bound(const_reference)
|
||||
iterator lower_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::avltree::lower_bound(const key_type &)
|
||||
iterator lower_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::lower_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::avltree::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::lower_bound(const_reference)const
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::avltree::lower_bound(const key_type &)const
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::avltree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::upper_bound(const_reference)
|
||||
iterator upper_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::avltree::upper_bound(const key_type &)
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::upper_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::avltree::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::upper_bound(const_reference)const
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::avltree::upper_bound(const key_type &)const
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::avltree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::find(const_reference)
|
||||
iterator find(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::avltree::find(const key_type &)
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::find(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::avltree::find(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::find(const_reference)const
|
||||
const_iterator find(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::avltree::find(const key_type &)const
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::find(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::avltree::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::equal_range(const_reference)
|
||||
std::pair<iterator,iterator> equal_range(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::avltree::equal_range(const key_type &)
|
||||
std::pair<iterator,iterator> equal_range(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::equal_range(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::avltree::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::avltree::equal_range(const key_type &)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const_reference value) const;
|
||||
equal_range(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::equal_range(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::avltree::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const KeyType& key, KeyValueCompare comp) const;
|
||||
equal_range(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::avltree::bounded_range(const key_type &,const key_type &,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::avltree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::avltree::bounded_range(const key_type &,const key_type &,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
bounded_range(const key_type &lower_key, const key_type &key upper_key, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::avltree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::avltree::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -841,7 +872,7 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_avl_multiset
|
||||
{
|
||||
@@ -849,7 +880,7 @@ struct make_avl_multiset
|
||||
typedef typename pack_options
|
||||
< avltree_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -860,6 +891,7 @@ struct make_avl_multiset
|
||||
|
||||
typedef avl_multiset_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::size_type
|
||||
, packed_options::constant_time_size
|
||||
@@ -872,14 +904,14 @@ struct make_avl_multiset
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class avl_multiset
|
||||
: public make_avl_multiset<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -887,7 +919,7 @@ class avl_multiset
|
||||
{
|
||||
typedef typename make_avl_multiset<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -896,7 +928,7 @@ class avl_multiset
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_multiset)
|
||||
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
typedef typename Base::const_iterator const_iterator;
|
||||
@@ -904,14 +936,14 @@ class avl_multiset
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
explicit avl_multiset( const value_compare &cmp = value_compare()
|
||||
explicit avl_multiset( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, v_traits)
|
||||
{}
|
||||
|
||||
template<class Iterator>
|
||||
avl_multiset( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -923,6 +955,14 @@ class avl_multiset
|
||||
avl_multiset& operator=(BOOST_RV_REF(avl_multiset) x)
|
||||
{ return static_cast<avl_multiset &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const avl_multiset &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(avl_multiset) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static avl_multiset &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<avl_multiset &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
|
||||
@@ -48,19 +48,16 @@ struct is_default_hook_tag<default_avltree_hook_applier>
|
||||
{ static const bool value = true; };
|
||||
|
||||
struct avltree_defaults
|
||||
: bstree_defaults
|
||||
{
|
||||
typedef default_avltree_hook_applier proto_value_traits;
|
||||
static const bool constant_time_size = true;
|
||||
typedef std::size_t size_type;
|
||||
typedef void compare;
|
||||
typedef void header_holder_type;
|
||||
};
|
||||
|
||||
/// @endcond
|
||||
|
||||
//! The class template avltree is an intrusive AVL tree container, that
|
||||
//! is used to construct intrusive avl_set and avl_multiset containers.
|
||||
//! The no-throw guarantee holds only, if the value_compare object
|
||||
//! The no-throw guarantee holds only, if the key_compare object
|
||||
//! doesn't throw.
|
||||
//!
|
||||
//! The template parameter \c T is the type to be managed by the container.
|
||||
@@ -74,17 +71,17 @@ struct avltree_defaults
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class VoidOrKeyComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
#endif
|
||||
class avltree_impl
|
||||
/// @cond
|
||||
: public bstree_impl<ValueTraits, VoidOrKeyComp, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder>
|
||||
: public bstree_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder>
|
||||
/// @endcond
|
||||
{
|
||||
public:
|
||||
typedef ValueTraits value_traits;
|
||||
/// @cond
|
||||
typedef bstree_impl< ValueTraits, VoidOrKeyComp, SizeType
|
||||
typedef bstree_impl< ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType
|
||||
, ConstantTimeSize, AvlTreeAlgorithms
|
||||
, HeaderHolder> tree_type;
|
||||
typedef tree_type implementation_defined;
|
||||
@@ -94,6 +91,7 @@ class avltree_impl
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::key_of_value key_of_value;
|
||||
typedef typename implementation_defined::reference reference;
|
||||
typedef typename implementation_defined::const_reference const_reference;
|
||||
typedef typename implementation_defined::difference_type difference_type;
|
||||
@@ -124,16 +122,16 @@ class avltree_impl
|
||||
typedef typename implementation_defined::insert_commit_data insert_commit_data;
|
||||
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(const value_compare &,const value_traits &)
|
||||
explicit avltree_impl( const value_compare &cmp = value_compare()
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(const key_compare &,const value_traits &)
|
||||
explicit avltree_impl( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(bool,Iterator,Iterator,const value_compare &,const value_traits &)
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
|
||||
template<class Iterator>
|
||||
avltree_impl( bool unique, Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(unique, b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -215,10 +213,23 @@ class avltree_impl
|
||||
//! @copydoc ::boost::intrusive::bstree::swap
|
||||
void swap(avltree_impl& other);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from(const bstree&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const avltree_impl &src, Cloner cloner, Disposer disposer);
|
||||
|
||||
#else //BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
using tree_type::clone_from;
|
||||
|
||||
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from(bstree&&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(avltree_impl) src, Cloner cloner, Disposer disposer)
|
||||
{ tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_equal(reference)
|
||||
iterator insert_equal(reference value);
|
||||
|
||||
@@ -235,16 +246,16 @@ class avltree_impl
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique(const_iterator,reference)
|
||||
iterator insert_unique(const_iterator hint, reference value);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_unique_check
|
||||
(const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data);
|
||||
(const KeyType &key, KeyTypeKeyCompare comp, insert_commit_data &commit_data);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const_iterator,const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const_iterator,const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_unique_check
|
||||
(const_iterator hint, const KeyType &key
|
||||
,KeyValueCompare key_value_comp, insert_commit_data &commit_data);
|
||||
,KeyTypeKeyCompare comp, insert_commit_data &commit_data);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_commit
|
||||
iterator insert_unique_commit(reference value, const insert_commit_data &commit_data);
|
||||
@@ -268,12 +279,12 @@ class avltree_impl
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const_iterator,const_iterator)
|
||||
iterator erase(const_iterator b, const_iterator e);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const_reference)
|
||||
size_type erase(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const key_type &)
|
||||
size_type erase(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_iterator,Disposer)
|
||||
template<class Disposer>
|
||||
@@ -283,13 +294,13 @@ class avltree_impl
|
||||
template<class Disposer>
|
||||
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_reference, Disposer)
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const key_type &, Disposer)
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer);
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clear
|
||||
void clear();
|
||||
@@ -298,88 +309,88 @@ class avltree_impl
|
||||
template<class Disposer>
|
||||
void clear_and_dispose(Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const_reference)const
|
||||
size_type count(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const key_type &ke)const
|
||||
size_type count(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)
|
||||
iterator lower_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)
|
||||
iterator lower_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)const
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)const
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const_reference)
|
||||
iterator upper_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &key)
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const_reference)const
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)const
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const_reference)
|
||||
iterator find(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const key_type &)
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const_reference)const
|
||||
const_iterator find(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const key_type &)const
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const_reference)
|
||||
std::pair<iterator,iterator> equal_range(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)
|
||||
std::pair<iterator,iterator> equal_range(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const_reference value) const;
|
||||
equal_range(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const KeyType& key, KeyValueCompare comp) const;
|
||||
equal_range(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type &,const key_type &,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
(const key_type &lower, const key_type &upper_key, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type &,const key_type &,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
bounded_range(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -429,7 +440,7 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_avltree
|
||||
{
|
||||
@@ -437,7 +448,7 @@ struct make_avltree
|
||||
typedef typename pack_options
|
||||
< avltree_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -448,6 +459,7 @@ struct make_avltree
|
||||
|
||||
typedef avltree_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::size_type
|
||||
, packed_options::constant_time_size
|
||||
@@ -461,14 +473,14 @@ struct make_avltree
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class avltree
|
||||
: public make_avltree<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -477,7 +489,7 @@ class avltree
|
||||
typedef typename make_avltree
|
||||
<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -485,7 +497,7 @@ class avltree
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(avltree)
|
||||
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
typedef typename Base::const_iterator const_iterator;
|
||||
@@ -495,14 +507,14 @@ class avltree
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
explicit avltree( const value_compare &cmp = value_compare()
|
||||
explicit avltree( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, v_traits)
|
||||
{}
|
||||
|
||||
template<class Iterator>
|
||||
avltree( bool unique, Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(unique, b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -514,6 +526,14 @@ class avltree
|
||||
avltree& operator=(BOOST_RV_REF(avltree) x)
|
||||
{ return static_cast<avltree &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const avltree &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(avltree) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static avltree &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<avltree &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
|
||||
+214
-176
@@ -40,15 +40,15 @@ namespace intrusive {
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
#endif
|
||||
class bs_set_impl
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
: public bstree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, BsTreeAlgorithms, HeaderHolder>
|
||||
: public bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, BsTreeAlgorithms, HeaderHolder>
|
||||
#endif
|
||||
{
|
||||
/// @cond
|
||||
typedef bstree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, BsTreeAlgorithms, HeaderHolder> tree_type;
|
||||
typedef bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, BsTreeAlgorithms, HeaderHolder> tree_type;
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(bs_set_impl)
|
||||
|
||||
typedef tree_type implementation_defined;
|
||||
@@ -56,6 +56,7 @@ class bs_set_impl
|
||||
|
||||
public:
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::value_traits value_traits;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
@@ -79,16 +80,16 @@ class bs_set_impl
|
||||
static const bool constant_time_size = tree_type::constant_time_size;
|
||||
|
||||
public:
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(const value_compare &,const value_traits &)
|
||||
explicit bs_set_impl( const value_compare &cmp = value_compare()
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(const key_compare &,const value_traits &)
|
||||
explicit bs_set_impl( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(bool,Iterator,Iterator,const value_compare &,const value_traits &)
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
|
||||
template<class Iterator>
|
||||
bs_set_impl( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(true, b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -169,11 +170,20 @@ class bs_set_impl
|
||||
//! @copydoc ::boost::intrusive::bstree::swap
|
||||
void swap(bs_set_impl& other);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from(const bstree&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const bs_set_impl &src, Cloner cloner, Disposer disposer);
|
||||
|
||||
#endif //#ifdef BOOST_iNTRUSIVE_DOXYGEN_INVOKED
|
||||
#else
|
||||
|
||||
using tree_type::clone_from;
|
||||
|
||||
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from(bstree&&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(bs_set_impl) src, Cloner cloner, Disposer disposer)
|
||||
{ tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique(reference)
|
||||
std::pair<iterator, bool> insert(reference value)
|
||||
@@ -183,18 +193,18 @@ class bs_set_impl
|
||||
iterator insert(const_iterator hint, reference value)
|
||||
{ return tree_type::insert_unique(hint, value); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_check
|
||||
(const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(key, key_value_comp, commit_data); }
|
||||
(const KeyType &key, KeyTypeKeyCompare comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(key, comp, commit_data); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const_iterator,const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const_iterator,const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_check
|
||||
(const_iterator hint, const KeyType &key
|
||||
,KeyValueCompare key_value_comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(hint, key, key_value_comp, commit_data); }
|
||||
,KeyTypeKeyCompare comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(hint, key, comp, commit_data); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique(Iterator,Iterator)
|
||||
template<class Iterator>
|
||||
@@ -221,12 +231,12 @@ class bs_set_impl
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const_iterator,const_iterator)
|
||||
iterator erase(const_iterator b, const_iterator e);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const_reference)
|
||||
size_type erase(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const key_type &)
|
||||
size_type erase(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_iterator,Disposer)
|
||||
template<class Disposer>
|
||||
@@ -236,13 +246,13 @@ class bs_set_impl
|
||||
template<class Disposer>
|
||||
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_reference, Disposer)
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const key_type &, Disposer)
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer);
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clear
|
||||
void clear();
|
||||
@@ -253,100 +263,100 @@ class bs_set_impl
|
||||
|
||||
#endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const_reference)const
|
||||
size_type count(const_reference value) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(value) == this->tree_type::cend()); }
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const key_type &)const
|
||||
size_type count(const key_type &key) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(key) != this->tree_type::cend()); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(key, comp) == this->tree_type::cend()); }
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(key, comp) != this->tree_type::cend()); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)
|
||||
iterator lower_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)
|
||||
iterator lower_bound(const key_type &);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)const
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)const
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const_reference)
|
||||
iterator upper_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const_reference)const
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)const
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const_reference)
|
||||
iterator find(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const key_type &)
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const_reference)const
|
||||
const_iterator find(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const key_type &)const
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
#endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const_reference)
|
||||
std::pair<iterator,iterator> equal_range(const_reference value)
|
||||
{ return this->tree_type::lower_bound_range(value); }
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)
|
||||
std::pair<iterator,iterator> equal_range(const key_type &key)
|
||||
{ return this->tree_type::lower_bound_range(key); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp)
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp)
|
||||
{ return this->tree_type::lower_bound_range(key, comp); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const_reference value) const
|
||||
{ return this->tree_type::lower_bound_range(value); }
|
||||
equal_range(const key_type &key) const
|
||||
{ return this->tree_type::lower_bound_range(key); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const KeyType& key, KeyValueCompare comp) const
|
||||
equal_range(const KeyType& key, KeyTypeKeyCompare comp) const
|
||||
{ return this->tree_type::lower_bound_range(key, comp); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type&,const key_type&,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
(const key_type& lower_key, const key_type& upper_key, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type&,const key_type&,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
bounded_range(const key_type& lower_key, const key_type& upper_key, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -400,7 +410,7 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_bs_set
|
||||
{
|
||||
@@ -408,7 +418,7 @@ struct make_bs_set
|
||||
typedef typename pack_options
|
||||
< bstree_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -419,6 +429,7 @@ struct make_bs_set
|
||||
|
||||
typedef bs_set_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::size_type
|
||||
, packed_options::constant_time_size
|
||||
@@ -430,14 +441,14 @@ struct make_bs_set
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class bs_set
|
||||
: public make_bs_set<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -446,7 +457,7 @@ class bs_set
|
||||
typedef typename make_bs_set
|
||||
<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -454,22 +465,22 @@ class bs_set
|
||||
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(bs_set)
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::iterator iterator;
|
||||
typedef typename Base::const_iterator const_iterator;
|
||||
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
explicit bs_set( const value_compare &cmp = value_compare()
|
||||
explicit bs_set( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, v_traits)
|
||||
{}
|
||||
|
||||
template<class Iterator>
|
||||
bs_set( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -481,6 +492,14 @@ class bs_set
|
||||
bs_set& operator=(BOOST_RV_REF(bs_set) x)
|
||||
{ return static_cast<bs_set &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const bs_set &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(bs_set) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static bs_set &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<bs_set &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
@@ -510,15 +529,15 @@ class bs_set
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
#endif
|
||||
class bs_multiset_impl
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
: public bstree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, RbTreeAlgorithms, HeaderHolder>
|
||||
: public bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, BsTreeAlgorithms, HeaderHolder>
|
||||
#endif
|
||||
{
|
||||
/// @cond
|
||||
typedef bstree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, RbTreeAlgorithms, HeaderHolder> tree_type;
|
||||
typedef bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, BsTreeAlgorithms, HeaderHolder> tree_type;
|
||||
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(bs_multiset_impl)
|
||||
typedef tree_type implementation_defined;
|
||||
@@ -526,6 +545,7 @@ class bs_multiset_impl
|
||||
|
||||
public:
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::value_traits value_traits;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
@@ -549,16 +569,16 @@ class bs_multiset_impl
|
||||
static const bool constant_time_size = tree_type::constant_time_size;
|
||||
|
||||
public:
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(const value_compare &,const value_traits &)
|
||||
explicit bs_multiset_impl( const value_compare &cmp = value_compare()
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(const key_compare &,const value_traits &)
|
||||
explicit bs_multiset_impl( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(bool,Iterator,Iterator,const value_compare &,const value_traits &)
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
|
||||
template<class Iterator>
|
||||
bs_multiset_impl( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(false, b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -639,11 +659,20 @@ class bs_multiset_impl
|
||||
//! @copydoc ::boost::intrusive::bstree::swap
|
||||
void swap(bs_multiset_impl& other);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from(const bstree&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const bs_multiset_impl &src, Cloner cloner, Disposer disposer);
|
||||
|
||||
#endif //#ifdef BOOST_iNTRUSIVE_DOXYGEN_INVOKED
|
||||
#else
|
||||
|
||||
using tree_type::clone_from;
|
||||
|
||||
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from(bstree&&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(bs_multiset_impl) src, Cloner cloner, Disposer disposer)
|
||||
{ tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_equal(reference)
|
||||
iterator insert(reference value)
|
||||
@@ -674,12 +703,12 @@ class bs_multiset_impl
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const_iterator,const_iterator)
|
||||
iterator erase(const_iterator b, const_iterator e);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const_reference)
|
||||
size_type erase(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const key_type &)
|
||||
size_type erase(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_iterator,Disposer)
|
||||
template<class Disposer>
|
||||
@@ -689,13 +718,13 @@ class bs_multiset_impl
|
||||
template<class Disposer>
|
||||
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_reference, Disposer)
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const key_type &, Disposer)
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer);
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clear
|
||||
void clear();
|
||||
@@ -704,88 +733,88 @@ class bs_multiset_impl
|
||||
template<class Disposer>
|
||||
void clear_and_dispose(Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const_reference)const
|
||||
size_type count(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const key_type &)const
|
||||
size_type count(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)
|
||||
iterator lower_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)
|
||||
iterator lower_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)const
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)const
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const_reference)
|
||||
iterator upper_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const_reference)const
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)const
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const_reference)
|
||||
iterator find(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const key_type &)
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const_reference)const
|
||||
const_iterator find(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const key_type &)const
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const_reference)
|
||||
std::pair<iterator,iterator> equal_range(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)
|
||||
std::pair<iterator,iterator> equal_range(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const_reference value) const;
|
||||
equal_range(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const KeyType& key, KeyValueCompare comp) const;
|
||||
equal_range(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type &,const key_type &,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
(const key_type & lower_key, const key_type & upper_key, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type &,const key_type &,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
bounded_range(const key_type & lower_key, const key_type & upper_key, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -839,7 +868,7 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_bs_multiset
|
||||
{
|
||||
@@ -847,7 +876,7 @@ struct make_bs_multiset
|
||||
typedef typename pack_options
|
||||
< bstree_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -858,6 +887,7 @@ struct make_bs_multiset
|
||||
|
||||
typedef bs_multiset_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::size_type
|
||||
, packed_options::constant_time_size
|
||||
@@ -870,14 +900,14 @@ struct make_bs_multiset
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class bs_multiset
|
||||
: public make_bs_multiset<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -885,7 +915,7 @@ class bs_multiset
|
||||
{
|
||||
typedef typename make_bs_multiset<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -894,7 +924,7 @@ class bs_multiset
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(bs_multiset)
|
||||
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
typedef typename Base::const_iterator const_iterator;
|
||||
@@ -902,14 +932,14 @@ class bs_multiset
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
explicit bs_multiset( const value_compare &cmp = value_compare()
|
||||
explicit bs_multiset( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, v_traits)
|
||||
{}
|
||||
|
||||
template<class Iterator>
|
||||
bs_multiset( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -921,6 +951,14 @@ class bs_multiset
|
||||
bs_multiset& operator=(BOOST_RV_REF(bs_multiset) x)
|
||||
{ return static_cast<bs_multiset &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const bs_multiset &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(bs_multiset) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static bs_multiset &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<bs_multiset &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
|
||||
+263
-240
File diff suppressed because it is too large
Load Diff
@@ -46,7 +46,7 @@ class common_slist_algorithms
|
||||
; this_node != (p_next = NodeTraits::get_next(p))
|
||||
; p = p_next){
|
||||
//Logic error: possible use of linear lists with
|
||||
//operations only permitted with lists
|
||||
//operations only permitted with circular lists
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(p);
|
||||
}
|
||||
return p;
|
||||
|
||||
@@ -51,15 +51,15 @@ struct default_header_holder : public NodeTraits::node
|
||||
};
|
||||
|
||||
// type function producing the header node holder
|
||||
template < typename Value_Traits, typename HeaderHolder >
|
||||
template < typename ValueTraits, typename HeaderHolder >
|
||||
struct get_header_holder_type
|
||||
{
|
||||
typedef HeaderHolder type;
|
||||
};
|
||||
template < typename Value_Traits >
|
||||
struct get_header_holder_type< Value_Traits, void >
|
||||
template < typename ValueTraits >
|
||||
struct get_header_holder_type< ValueTraits, void >
|
||||
{
|
||||
typedef default_header_holder< typename Value_Traits::node_traits > type;
|
||||
typedef default_header_holder< typename ValueTraits::node_traits > type;
|
||||
};
|
||||
|
||||
} //namespace detail
|
||||
|
||||
@@ -203,6 +203,7 @@ class ebo_functor_holder
|
||||
typedef ebo_functor_holder_impl<T, is_unary_or_binary_function<T>::value> super;
|
||||
|
||||
public:
|
||||
typedef T functor_type;
|
||||
ebo_functor_holder(){}
|
||||
explicit ebo_functor_holder(const T& t)
|
||||
: super(t)
|
||||
|
||||
@@ -28,18 +28,27 @@ namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
template<class KeyValueCompare, class ValueTraits>
|
||||
template < class KeyTypeKeyCompare
|
||||
, class ValueTraits
|
||||
, class KeyOfValue = void
|
||||
>
|
||||
struct key_nodeptr_comp
|
||||
//Use public inheritance to avoid MSVC bugs with closures
|
||||
: public ebo_functor_holder<KeyValueCompare>
|
||||
: public ebo_functor_holder<KeyTypeKeyCompare>
|
||||
{
|
||||
typedef ValueTraits value_traits;
|
||||
typedef typename value_traits::value_type value_type;
|
||||
typedef typename value_traits::node_ptr node_ptr;
|
||||
typedef typename value_traits::const_node_ptr const_node_ptr;
|
||||
typedef ebo_functor_holder<KeyValueCompare> base_t;
|
||||
typedef ebo_functor_holder<KeyTypeKeyCompare> base_t;
|
||||
typedef typename detail::if_c
|
||||
< detail::is_same<KeyOfValue, void>::value
|
||||
, detail::identity<value_type>
|
||||
, KeyOfValue
|
||||
>::type key_of_value;
|
||||
typedef typename key_of_value::type key_type;
|
||||
|
||||
key_nodeptr_comp(KeyValueCompare kcomp, const ValueTraits *traits)
|
||||
key_nodeptr_comp(KeyTypeKeyCompare kcomp, const ValueTraits *traits)
|
||||
: base_t(kcomp), traits_(traits)
|
||||
{}
|
||||
|
||||
@@ -51,9 +60,9 @@ struct key_nodeptr_comp
|
||||
|
||||
//key_forward
|
||||
template<class T>
|
||||
typename enable_if<is_node_ptr<T>, const value_type &>::type
|
||||
typename enable_if<is_node_ptr<T>, const key_type &>::type
|
||||
key_forward(const T &node) const
|
||||
{ return *traits_->to_value_ptr(node); }
|
||||
{ return key_of_value()(*traits_->to_value_ptr(node)); }
|
||||
|
||||
template<class T>
|
||||
typename disable_if<is_node_ptr<T>, const T &>::type
|
||||
|
||||
@@ -47,6 +47,7 @@ using boost::move_detail::disable_if;
|
||||
using boost::move_detail::is_convertible;
|
||||
using boost::move_detail::if_c;
|
||||
using boost::move_detail::if_;
|
||||
using boost::move_detail::is_const;
|
||||
using boost::move_detail::identity;
|
||||
using boost::move_detail::alignment_of;
|
||||
using boost::move_detail::is_empty;
|
||||
@@ -163,10 +164,10 @@ struct TRAITS_PREFIX##_bool_is_true\
|
||||
private: \
|
||||
template<Signature> struct helper;\
|
||||
template<typename T> \
|
||||
static ::boost::intrusive::detail::yes_type check(helper<&T::FUNC_NAME>*); \
|
||||
template<typename T> static ::boost::intrusive::detail::no_type check(...); \
|
||||
static ::boost::intrusive::detail::yes_type test(helper<&T::FUNC_NAME>*); \
|
||||
template<typename T> static ::boost::intrusive::detail::no_type test(...); \
|
||||
public: \
|
||||
static const bool value = sizeof(check<U>(0)) == sizeof(::boost::intrusive::detail::yes_type); \
|
||||
static const bool value = sizeof(test<U>(0)) == sizeof(::boost::intrusive::detail::yes_type); \
|
||||
}; \
|
||||
//
|
||||
|
||||
@@ -181,9 +182,9 @@ struct TRAITS_NAME \
|
||||
struct Base : public Type, public BaseMixin { Base(); }; \
|
||||
template <typename T, T t> class Helper{}; \
|
||||
template <typename U> \
|
||||
static ::boost::intrusive::detail::no_type check(U*, Helper<void (BaseMixin::*)(), &U::FUNC_NAME>* = 0); \
|
||||
static ::boost::intrusive::detail::yes_type check(...); \
|
||||
static const bool value = sizeof(::boost::intrusive::detail::yes_type) == sizeof(check((Base*)(0))); \
|
||||
static ::boost::intrusive::detail::no_type test(U*, Helper<void (BaseMixin::*)(), &U::FUNC_NAME>* = 0); \
|
||||
static ::boost::intrusive::detail::yes_type test(...); \
|
||||
static const bool value = sizeof(::boost::intrusive::detail::yes_type) == sizeof(test((Base*)(0))); \
|
||||
};\
|
||||
//
|
||||
|
||||
|
||||
@@ -36,21 +36,22 @@ struct node_cloner
|
||||
//Use public inheritance to avoid MSVC bugs with closures
|
||||
: public ebo_functor_holder<F>
|
||||
{
|
||||
typedef ValueTraits value_traits;
|
||||
typedef typename value_traits::node_traits node_traits;
|
||||
typedef typename node_traits::node_ptr node_ptr;
|
||||
typedef ebo_functor_holder<F> base_t;
|
||||
typedef ValueTraits value_traits;
|
||||
typedef typename value_traits::node_traits node_traits;
|
||||
typedef typename node_traits::node_ptr node_ptr;
|
||||
typedef ebo_functor_holder<F> base_t;
|
||||
typedef typename get_algo< AlgoType
|
||||
, node_traits>::type node_algorithms;
|
||||
, node_traits>::type node_algorithms;
|
||||
static const bool safemode_or_autounlink =
|
||||
is_safe_autounlink<value_traits::link_mode>::value;
|
||||
typedef typename value_traits::value_type value_type;
|
||||
typedef typename value_traits::pointer pointer;
|
||||
typedef typename node_traits::node node;
|
||||
typedef typename value_traits::const_node_ptr const_node_ptr;
|
||||
typedef typename value_traits::reference reference;
|
||||
typedef typename value_traits::const_reference const_reference;
|
||||
|
||||
typedef typename value_traits::value_type value_type;
|
||||
typedef typename value_traits::pointer pointer;
|
||||
typedef typename value_traits::const_pointer const_pointer;
|
||||
typedef typename node_traits::node node;
|
||||
typedef typename value_traits::const_node_ptr const_node_ptr;
|
||||
typedef typename pointer_traits<pointer>::reference reference;
|
||||
typedef typename pointer_traits
|
||||
<const_pointer>::reference const_reference;
|
||||
typedef typename if_c<IsConst, const_reference, reference>::type reference_type;
|
||||
|
||||
node_cloner(F f, const ValueTraits *traits)
|
||||
@@ -63,21 +64,7 @@ struct node_cloner
|
||||
reference_type v = *traits_->to_value_ptr(p);
|
||||
node_ptr n = traits_->to_node_ptr(*base_t::get()(v));
|
||||
//Cloned node must be in default mode if the linking mode requires it
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n));
|
||||
return n;
|
||||
}
|
||||
|
||||
// hashtables use this method, which is proxy-reference unfriendly
|
||||
node_ptr operator()(const node &to_clone)
|
||||
{
|
||||
reference_type v =
|
||||
*traits_->to_value_ptr
|
||||
(pointer_traits<const_node_ptr>::pointer_to(to_clone));
|
||||
node_ptr n = traits_->to_node_ptr(*base_t::get()(v));
|
||||
//Cloned node must be in default mode if the linking mode requires it
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n));
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(n));
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/container for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_TREE_VALUE_COMPARE_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_TREE_VALUE_COMPARE_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
|
||||
|
||||
namespace boost{
|
||||
namespace intrusive{
|
||||
|
||||
template<class Key, class T, class KeyCompare, class KeyOfValue>
|
||||
struct tree_value_compare
|
||||
: public boost::intrusive::detail::ebo_functor_holder<KeyCompare>
|
||||
{
|
||||
typedef boost::intrusive::detail::ebo_functor_holder<KeyCompare> base_t;
|
||||
typedef T value_type;
|
||||
typedef KeyCompare key_compare;
|
||||
typedef KeyOfValue key_of_value;
|
||||
typedef Key key_type;
|
||||
|
||||
explicit tree_value_compare(const key_compare &kcomp)
|
||||
: base_t(kcomp)
|
||||
{}
|
||||
|
||||
tree_value_compare()
|
||||
: base_t()
|
||||
{}
|
||||
|
||||
const key_compare &key_comp() const
|
||||
{ return static_cast<const key_compare &>(*this); }
|
||||
|
||||
key_compare &key_comp()
|
||||
{ return static_cast<key_compare &>(*this); }
|
||||
|
||||
template<class U>
|
||||
struct is_key
|
||||
: boost::intrusive::detail::is_same<const U, const key_type>
|
||||
{};
|
||||
|
||||
template<class U>
|
||||
typename boost::intrusive::detail::enable_if<is_key<U>, const key_type &>::type
|
||||
key_forward(const U &key) const
|
||||
{ return key; }
|
||||
|
||||
template<class U>
|
||||
typename boost::intrusive::detail::disable_if<is_key<U>, const key_type &>::type
|
||||
key_forward(const U &key) const
|
||||
{ return KeyOfValue()(key); }
|
||||
|
||||
template<class KeyType, class KeyType2>
|
||||
bool operator()(const KeyType &key1, const KeyType2 &key2) const
|
||||
{ return key_compare::operator()(this->key_forward(key1), this->key_forward(key2)); }
|
||||
|
||||
template<class KeyType, class KeyType2>
|
||||
bool operator()(const KeyType &key1, const KeyType2 &key2)
|
||||
{ return key_compare::operator()(this->key_forward(key1), this->key_forward(key2)); }
|
||||
};
|
||||
|
||||
} //namespace intrusive{
|
||||
} //namespace boost{
|
||||
|
||||
#endif //#ifdef BOOST_INTRUSIVE_DETAIL_TREE_VALUE_COMPARE_HPP
|
||||
+1270
-1109
File diff suppressed because it is too large
Load Diff
@@ -184,6 +184,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -198,6 +199,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -212,6 +214,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -251,6 +254,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -265,6 +269,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -279,6 +284,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -294,6 +300,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -308,6 +315,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -322,6 +330,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -362,6 +371,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -376,6 +386,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -390,6 +401,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -405,6 +417,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -419,6 +432,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -433,6 +447,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -447,6 +462,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -461,6 +477,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
@@ -475,6 +492,7 @@ template
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
|
||||
@@ -248,8 +248,7 @@ class list_impl
|
||||
void push_back(reference value)
|
||||
{
|
||||
node_ptr to_insert = priv_value_traits().to_node_ptr(value);
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(to_insert));
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::inited(to_insert));
|
||||
node_algorithms::link_before(this->get_root_node(), to_insert);
|
||||
this->priv_size_traits().increment();
|
||||
}
|
||||
@@ -267,8 +266,7 @@ class list_impl
|
||||
void push_front(reference value)
|
||||
{
|
||||
node_ptr to_insert = priv_value_traits().to_node_ptr(value);
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(to_insert));
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::inited(to_insert));
|
||||
node_algorithms::link_before(node_traits::get_next(this->get_root_node()), to_insert);
|
||||
this->priv_size_traits().increment();
|
||||
}
|
||||
@@ -770,6 +768,33 @@ class list_impl
|
||||
rollback.release();
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
|
||||
//! Cloner should yield to nodes equivalent to the original nodes.
|
||||
//!
|
||||
//! <b>Effects</b>: Erases all the elements from *this
|
||||
//! calling Disposer::operator()(pointer), clones all the
|
||||
//! elements from src calling Cloner::operator()(reference)
|
||||
//! and inserts them on *this.
|
||||
//!
|
||||
//! If cloner throws, all cloned elements are unlinked and disposed
|
||||
//! calling Disposer::operator()(pointer).
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to erased plus inserted elements.
|
||||
//!
|
||||
//! <b>Throws</b>: If cloner throws. Basic guarantee.
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(list_impl) src, Cloner cloner, Disposer disposer)
|
||||
{
|
||||
this->clear_and_dispose(disposer);
|
||||
detail::exception_disposer<list_impl, Disposer>
|
||||
rollback(*this, disposer);
|
||||
iterator b(src.begin()), e(src.end());
|
||||
for(; b != e; ++b){
|
||||
this->push_back(*cloner(*b));
|
||||
}
|
||||
rollback.release();
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: value must be an lvalue and p must be a valid iterator of *this.
|
||||
//!
|
||||
//! <b>Effects</b>: Inserts the value before the position pointed by p.
|
||||
@@ -784,8 +809,7 @@ class list_impl
|
||||
iterator insert(const_iterator p, reference value)
|
||||
{
|
||||
node_ptr to_insert = this->priv_value_traits().to_node_ptr(value);
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(to_insert));
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::inited(to_insert));
|
||||
node_algorithms::link_before(p.pointed_node(), to_insert);
|
||||
this->priv_size_traits().increment();
|
||||
return iterator(to_insert, this->priv_value_traits_ptr());
|
||||
@@ -1447,6 +1471,14 @@ class list
|
||||
list& operator=(BOOST_RV_REF(list) x)
|
||||
{ return static_cast<list &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const list &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(list) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static list &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<list &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
|
||||
@@ -61,6 +61,15 @@ BOOST_INTRUSIVE_OPTION_TYPE(size_type, SizeType, SizeType, size_type)
|
||||
//!comparison functor for the value type
|
||||
BOOST_INTRUSIVE_OPTION_TYPE(compare, Compare, Compare, compare)
|
||||
|
||||
//!This option setter specifies the a function object
|
||||
//!that specifies the type of the key of an associative
|
||||
//!container and an operator to obtain it from a value type.
|
||||
//!
|
||||
//!This function object must the define a `key_type` and
|
||||
//!a member with signature `const key_type & operator()(const value_type &) const`
|
||||
//!that will return the key from a value_type of an associative container
|
||||
BOOST_INTRUSIVE_OPTION_TYPE(key_of_value, KeyOfValue, KeyOfValue, key_of_value)
|
||||
|
||||
//!This option setter for scapegoat containers specifies if
|
||||
//!the intrusive scapegoat container should use a non-variable
|
||||
//!alpha value that does not need floating-point operations.
|
||||
@@ -199,7 +208,7 @@ BOOST_INTRUSIVE_OPTION_CONSTANT(optimize_multikey, bool, Enabled, optimize_multi
|
||||
//!This allows using masks instead of the default modulo operation to determine
|
||||
//!the bucket number from the hash value, leading to better performance.
|
||||
//!In debug mode, if power of two buckets mode is activated, the bucket length
|
||||
//!will be checked to through assertions to assure the bucket length is power of two.
|
||||
//!will be checked with assertions.
|
||||
BOOST_INTRUSIVE_OPTION_CONSTANT(power_2_buckets, bool, Enabled, power_2_buckets)
|
||||
|
||||
//!This option setter specifies if the container will cache a pointer to the first
|
||||
|
||||
@@ -48,19 +48,16 @@ struct is_default_hook_tag<default_rbtree_hook_applier>
|
||||
{ static const bool value = true; };
|
||||
|
||||
struct rbtree_defaults
|
||||
: bstree_defaults
|
||||
{
|
||||
typedef default_rbtree_hook_applier proto_value_traits;
|
||||
static const bool constant_time_size = true;
|
||||
typedef std::size_t size_type;
|
||||
typedef void compare;
|
||||
typedef void header_holder_type;
|
||||
};
|
||||
|
||||
/// @endcond
|
||||
|
||||
//! The class template rbtree is an intrusive red-black tree container, that
|
||||
//! is used to construct intrusive set and multiset containers. The no-throw
|
||||
//! guarantee holds only, if the value_compare object
|
||||
//! guarantee holds only, if the key_compare object
|
||||
//! doesn't throw.
|
||||
//!
|
||||
//! The template parameter \c T is the type to be managed by the container.
|
||||
@@ -74,17 +71,17 @@ struct rbtree_defaults
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class VoidOrKeyComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
#endif
|
||||
class rbtree_impl
|
||||
/// @cond
|
||||
: public bstree_impl<ValueTraits, VoidOrKeyComp, SizeType, ConstantTimeSize, RbTreeAlgorithms, HeaderHolder>
|
||||
: public bstree_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType, ConstantTimeSize, RbTreeAlgorithms, HeaderHolder>
|
||||
/// @endcond
|
||||
{
|
||||
public:
|
||||
typedef ValueTraits value_traits;
|
||||
/// @cond
|
||||
typedef bstree_impl< ValueTraits, VoidOrKeyComp, SizeType
|
||||
typedef bstree_impl< ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType
|
||||
, ConstantTimeSize, RbTreeAlgorithms
|
||||
, HeaderHolder> tree_type;
|
||||
typedef tree_type implementation_defined;
|
||||
@@ -94,6 +91,7 @@ class rbtree_impl
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::key_of_value key_of_value;
|
||||
typedef typename implementation_defined::reference reference;
|
||||
typedef typename implementation_defined::const_reference const_reference;
|
||||
typedef typename implementation_defined::difference_type difference_type;
|
||||
@@ -123,16 +121,16 @@ class rbtree_impl
|
||||
|
||||
typedef typename implementation_defined::insert_commit_data insert_commit_data;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(const value_compare &,const value_traits &)
|
||||
explicit rbtree_impl( const value_compare &cmp = value_compare()
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(const key_compare &,const value_traits &)
|
||||
explicit rbtree_impl( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(bool,Iterator,Iterator,const value_compare &,const value_traits &)
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
|
||||
template<class Iterator>
|
||||
rbtree_impl( bool unique, Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(unique, b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -213,13 +211,26 @@ class rbtree_impl
|
||||
//! @copydoc ::boost::intrusive::bstree::swap
|
||||
void swap(rbtree_impl& other);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from(const bstree &src, cloner, Disposer)
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from(const bstree&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const rbtree_impl &src, Cloner cloner, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from(bstree &src, cloner, Disposer)
|
||||
#else //BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
using tree_type::clone_from;
|
||||
|
||||
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from(bstree&&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(rbtree_impl &src, Cloner cloner, Disposer disposer);
|
||||
void clone_from(BOOST_RV_REF(rbtree_impl) src, Cloner cloner, Disposer disposer)
|
||||
{ tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from(bstree&&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(rbtree_impl &&src, Cloner cloner, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_equal(reference)
|
||||
iterator insert_equal(reference value);
|
||||
@@ -237,16 +248,16 @@ class rbtree_impl
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique(const_iterator,reference)
|
||||
iterator insert_unique(const_iterator hint, reference value);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_unique_check
|
||||
(const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data);
|
||||
(const KeyType &key, KeyTypeKeyCompare comp, insert_commit_data &commit_data);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const_iterator,const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const_iterator,const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_unique_check
|
||||
(const_iterator hint, const KeyType &key
|
||||
,KeyValueCompare key_value_comp, insert_commit_data &commit_data);
|
||||
,KeyTypeKeyCompare comp, insert_commit_data &commit_data);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_commit
|
||||
iterator insert_unique_commit(reference value, const insert_commit_data &commit_data);
|
||||
@@ -270,12 +281,12 @@ class rbtree_impl
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const_iterator,const_iterator)
|
||||
iterator erase(const_iterator b, const_iterator e);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const_reference)
|
||||
size_type erase(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const key_type &key)
|
||||
size_type erase(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_iterator,Disposer)
|
||||
template<class Disposer>
|
||||
@@ -285,13 +296,13 @@ class rbtree_impl
|
||||
template<class Disposer>
|
||||
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_reference, Disposer)
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const key_type &, Disposer)
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer);
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clear
|
||||
void clear();
|
||||
@@ -300,88 +311,88 @@ class rbtree_impl
|
||||
template<class Disposer>
|
||||
void clear_and_dispose(Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const_reference)const
|
||||
size_type count(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const key_type &)const
|
||||
size_type count(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)
|
||||
iterator lower_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)
|
||||
iterator lower_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)const
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)const
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const_reference)
|
||||
iterator upper_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const_reference)const
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)const
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const_reference)
|
||||
iterator find(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const key_type &)
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const_reference)const
|
||||
const_iterator find(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const key_type &)const
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const_reference)
|
||||
std::pair<iterator,iterator> equal_range(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)
|
||||
std::pair<iterator,iterator> equal_range(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const_reference value) const;
|
||||
equal_range(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const KeyType& key, KeyValueCompare comp) const;
|
||||
equal_range(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type &,const key_type &,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
(const key_type &lower, const key_type &upper_key, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type &,const key_type &,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
bounded_range(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -431,7 +442,7 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_rbtree
|
||||
{
|
||||
@@ -439,7 +450,7 @@ struct make_rbtree
|
||||
typedef typename pack_options
|
||||
< rbtree_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -450,6 +461,7 @@ struct make_rbtree
|
||||
|
||||
typedef rbtree_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::size_type
|
||||
, packed_options::constant_time_size
|
||||
@@ -463,14 +475,14 @@ struct make_rbtree
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class rbtree
|
||||
: public make_rbtree<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -479,7 +491,7 @@ class rbtree
|
||||
typedef typename make_rbtree
|
||||
<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -487,7 +499,7 @@ class rbtree
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(rbtree)
|
||||
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
typedef typename Base::const_iterator const_iterator;
|
||||
@@ -497,14 +509,14 @@ class rbtree
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
explicit rbtree( const value_compare &cmp = value_compare()
|
||||
explicit rbtree( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, v_traits)
|
||||
{}
|
||||
|
||||
template<class Iterator>
|
||||
rbtree( bool unique, Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(unique, b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -516,6 +528,14 @@ class rbtree
|
||||
rbtree& operator=(BOOST_RV_REF(rbtree) x)
|
||||
{ return static_cast<rbtree &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const rbtree &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(rbtree) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static rbtree &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<rbtree &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
|
||||
+215
-175
@@ -42,15 +42,15 @@ namespace intrusive {
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
#endif
|
||||
class set_impl
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
: public bstree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, RbTreeAlgorithms, HeaderHolder>
|
||||
: public bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, RbTreeAlgorithms, HeaderHolder>
|
||||
#endif
|
||||
{
|
||||
/// @cond
|
||||
typedef bstree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, RbTreeAlgorithms, HeaderHolder> tree_type;
|
||||
typedef bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, RbTreeAlgorithms, HeaderHolder> tree_type;
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(set_impl)
|
||||
|
||||
typedef tree_type implementation_defined;
|
||||
@@ -58,6 +58,8 @@ class set_impl
|
||||
|
||||
public:
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::key_of_value key_of_value;
|
||||
typedef typename implementation_defined::value_traits value_traits;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
@@ -81,16 +83,16 @@ class set_impl
|
||||
static const bool constant_time_size = tree_type::constant_time_size;
|
||||
|
||||
public:
|
||||
//! @copydoc ::boost::intrusive::rbtree::rbtree(const value_compare &,const value_traits &)
|
||||
explicit set_impl( const value_compare &cmp = value_compare()
|
||||
//! @copydoc ::boost::intrusive::rbtree::rbtree(const key_compare &,const value_traits &)
|
||||
explicit set_impl( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::rbtree(bool,Iterator,Iterator,const value_compare &,const value_traits &)
|
||||
//! @copydoc ::boost::intrusive::rbtree::rbtree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
|
||||
template<class Iterator>
|
||||
set_impl( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(true, b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -171,11 +173,20 @@ class set_impl
|
||||
//! @copydoc ::boost::intrusive::rbtree::swap
|
||||
void swap(set_impl& other);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::clone_from
|
||||
//! @copydoc ::boost::intrusive::rbtree::clone_from(const rbtree&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const set_impl &src, Cloner cloner, Disposer disposer);
|
||||
|
||||
#endif //#ifdef BOOST_iNTRUSIVE_DOXYGEN_INVOKED
|
||||
#else
|
||||
|
||||
using tree_type::clone_from;
|
||||
|
||||
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::clone_from(rbtree&&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(set_impl) src, Cloner cloner, Disposer disposer)
|
||||
{ tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::insert_unique(reference)
|
||||
std::pair<iterator, bool> insert(reference value)
|
||||
@@ -185,18 +196,18 @@ class set_impl
|
||||
iterator insert(const_iterator hint, reference value)
|
||||
{ return tree_type::insert_unique(hint, value); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::insert_unique_check(const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::rbtree::insert_unique_check(const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_check
|
||||
(const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(key, key_value_comp, commit_data); }
|
||||
(const KeyType &key, KeyTypeKeyCompare comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(key, comp, commit_data); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::insert_unique_check(const_iterator,const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::rbtree::insert_unique_check(const_iterator,const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_check
|
||||
(const_iterator hint, const KeyType &key
|
||||
,KeyValueCompare key_value_comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(hint, key, key_value_comp, commit_data); }
|
||||
,KeyTypeKeyCompare comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(hint, key, comp, commit_data); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::insert_unique(Iterator,Iterator)
|
||||
template<class Iterator>
|
||||
@@ -223,12 +234,12 @@ class set_impl
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase(const_iterator,const_iterator)
|
||||
iterator erase(const_iterator b, const_iterator e);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase(const_reference)
|
||||
size_type erase(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase(const key_type &)
|
||||
size_type erase(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase_and_dispose(const_iterator,Disposer)
|
||||
template<class Disposer>
|
||||
@@ -238,13 +249,13 @@ class set_impl
|
||||
template<class Disposer>
|
||||
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase_and_dispose(const_reference, Disposer)
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase_and_dispose(const key_type &, Disposer)
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer);
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::clear
|
||||
void clear();
|
||||
@@ -255,100 +266,100 @@ class set_impl
|
||||
|
||||
#endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::count(const_reference)const
|
||||
size_type count(const_reference value) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(value) != this->tree_type::cend()); }
|
||||
//! @copydoc ::boost::intrusive::rbtree::count(const key_type &)const
|
||||
size_type count(const key_type &key) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(key) != this->tree_type::cend()); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp) const
|
||||
//! @copydoc ::boost::intrusive::rbtree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(key, comp) != this->tree_type::cend()); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::lower_bound(const_reference)
|
||||
iterator lower_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::rbtree::lower_bound(const key_type &)
|
||||
iterator lower_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::lower_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::rbtree::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::lower_bound(const_reference)const
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::rbtree::lower_bound(const key_type &)const
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::rbtree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::upper_bound(const_reference)
|
||||
iterator upper_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::rbtree::upper_bound(const key_type &)
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::upper_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::rbtree::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::upper_bound(const_reference)const
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::rbtree::upper_bound(const key_type &)const
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::rbtree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::find(const_reference)
|
||||
iterator find(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::rbtree::find(const key_type &)
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::find(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::rbtree::find(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::find(const_reference)const
|
||||
const_iterator find(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::rbtree::find(const key_type &)const
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::find(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::rbtree::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
#endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const_reference)
|
||||
std::pair<iterator,iterator> equal_range(const_reference value)
|
||||
{ return this->tree_type::lower_bound_range(value); }
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const key_type &)
|
||||
std::pair<iterator,iterator> equal_range(const key_type &key)
|
||||
{ return this->tree_type::lower_bound_range(key); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp)
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp)
|
||||
{ return this->tree_type::lower_bound_range(key, comp); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const key_type &)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const_reference value) const
|
||||
{ return this->tree_type::lower_bound_range(value); }
|
||||
equal_range(const key_type &key) const
|
||||
{ return this->tree_type::lower_bound_range(key); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const KeyType& key, KeyValueCompare comp) const
|
||||
equal_range(const KeyType& key, KeyTypeKeyCompare comp) const
|
||||
{ return this->tree_type::lower_bound_range(key, comp); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::rbtree::bounded_range(const key_type &,const key_type &,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::rbtree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::rbtree::bounded_range(const key_type &,const key_type &,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
bounded_range(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::rbtree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -402,7 +413,7 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_set
|
||||
{
|
||||
@@ -410,7 +421,7 @@ struct make_set
|
||||
typedef typename pack_options
|
||||
< rbtree_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -421,6 +432,7 @@ struct make_set
|
||||
|
||||
typedef set_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::size_type
|
||||
, packed_options::constant_time_size
|
||||
@@ -432,14 +444,14 @@ struct make_set
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class set
|
||||
: public make_set<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -448,7 +460,7 @@ class set
|
||||
typedef typename make_set
|
||||
<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -456,7 +468,7 @@ class set
|
||||
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(set)
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
typedef typename Base::const_iterator const_iterator;
|
||||
@@ -464,14 +476,14 @@ class set
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
explicit set( const value_compare &cmp = value_compare()
|
||||
explicit set( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, v_traits)
|
||||
{}
|
||||
|
||||
template<class Iterator>
|
||||
set( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -483,6 +495,14 @@ class set
|
||||
set& operator=(BOOST_RV_REF(set) x)
|
||||
{ return static_cast<set &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const set &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(set) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static set &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<set &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
@@ -512,15 +532,15 @@ class set
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
#endif
|
||||
class multiset_impl
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
: public bstree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, RbTreeAlgorithms, HeaderHolder>
|
||||
: public bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, RbTreeAlgorithms, HeaderHolder>
|
||||
#endif
|
||||
{
|
||||
/// @cond
|
||||
typedef bstree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, RbTreeAlgorithms, HeaderHolder> tree_type;
|
||||
typedef bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, RbTreeAlgorithms, HeaderHolder> tree_type;
|
||||
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(multiset_impl)
|
||||
typedef tree_type implementation_defined;
|
||||
@@ -528,6 +548,8 @@ class multiset_impl
|
||||
|
||||
public:
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::key_of_value key_of_value;
|
||||
typedef typename implementation_defined::value_traits value_traits;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
@@ -551,16 +573,16 @@ class multiset_impl
|
||||
static const bool constant_time_size = tree_type::constant_time_size;
|
||||
|
||||
public:
|
||||
//! @copydoc ::boost::intrusive::rbtree::rbtree(const value_compare &,const value_traits &)
|
||||
explicit multiset_impl( const value_compare &cmp = value_compare()
|
||||
//! @copydoc ::boost::intrusive::rbtree::rbtree(const key_compare &,const value_traits &)
|
||||
explicit multiset_impl( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::rbtree(bool,Iterator,Iterator,const value_compare &,const value_traits &)
|
||||
//! @copydoc ::boost::intrusive::rbtree::rbtree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
|
||||
template<class Iterator>
|
||||
multiset_impl( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(false, b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -641,11 +663,20 @@ class multiset_impl
|
||||
//! @copydoc ::boost::intrusive::rbtree::swap
|
||||
void swap(multiset_impl& other);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::clone_from
|
||||
//! @copydoc ::boost::intrusive::rbtree::clone_from(const rbtree&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const multiset_impl &src, Cloner cloner, Disposer disposer);
|
||||
|
||||
#endif //#ifdef BOOST_iNTRUSIVE_DOXYGEN_INVOKED
|
||||
#else
|
||||
|
||||
using tree_type::clone_from;
|
||||
|
||||
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::clone_from(rbtree&&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(multiset_impl) src, Cloner cloner, Disposer disposer)
|
||||
{ tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::insert_equal(reference)
|
||||
iterator insert(reference value)
|
||||
@@ -676,12 +707,12 @@ class multiset_impl
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase(const_iterator,const_iterator)
|
||||
iterator erase(const_iterator b, const_iterator e);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase(const_reference)
|
||||
size_type erase(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase(const key_type &)
|
||||
size_type erase(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase_and_dispose(const_iterator,Disposer)
|
||||
template<class Disposer>
|
||||
@@ -691,13 +722,13 @@ class multiset_impl
|
||||
template<class Disposer>
|
||||
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase_and_dispose(const_reference, Disposer)
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase_and_dispose(const key_type &, Disposer)
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer);
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
|
||||
//! @copydoc ::boost::intrusive::rbtree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::clear
|
||||
void clear();
|
||||
@@ -706,88 +737,88 @@ class multiset_impl
|
||||
template<class Disposer>
|
||||
void clear_and_dispose(Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::count(const_reference)const
|
||||
size_type count(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::rbtree::count(const key_type &)const
|
||||
size_type count(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::rbtree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::lower_bound(const_reference)
|
||||
iterator lower_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::rbtree::lower_bound(const key_type &)
|
||||
iterator lower_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::lower_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::rbtree::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::lower_bound(const_reference)const
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::rbtree::lower_bound(const key_type &)const
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::rbtree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::upper_bound(const_reference)
|
||||
iterator upper_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::rbtree::upper_bound(const key_type &)
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::upper_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::rbtree::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::upper_bound(const_reference)const
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::rbtree::upper_bound(const key_type &)const
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::rbtree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::find(const_reference)
|
||||
iterator find(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::rbtree::find(const key_type &)
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::find(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::rbtree::find(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::find(const_reference)const
|
||||
const_iterator find(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::rbtree::find(const key_type &)const
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::find(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::rbtree::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const_reference)
|
||||
std::pair<iterator,iterator> equal_range(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const key_type &)
|
||||
std::pair<iterator,iterator> equal_range(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const key_type &)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const_reference value) const;
|
||||
equal_range(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const KeyType& key, KeyValueCompare comp) const;
|
||||
equal_range(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::rbtree::bounded_range(const key_type &,const key_type &,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::rbtree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::rbtree::bounded_range(const key_type &,const key_type &,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
bounded_range(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::rbtree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -841,7 +872,7 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_multiset
|
||||
{
|
||||
@@ -849,7 +880,7 @@ struct make_multiset
|
||||
typedef typename pack_options
|
||||
< rbtree_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -860,6 +891,7 @@ struct make_multiset
|
||||
|
||||
typedef multiset_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::size_type
|
||||
, packed_options::constant_time_size
|
||||
@@ -872,14 +904,14 @@ struct make_multiset
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class multiset
|
||||
: public make_multiset<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -887,7 +919,7 @@ class multiset
|
||||
{
|
||||
typedef typename make_multiset<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -896,7 +928,7 @@ class multiset
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(multiset)
|
||||
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
typedef typename Base::const_iterator const_iterator;
|
||||
@@ -904,14 +936,14 @@ class multiset
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
multiset( const value_compare &cmp = value_compare()
|
||||
multiset( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, v_traits)
|
||||
{}
|
||||
|
||||
template<class Iterator>
|
||||
multiset( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -923,6 +955,14 @@ class multiset
|
||||
multiset& operator=(BOOST_RV_REF(multiset) x)
|
||||
{ return static_cast<multiset &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const multiset &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(multiset) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static multiset &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<multiset &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
|
||||
+215
-175
@@ -40,15 +40,15 @@ namespace intrusive {
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class Compare, class SizeType, bool FloatingPoint, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool FloatingPoint, typename HeaderHolder>
|
||||
#endif
|
||||
class sg_set_impl
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
: public sgtree_impl<ValueTraits, Compare, SizeType, FloatingPoint, HeaderHolder>
|
||||
: public sgtree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, FloatingPoint, HeaderHolder>
|
||||
#endif
|
||||
{
|
||||
/// @cond
|
||||
typedef sgtree_impl<ValueTraits, Compare, SizeType, FloatingPoint, HeaderHolder> tree_type;
|
||||
typedef sgtree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, FloatingPoint, HeaderHolder> tree_type;
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_set_impl)
|
||||
|
||||
typedef tree_type implementation_defined;
|
||||
@@ -56,6 +56,8 @@ class sg_set_impl
|
||||
|
||||
public:
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::key_of_value key_of_value;
|
||||
typedef typename implementation_defined::value_traits value_traits;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
@@ -79,16 +81,16 @@ class sg_set_impl
|
||||
static const bool constant_time_size = tree_type::constant_time_size;
|
||||
|
||||
public:
|
||||
//! @copydoc ::boost::intrusive::sgtree::sgtree(const value_compare &,const value_traits &)
|
||||
explicit sg_set_impl( const value_compare &cmp = value_compare()
|
||||
//! @copydoc ::boost::intrusive::sgtree::sgtree(const key_compare &,const value_traits &)
|
||||
explicit sg_set_impl( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::sgtree(bool,Iterator,Iterator,const value_compare &,const value_traits &)
|
||||
//! @copydoc ::boost::intrusive::sgtree::sgtree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
|
||||
template<class Iterator>
|
||||
sg_set_impl( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(true, b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -169,11 +171,20 @@ class sg_set_impl
|
||||
//! @copydoc ::boost::intrusive::sgtree::swap
|
||||
void swap(sg_set_impl& other);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::clone_from
|
||||
//! @copydoc ::boost::intrusive::sgtree::clone_from(const sgtree&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const sg_set_impl &src, Cloner cloner, Disposer disposer);
|
||||
|
||||
#endif //#ifdef BOOST_iNTRUSIVE_DOXYGEN_INVOKED
|
||||
#else
|
||||
|
||||
using tree_type::clone_from;
|
||||
|
||||
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::clone_from(sgtree&&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(sg_set_impl) src, Cloner cloner, Disposer disposer)
|
||||
{ tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::insert_unique(reference)
|
||||
std::pair<iterator, bool> insert(reference value)
|
||||
@@ -183,18 +194,18 @@ class sg_set_impl
|
||||
iterator insert(const_iterator hint, reference value)
|
||||
{ return tree_type::insert_unique(hint, value); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::insert_unique_check(const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::sgtree::insert_unique_check(const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_check
|
||||
(const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(key, key_value_comp, commit_data); }
|
||||
(const KeyType &key, KeyTypeKeyCompare comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(key, comp, commit_data); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::insert_unique_check(const_iterator,const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::sgtree::insert_unique_check(const_iterator,const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_check
|
||||
(const_iterator hint, const KeyType &key
|
||||
,KeyValueCompare key_value_comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(hint, key, key_value_comp, commit_data); }
|
||||
,KeyTypeKeyCompare comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(hint, key, comp, commit_data); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::insert_unique(Iterator,Iterator)
|
||||
template<class Iterator>
|
||||
@@ -221,12 +232,12 @@ class sg_set_impl
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase(const_iterator,const_iterator)
|
||||
iterator erase(const_iterator b, const_iterator e);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase(const_reference)
|
||||
size_type erase(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase(const key_type &)
|
||||
size_type erase(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const_iterator,Disposer)
|
||||
template<class Disposer>
|
||||
@@ -236,13 +247,13 @@ class sg_set_impl
|
||||
template<class Disposer>
|
||||
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const_reference, Disposer)
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const key_type &, Disposer)
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer);
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::clear
|
||||
void clear();
|
||||
@@ -253,100 +264,100 @@ class sg_set_impl
|
||||
|
||||
#endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::count(const_reference)const
|
||||
size_type count(const_reference value) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(value) != this->tree_type::cend()); }
|
||||
//! @copydoc ::boost::intrusive::sgtree::count(const key_type &)const
|
||||
size_type count(const key_type &key) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(key) != this->tree_type::cend()); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp) const
|
||||
//! @copydoc ::boost::intrusive::sgtree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(key, comp) != this->tree_type::cend()); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::lower_bound(const_reference)
|
||||
iterator lower_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::sgtree::lower_bound(const key_type &)
|
||||
iterator lower_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::lower_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::sgtree::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::lower_bound(const_reference)const
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::sgtree::lower_bound(const key_type &)const
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::sgtree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::upper_bound(const_reference)
|
||||
iterator upper_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::sgtree::upper_bound(const key_type &)
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::upper_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::sgtree::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::upper_bound(const_reference)const
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::sgtree::upper_bound(const key_type &)const
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::sgtree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::find(const_reference)
|
||||
iterator find(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::sgtree::find(const key_type &)
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::find(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::sgtree::find(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::find(const_reference)const
|
||||
const_iterator find(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::sgtree::find(const key_type &)const
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::find(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::sgtree::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
#endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const_reference)
|
||||
std::pair<iterator,iterator> equal_range(const_reference value)
|
||||
{ return this->tree_type::lower_bound_range(value); }
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const key_type &)
|
||||
std::pair<iterator,iterator> equal_range(const key_type &key)
|
||||
{ return this->tree_type::lower_bound_range(key); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp)
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp)
|
||||
{ return this->tree_type::lower_bound_range(key, comp); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const key_type &)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const_reference value) const
|
||||
{ return this->tree_type::lower_bound_range(value); }
|
||||
equal_range(const key_type &key) const
|
||||
{ return this->tree_type::lower_bound_range(key); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const KeyType& key, KeyValueCompare comp) const
|
||||
equal_range(const KeyType& key, KeyTypeKeyCompare comp) const
|
||||
{ return this->tree_type::lower_bound_range(key, comp); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::sgtree::bounded_range(const key_type &,const key_type &,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::sgtree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::sgtree::bounded_range(const key_type &,const key_type &,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
bounded_range(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::sgtree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -413,7 +424,7 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_sg_set
|
||||
{
|
||||
@@ -421,7 +432,7 @@ struct make_sg_set
|
||||
typedef typename pack_options
|
||||
< sgtree_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -432,6 +443,7 @@ struct make_sg_set
|
||||
|
||||
typedef sg_set_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::size_type
|
||||
, packed_options::floating_point
|
||||
@@ -443,14 +455,14 @@ struct make_sg_set
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class sg_set
|
||||
: public make_sg_set<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -459,7 +471,7 @@ class sg_set
|
||||
typedef typename make_sg_set
|
||||
<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -467,7 +479,7 @@ class sg_set
|
||||
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_set)
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
typedef typename Base::const_iterator const_iterator;
|
||||
@@ -475,14 +487,14 @@ class sg_set
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
explicit sg_set( const value_compare &cmp = value_compare()
|
||||
explicit sg_set( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, v_traits)
|
||||
{}
|
||||
|
||||
template<class Iterator>
|
||||
sg_set( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -494,6 +506,14 @@ class sg_set
|
||||
sg_set& operator=(BOOST_RV_REF(sg_set) x)
|
||||
{ return static_cast<sg_set &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const sg_set &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(sg_set) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static sg_set &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<sg_set &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
@@ -523,15 +543,15 @@ class sg_set
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class Compare, class SizeType, bool FloatingPoint, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool FloatingPoint, typename HeaderHolder>
|
||||
#endif
|
||||
class sg_multiset_impl
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
: public sgtree_impl<ValueTraits, Compare, SizeType, FloatingPoint, HeaderHolder>
|
||||
: public sgtree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, FloatingPoint, HeaderHolder>
|
||||
#endif
|
||||
{
|
||||
/// @cond
|
||||
typedef sgtree_impl<ValueTraits, Compare, SizeType, FloatingPoint, HeaderHolder> tree_type;
|
||||
typedef sgtree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, FloatingPoint, HeaderHolder> tree_type;
|
||||
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_multiset_impl)
|
||||
typedef tree_type implementation_defined;
|
||||
@@ -539,6 +559,8 @@ class sg_multiset_impl
|
||||
|
||||
public:
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::key_of_value key_of_value;
|
||||
typedef typename implementation_defined::value_traits value_traits;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
@@ -562,16 +584,16 @@ class sg_multiset_impl
|
||||
static const bool constant_time_size = tree_type::constant_time_size;
|
||||
|
||||
public:
|
||||
//! @copydoc ::boost::intrusive::sgtree::sgtree(const value_compare &,const value_traits &)
|
||||
explicit sg_multiset_impl( const value_compare &cmp = value_compare()
|
||||
//! @copydoc ::boost::intrusive::sgtree::sgtree(const key_compare &,const value_traits &)
|
||||
explicit sg_multiset_impl( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::sgtree(bool,Iterator,Iterator,const value_compare &,const value_traits &)
|
||||
//! @copydoc ::boost::intrusive::sgtree::sgtree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
|
||||
template<class Iterator>
|
||||
sg_multiset_impl( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(false, b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -652,11 +674,20 @@ class sg_multiset_impl
|
||||
//! @copydoc ::boost::intrusive::sgtree::swap
|
||||
void swap(sg_multiset_impl& other);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::clone_from
|
||||
//! @copydoc ::boost::intrusive::sgtree::clone_from(const sgtree&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const sg_multiset_impl &src, Cloner cloner, Disposer disposer);
|
||||
|
||||
#endif //#ifdef BOOST_iNTRUSIVE_DOXYGEN_INVOKED
|
||||
#else
|
||||
|
||||
using tree_type::clone_from;
|
||||
|
||||
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::clone_from(sgtree&&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(sg_multiset_impl) src, Cloner cloner, Disposer disposer)
|
||||
{ tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::insert_equal(reference)
|
||||
iterator insert(reference value)
|
||||
@@ -687,12 +718,12 @@ class sg_multiset_impl
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase(const_iterator,const_iterator)
|
||||
iterator erase(const_iterator b, const_iterator e);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase(const_reference)
|
||||
size_type erase(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase(const key_type &)
|
||||
size_type erase(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const_iterator,Disposer)
|
||||
template<class Disposer>
|
||||
@@ -702,13 +733,13 @@ class sg_multiset_impl
|
||||
template<class Disposer>
|
||||
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const_reference, Disposer)
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const key_type &, Disposer)
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer);
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
|
||||
//! @copydoc ::boost::intrusive::sgtree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::clear
|
||||
void clear();
|
||||
@@ -717,88 +748,88 @@ class sg_multiset_impl
|
||||
template<class Disposer>
|
||||
void clear_and_dispose(Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::count(const_reference)const
|
||||
size_type count(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::sgtree::count(const key_type &)const
|
||||
size_type count(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::sgtree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::lower_bound(const_reference)
|
||||
iterator lower_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::sgtree::lower_bound(const key_type &)
|
||||
iterator lower_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::lower_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::sgtree::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::lower_bound(const_reference)const
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::sgtree::lower_bound(const key_type &)const
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::sgtree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::upper_bound(const_reference)
|
||||
iterator upper_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::sgtree::upper_bound(const key_type &)
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::upper_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::sgtree::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::upper_bound(const_reference)const
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::sgtree::upper_bound(const key_type &)const
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::sgtree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::find(const_reference)
|
||||
iterator find(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::sgtree::find(const key_type &)
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::find(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::sgtree::find(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::find(const_reference)const
|
||||
const_iterator find(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::sgtree::find(const key_type &)const
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::find(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::sgtree::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::equal_range(const_reference)
|
||||
std::pair<iterator,iterator> equal_range(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::sgtree::equal_range(const key_type &)
|
||||
std::pair<iterator,iterator> equal_range(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::equal_range(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::sgtree::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::sgtree::equal_range(const key_type &)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const_reference value) const;
|
||||
equal_range(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::equal_range(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::sgtree::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const KeyType& key, KeyValueCompare comp) const;
|
||||
equal_range(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::sgtree::bounded_range(const key_type &,const key_type &,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::sgtree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::sgtree::bounded_range(const key_type &,const key_type &,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
bounded_range(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::sgtree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::sgtree::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -865,7 +896,7 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_sg_multiset
|
||||
{
|
||||
@@ -873,7 +904,7 @@ struct make_sg_multiset
|
||||
typedef typename pack_options
|
||||
< sgtree_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -884,6 +915,7 @@ struct make_sg_multiset
|
||||
|
||||
typedef sg_multiset_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::size_type
|
||||
, packed_options::floating_point
|
||||
@@ -896,14 +928,14 @@ struct make_sg_multiset
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class sg_multiset
|
||||
: public make_sg_multiset<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -911,7 +943,7 @@ class sg_multiset
|
||||
{
|
||||
typedef typename make_sg_multiset<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -920,7 +952,7 @@ class sg_multiset
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_multiset)
|
||||
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
typedef typename Base::const_iterator const_iterator;
|
||||
@@ -928,14 +960,14 @@ class sg_multiset
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
sg_multiset( const value_compare &cmp = value_compare()
|
||||
sg_multiset( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, v_traits)
|
||||
{}
|
||||
|
||||
template<class Iterator>
|
||||
sg_multiset( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -947,6 +979,14 @@ class sg_multiset
|
||||
sg_multiset& operator=(BOOST_RV_REF(sg_multiset) x)
|
||||
{ return static_cast<sg_multiset &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const sg_multiset &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(sg_multiset) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static sg_multiset &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<sg_multiset &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
|
||||
+124
-115
@@ -195,13 +195,9 @@ struct alpha_holder<false, SizeType>
|
||||
} //namespace detail{
|
||||
|
||||
struct sgtree_defaults
|
||||
: bstree_defaults
|
||||
{
|
||||
typedef default_bstree_hook_applier proto_value_traits;
|
||||
static const bool constant_time_size = true;
|
||||
typedef std::size_t size_type;
|
||||
typedef void compare;
|
||||
static const bool floating_point = true;
|
||||
typedef void header_holder_type;
|
||||
};
|
||||
|
||||
/// @endcond
|
||||
@@ -222,18 +218,18 @@ struct sgtree_defaults
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class VoidOrKeyComp, class SizeType, bool FloatingPoint, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class SizeType, bool FloatingPoint, typename HeaderHolder>
|
||||
#endif
|
||||
class sgtree_impl
|
||||
/// @cond
|
||||
: public bstree_impl<ValueTraits, VoidOrKeyComp, SizeType, true, SgTreeAlgorithms, HeaderHolder>
|
||||
: public bstree_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType, true, SgTreeAlgorithms, HeaderHolder>
|
||||
, public detail::alpha_holder<FloatingPoint, SizeType>
|
||||
/// @endcond
|
||||
{
|
||||
public:
|
||||
typedef ValueTraits value_traits;
|
||||
/// @cond
|
||||
typedef bstree_impl< ValueTraits, VoidOrKeyComp, SizeType
|
||||
typedef bstree_impl< ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType
|
||||
, true, SgTreeAlgorithms, HeaderHolder> tree_type;
|
||||
typedef tree_type implementation_defined;
|
||||
|
||||
@@ -243,6 +239,7 @@ class sgtree_impl
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::key_of_value key_of_value;
|
||||
typedef typename implementation_defined::reference reference;
|
||||
typedef typename implementation_defined::const_reference const_reference;
|
||||
typedef typename implementation_defined::difference_type difference_type;
|
||||
@@ -284,16 +281,16 @@ class sgtree_impl
|
||||
|
||||
typedef BOOST_INTRUSIVE_IMPDEF(typename node_algorithms::insert_commit_data) insert_commit_data;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(const value_compare &,const value_traits &)
|
||||
explicit sgtree_impl( const value_compare &cmp = value_compare()
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(const key_compare &,const value_traits &)
|
||||
explicit sgtree_impl( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(bool,Iterator,Iterator,const value_compare &,const value_traits &)
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
|
||||
template<class Iterator>
|
||||
sgtree_impl( bool unique, Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits)
|
||||
{
|
||||
@@ -408,26 +405,33 @@ class sgtree_impl
|
||||
::boost::adl_move_swap(this->get_alpha_traits(), other.get_alpha_traits());
|
||||
}
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from(const bstree&,Cloner,Disposer)
|
||||
//! Additional notes: it also copies the alpha factor from the source container.
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const sgtree_impl &src, Cloner cloner, Disposer disposer)
|
||||
{
|
||||
this->tree_type::clone_from(src, cloner, disposer);
|
||||
tree_type::clone_from(src, cloner, disposer);
|
||||
this->get_alpha_traits() = src.get_alpha_traits();
|
||||
}
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from(bstree&&,Cloner,Disposer)
|
||||
//! Additional notes: it also copies the alpha factor from the source container.
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(sgtree_impl) src, Cloner cloner, Disposer disposer)
|
||||
{
|
||||
tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer);
|
||||
this->get_alpha_traits() = ::boost::move(src.get_alpha_traits());
|
||||
}
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_equal(reference)
|
||||
iterator insert_equal(reference value)
|
||||
{
|
||||
detail::key_nodeptr_comp<value_compare, value_traits>
|
||||
key_node_comp(this->value_comp(), &this->get_value_traits());
|
||||
node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
|
||||
std::size_t max_tree_size = (std::size_t)this->max_tree_size_;
|
||||
node_ptr p = node_algorithms::insert_equal_upper_bound
|
||||
(this->tree_type::header_ptr(), to_insert, key_node_comp
|
||||
(this->tree_type::header_ptr(), to_insert, this->key_node_comp(this->key_comp())
|
||||
, (size_type)this->size(), this->get_h_alpha_func(), max_tree_size);
|
||||
this->tree_type::sz_traits().increment();
|
||||
this->max_tree_size_ = (size_type)max_tree_size;
|
||||
@@ -437,14 +441,12 @@ class sgtree_impl
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_equal(const_iterator,reference)
|
||||
iterator insert_equal(const_iterator hint, reference value)
|
||||
{
|
||||
detail::key_nodeptr_comp<value_compare, value_traits>
|
||||
key_node_comp(this->value_comp(), &this->get_value_traits());
|
||||
node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
|
||||
std::size_t max_tree_size = (std::size_t)this->max_tree_size_;
|
||||
node_ptr p = node_algorithms::insert_equal
|
||||
(this->tree_type::header_ptr(), hint.pointed_node(), to_insert, key_node_comp
|
||||
( this->tree_type::header_ptr(), hint.pointed_node(), to_insert, this->key_node_comp(this->key_comp())
|
||||
, (std::size_t)this->size(), this->get_h_alpha_func(), max_tree_size);
|
||||
this->tree_type::sz_traits().increment();
|
||||
this->max_tree_size_ = (size_type)max_tree_size;
|
||||
@@ -464,46 +466,44 @@ class sgtree_impl
|
||||
std::pair<iterator, bool> insert_unique(reference value)
|
||||
{
|
||||
insert_commit_data commit_data;
|
||||
std::pair<iterator, bool> ret = insert_unique_check(value, this->value_comp(), commit_data);
|
||||
std::pair<iterator, bool> ret = this->insert_unique_check
|
||||
(key_of_value()(value), this->key_comp(), commit_data);
|
||||
if(!ret.second)
|
||||
return ret;
|
||||
return std::pair<iterator, bool> (insert_unique_commit(value, commit_data), true);
|
||||
return std::pair<iterator, bool> (this->insert_unique_commit(value, commit_data), true);
|
||||
}
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique(const_iterator,reference)
|
||||
iterator insert_unique(const_iterator hint, reference value)
|
||||
{
|
||||
insert_commit_data commit_data;
|
||||
std::pair<iterator, bool> ret = insert_unique_check(hint, value, this->value_comp(), commit_data);
|
||||
std::pair<iterator, bool> ret = this->insert_unique_check
|
||||
(hint, key_of_value()(value), this->key_comp(), commit_data);
|
||||
if(!ret.second)
|
||||
return ret.first;
|
||||
return insert_unique_commit(value, commit_data);
|
||||
return this->insert_unique_commit(value, commit_data);
|
||||
}
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_unique_check
|
||||
(const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data)
|
||||
(const KeyType &key, KeyTypeKeyCompare comp, insert_commit_data &commit_data)
|
||||
{
|
||||
detail::key_nodeptr_comp<KeyValueCompare, value_traits>
|
||||
comp(key_value_comp, &this->get_value_traits());
|
||||
std::pair<node_ptr, bool> ret =
|
||||
(node_algorithms::insert_unique_check
|
||||
(this->tree_type::header_ptr(), key, comp, commit_data));
|
||||
node_algorithms::insert_unique_check
|
||||
(this->tree_type::header_ptr(), key, this->key_node_comp(comp), commit_data);
|
||||
return std::pair<iterator, bool>(iterator(ret.first, this->priv_value_traits_ptr()), ret.second);
|
||||
}
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const_iterator,const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const_iterator,const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_unique_check
|
||||
(const_iterator hint, const KeyType &key
|
||||
,KeyValueCompare key_value_comp, insert_commit_data &commit_data)
|
||||
,KeyTypeKeyCompare comp, insert_commit_data &commit_data)
|
||||
{
|
||||
detail::key_nodeptr_comp<KeyValueCompare, value_traits>
|
||||
comp(key_value_comp, &this->get_value_traits());
|
||||
std::pair<node_ptr, bool> ret =
|
||||
(node_algorithms::insert_unique_check
|
||||
(this->tree_type::header_ptr(), hint.pointed_node(), key, comp, commit_data));
|
||||
node_algorithms::insert_unique_check
|
||||
(this->tree_type::header_ptr(), hint.pointed_node(), key, this->key_node_comp(comp), commit_data);
|
||||
return std::pair<iterator, bool>(iterator(ret.first, this->priv_value_traits_ptr()), ret.second);
|
||||
}
|
||||
|
||||
@@ -604,15 +604,15 @@ class sgtree_impl
|
||||
iterator erase(const_iterator b, const_iterator e)
|
||||
{ size_type n; return private_erase(b, e, n); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const_reference)
|
||||
size_type erase(const_reference value)
|
||||
{ return this->erase(value, this->value_comp()); }
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const key_type &)
|
||||
size_type erase(const key_type &key)
|
||||
{ return this->erase(key, this->key_comp()); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
BOOST_INTRUSIVE_DOC1ST(size_type
|
||||
, typename detail::disable_if_convertible<KeyValueCompare BOOST_INTRUSIVE_I const_iterator BOOST_INTRUSIVE_I size_type>::type)
|
||||
erase(const KeyType& key, KeyValueCompare comp)
|
||||
, typename detail::disable_if_convertible<KeyTypeKeyCompare BOOST_INTRUSIVE_I const_iterator BOOST_INTRUSIVE_I size_type>::type)
|
||||
erase(const KeyType& key, KeyTypeKeyCompare comp)
|
||||
{
|
||||
std::pair<iterator,iterator> p = this->equal_range(key, comp);
|
||||
size_type n;
|
||||
@@ -641,21 +641,21 @@ class sgtree_impl
|
||||
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer)
|
||||
{ size_type n; return private_erase(b, e, n, disposer); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_reference, Disposer)
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const key_type &, Disposer)
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer)
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer)
|
||||
{
|
||||
std::pair<iterator,iterator> p = this->equal_range(value);
|
||||
std::pair<iterator,iterator> p = this->equal_range(key);
|
||||
size_type n;
|
||||
private_erase(p.first, p.second, n, disposer);
|
||||
return n;
|
||||
}
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
BOOST_INTRUSIVE_DOC1ST(size_type
|
||||
, typename detail::disable_if_convertible<KeyValueCompare BOOST_INTRUSIVE_I const_iterator BOOST_INTRUSIVE_I size_type>::type)
|
||||
erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer)
|
||||
, typename detail::disable_if_convertible<KeyTypeKeyCompare BOOST_INTRUSIVE_I const_iterator BOOST_INTRUSIVE_I size_type>::type)
|
||||
erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer)
|
||||
{
|
||||
std::pair<iterator,iterator> p = this->equal_range(key, comp);
|
||||
size_type n;
|
||||
@@ -679,88 +679,88 @@ class sgtree_impl
|
||||
}
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const_reference)const
|
||||
size_type count(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const key_type &)const
|
||||
size_type count(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)
|
||||
iterator lower_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)
|
||||
iterator lower_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)const
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)const
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const_reference)
|
||||
iterator upper_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const_reference)const
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)const
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const_reference)
|
||||
iterator find(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const key_type &)
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const_reference)const
|
||||
const_iterator find(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const key_type &)const
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const_reference)
|
||||
std::pair<iterator,iterator> equal_range(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)
|
||||
std::pair<iterator,iterator> equal_range(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const_reference value) const;
|
||||
equal_range(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const KeyType& key, KeyValueCompare comp) const;
|
||||
equal_range(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type &,const key_type &,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type &,const key_type &,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
bounded_range(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -868,7 +868,7 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_sgtree
|
||||
{
|
||||
@@ -876,7 +876,7 @@ struct make_sgtree
|
||||
typedef typename pack_options
|
||||
< sgtree_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -887,6 +887,7 @@ struct make_sgtree
|
||||
|
||||
typedef sgtree_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::size_type
|
||||
, packed_options::floating_point
|
||||
@@ -900,14 +901,14 @@ struct make_sgtree
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class sgtree
|
||||
: public make_sgtree<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -916,7 +917,7 @@ class sgtree
|
||||
typedef typename make_sgtree
|
||||
<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -924,7 +925,7 @@ class sgtree
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(sgtree)
|
||||
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
typedef typename Base::const_iterator const_iterator;
|
||||
@@ -934,14 +935,14 @@ class sgtree
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
explicit sgtree( const value_compare &cmp = value_compare()
|
||||
explicit sgtree( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, v_traits)
|
||||
{}
|
||||
|
||||
template<class Iterator>
|
||||
sgtree( bool unique, Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(unique, b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -953,6 +954,14 @@ class sgtree
|
||||
sgtree& operator=(BOOST_RV_REF(sgtree) x)
|
||||
{ return static_cast<sgtree &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const sgtree &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(sgtree) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static sgtree &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<sgtree &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
|
||||
@@ -416,8 +416,7 @@ class slist_impl
|
||||
void push_front(reference value)
|
||||
{
|
||||
node_ptr to_insert = priv_value_traits().to_node_ptr(value);
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(to_insert));
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::inited(to_insert));
|
||||
if(cache_last){
|
||||
if(this->empty()){
|
||||
this->set_last_node(to_insert);
|
||||
@@ -442,8 +441,7 @@ class slist_impl
|
||||
{
|
||||
BOOST_STATIC_ASSERT((cache_last));
|
||||
node_ptr n = priv_value_traits().to_node_ptr(value);
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(n));
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::inited(n));
|
||||
node_algorithms::link_after(this->get_last_node(), n);
|
||||
if(cache_last){
|
||||
this->set_last_node(n);
|
||||
@@ -768,6 +766,34 @@ class slist_impl
|
||||
rollback.release();
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
|
||||
//! Cloner should yield to nodes equivalent to the original nodes.
|
||||
//!
|
||||
//! <b>Effects</b>: Erases all the elements from *this
|
||||
//! calling Disposer::operator()(pointer), clones all the
|
||||
//! elements from src calling Cloner::operator()(reference)
|
||||
//! and inserts them on *this.
|
||||
//!
|
||||
//! If cloner throws, all cloned elements are unlinked and disposed
|
||||
//! calling Disposer::operator()(pointer).
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to erased plus inserted elements.
|
||||
//!
|
||||
//! <b>Throws</b>: If cloner throws.
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(slist_impl) src, Cloner cloner, Disposer disposer)
|
||||
{
|
||||
this->clear_and_dispose(disposer);
|
||||
detail::exception_disposer<slist_impl, Disposer>
|
||||
rollback(*this, disposer);
|
||||
iterator prev(this->cbefore_begin());
|
||||
iterator b(src.begin()), e(src.end());
|
||||
for(; b != e; ++b){
|
||||
prev = this->insert_after(prev, *cloner(*b));
|
||||
}
|
||||
rollback.release();
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: value must be an lvalue and prev_p must point to an element
|
||||
//! contained by the list or to end().
|
||||
//!
|
||||
@@ -784,8 +810,7 @@ class slist_impl
|
||||
iterator insert_after(const_iterator prev_p, reference value)
|
||||
{
|
||||
node_ptr n = priv_value_traits().to_node_ptr(value);
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(n));
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::inited(n));
|
||||
node_ptr prev_n(prev_p.pointed_node());
|
||||
node_algorithms::link_after(prev_n, n);
|
||||
if(cache_last && (this->get_last_node() == prev_n)){
|
||||
@@ -815,8 +840,7 @@ class slist_impl
|
||||
node_ptr prev_n(prev_p.pointed_node());
|
||||
for (; f != l; ++f, ++count){
|
||||
const node_ptr n = priv_value_traits().to_node_ptr(*f);
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(n));
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::inited(n));
|
||||
node_algorithms::link_after(prev_n, n);
|
||||
prev_n = n;
|
||||
}
|
||||
@@ -1028,6 +1052,15 @@ class slist_impl
|
||||
|
||||
/// @cond
|
||||
|
||||
static iterator s_insert_after(const_iterator const prev_p, reference value)
|
||||
{
|
||||
BOOST_STATIC_ASSERT(((!cache_last)&&(!constant_time_size)&&(!stateful_value_traits)));
|
||||
node_ptr const n = value_traits::to_node_ptr(value);
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::inited(n));
|
||||
node_algorithms::link_after(prev_p.pointed_node(), n);
|
||||
return iterator (n, const_value_traits_ptr());
|
||||
}
|
||||
|
||||
template<class Disposer>
|
||||
static iterator s_erase_after_and_dispose(const_iterator prev, Disposer disposer)
|
||||
{
|
||||
@@ -1044,6 +1077,23 @@ class slist_impl
|
||||
return it.unconst();
|
||||
}
|
||||
|
||||
template<class Disposer>
|
||||
static iterator s_erase_after_and_dispose(const_iterator before_f, const_iterator l, Disposer disposer)
|
||||
{
|
||||
BOOST_STATIC_ASSERT(((!cache_last)&&(!constant_time_size)&&(!stateful_value_traits)));
|
||||
node_ptr bfp(before_f.pointed_node()), lp(l.pointed_node());
|
||||
node_ptr fp(node_traits::get_next(bfp));
|
||||
node_algorithms::unlink_after(bfp, lp);
|
||||
while(fp != lp){
|
||||
node_ptr to_erase(fp);
|
||||
fp = node_traits::get_next(fp);
|
||||
if(safemode_or_autounlink)
|
||||
node_algorithms::init(to_erase);
|
||||
disposer(value_traits::to_value_ptr(to_erase));
|
||||
}
|
||||
return l.unconst();
|
||||
}
|
||||
|
||||
static iterator s_erase_after(const_iterator prev)
|
||||
{ return s_erase_after_and_dispose(prev, detail::null_disposer()); }
|
||||
|
||||
@@ -2163,6 +2213,14 @@ class slist
|
||||
slist& operator=(BOOST_RV_REF(slist) x)
|
||||
{ return static_cast<slist &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const slist &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(slist) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static slist &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<slist &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
|
||||
@@ -40,15 +40,15 @@ namespace intrusive {
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
#endif
|
||||
class splay_set_impl
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
: public splaytree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, HeaderHolder>
|
||||
: public splaytree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, HeaderHolder>
|
||||
#endif
|
||||
{
|
||||
/// @cond
|
||||
typedef splaytree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, HeaderHolder> tree_type;
|
||||
typedef splaytree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, HeaderHolder> tree_type;
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(splay_set_impl)
|
||||
|
||||
typedef tree_type implementation_defined;
|
||||
@@ -56,6 +56,8 @@ class splay_set_impl
|
||||
|
||||
public:
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::key_of_value key_of_value;
|
||||
typedef typename implementation_defined::value_traits value_traits;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
@@ -79,16 +81,16 @@ class splay_set_impl
|
||||
static const bool constant_time_size = tree_type::constant_time_size;
|
||||
|
||||
public:
|
||||
//! @copydoc ::boost::intrusive::splaytree::splaytree(const value_compare &,const value_traits &)
|
||||
explicit splay_set_impl( const value_compare &cmp = value_compare()
|
||||
//! @copydoc ::boost::intrusive::splaytree::splaytree(const key_compare &,const value_traits &)
|
||||
explicit splay_set_impl( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::splaytree(bool,Iterator,Iterator,const value_compare &,const value_traits &)
|
||||
//! @copydoc ::boost::intrusive::splaytree::splaytree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
|
||||
template<class Iterator>
|
||||
splay_set_impl( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(true, b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -169,11 +171,20 @@ class splay_set_impl
|
||||
//! @copydoc ::boost::intrusive::splaytree::swap
|
||||
void swap(splay_set_impl& other);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::clone_from
|
||||
//! @copydoc ::boost::intrusive::splaytree::clone_from(const splaytree&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const splay_set_impl &src, Cloner cloner, Disposer disposer);
|
||||
|
||||
#endif //#ifdef BOOST_iNTRUSIVE_DOXYGEN_INVOKED
|
||||
#else
|
||||
|
||||
using tree_type::clone_from;
|
||||
|
||||
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::clone_from(splaytree&&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(splay_set_impl) src, Cloner cloner, Disposer disposer)
|
||||
{ tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::insert_unique(reference)
|
||||
std::pair<iterator, bool> insert(reference value)
|
||||
@@ -183,18 +194,18 @@ class splay_set_impl
|
||||
iterator insert(const_iterator hint, reference value)
|
||||
{ return tree_type::insert_unique(hint, value); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::insert_unique_check(const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::splaytree::insert_unique_check(const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_check
|
||||
(const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(key, key_value_comp, commit_data); }
|
||||
(const KeyType &key, KeyTypeKeyCompare comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(key, comp, commit_data); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::insert_unique_check(const_iterator,const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::splaytree::insert_unique_check(const_iterator,const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_check
|
||||
(const_iterator hint, const KeyType &key
|
||||
,KeyValueCompare key_value_comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(hint, key, key_value_comp, commit_data); }
|
||||
,KeyTypeKeyCompare comp, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(hint, key, comp, commit_data); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::insert_unique(Iterator,Iterator)
|
||||
template<class Iterator>
|
||||
@@ -221,12 +232,12 @@ class splay_set_impl
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase(const_iterator,const_iterator)
|
||||
iterator erase(const_iterator b, const_iterator e);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase(const_reference)
|
||||
size_type erase(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase(const key_type &)
|
||||
size_type erase(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase_and_dispose(const_iterator,Disposer)
|
||||
template<class Disposer>
|
||||
@@ -236,13 +247,13 @@ class splay_set_impl
|
||||
template<class Disposer>
|
||||
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase_and_dispose(const_reference, Disposer)
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase_and_dispose(const key_type &, Disposer)
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer);
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::clear
|
||||
void clear();
|
||||
@@ -253,107 +264,107 @@ class splay_set_impl
|
||||
|
||||
#endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::count(const_reference)const
|
||||
size_type count(const_reference value) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(value) != this->tree_type::cend()); }
|
||||
//! @copydoc ::boost::intrusive::splaytree::count(const key_type &)const
|
||||
size_type count(const key_type &key) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(key) != this->tree_type::cend()); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp) const
|
||||
//! @copydoc ::boost::intrusive::splaytree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(key, comp) != this->tree_type::cend()); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::count(const_reference)const
|
||||
size_type count(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::splaytree::count(const key_type &)const
|
||||
size_type count(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::splaytree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::lower_bound(const_reference)
|
||||
iterator lower_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::splaytree::lower_bound(const key_type &)
|
||||
iterator lower_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::lower_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::splaytree::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::lower_bound(const_reference)const
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::splaytree::lower_bound(const key_type &)const
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::splaytree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::upper_bound(const_reference)
|
||||
iterator upper_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::splaytree::upper_bound(const key_type &)
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::upper_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::splaytree::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::upper_bound(const_reference)const
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::splaytree::upper_bound(const key_type &)const
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::splaytree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::find(const_reference)
|
||||
iterator find(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::splaytree::find(const key_type &)
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::find(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::splaytree::find(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::find(const_reference)const
|
||||
const_iterator find(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::splaytree::find(const key_type &)const
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::find(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::splaytree::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
#endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const_reference)
|
||||
std::pair<iterator,iterator> equal_range(const_reference value)
|
||||
{ return this->tree_type::lower_bound_range(value); }
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const key_type &)
|
||||
std::pair<iterator,iterator> equal_range(const key_type &key)
|
||||
{ return this->tree_type::lower_bound_range(key); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp)
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp)
|
||||
{ return this->tree_type::lower_bound_range(key, comp); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const key_type &)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const_reference value) const
|
||||
{ return this->tree_type::lower_bound_range(value); }
|
||||
equal_range(const key_type &key) const
|
||||
{ return this->tree_type::lower_bound_range(key); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const KeyType& key, KeyValueCompare comp) const
|
||||
equal_range(const KeyType& key, KeyTypeKeyCompare comp) const
|
||||
{ return this->tree_type::lower_bound_range(key, comp); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::splaytree::bounded_range(const key_type&,const key_type&,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::splaytree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::splaytree::bounded_range(const key_type&,const key_type&,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::splaytree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -382,12 +393,12 @@ class splay_set_impl
|
||||
//! @copydoc ::boost::intrusive::splaytree::splay_up(iterator)
|
||||
void splay_up(iterator i);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::splay_down(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator splay_down(const KeyType &key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::splaytree::splay_down(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator splay_down(const KeyType &key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::splay_down(const_reference)
|
||||
iterator splay_down(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::splaytree::splay_down(const key_type &key)
|
||||
iterator splay_down(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::rebalance
|
||||
void rebalance();
|
||||
@@ -423,7 +434,7 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_splay_set
|
||||
{
|
||||
@@ -431,7 +442,7 @@ struct make_splay_set
|
||||
typedef typename pack_options
|
||||
< splaytree_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -442,6 +453,7 @@ struct make_splay_set
|
||||
|
||||
typedef splay_set_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::size_type
|
||||
, packed_options::constant_time_size
|
||||
@@ -453,14 +465,14 @@ struct make_splay_set
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class splay_set
|
||||
: public make_splay_set<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -469,7 +481,7 @@ class splay_set
|
||||
typedef typename make_splay_set
|
||||
<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -477,7 +489,7 @@ class splay_set
|
||||
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(splay_set)
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
typedef typename Base::const_iterator const_iterator;
|
||||
@@ -485,14 +497,14 @@ class splay_set
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
explicit splay_set( const value_compare &cmp = value_compare()
|
||||
explicit splay_set( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, v_traits)
|
||||
{}
|
||||
|
||||
template<class Iterator>
|
||||
splay_set( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -504,6 +516,14 @@ class splay_set
|
||||
splay_set& operator=(BOOST_RV_REF(splay_set) x)
|
||||
{ return static_cast<splay_set &>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const splay_set &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(splay_set) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static splay_set &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<splay_set &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
@@ -533,15 +553,15 @@ class splay_set
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
#endif
|
||||
class splay_multiset_impl
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
: public splaytree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, HeaderHolder>
|
||||
: public splaytree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, HeaderHolder>
|
||||
#endif
|
||||
{
|
||||
/// @cond
|
||||
typedef splaytree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, HeaderHolder> tree_type;
|
||||
typedef splaytree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, HeaderHolder> tree_type;
|
||||
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(splay_multiset_impl)
|
||||
typedef tree_type implementation_defined;
|
||||
@@ -549,6 +569,8 @@ class splay_multiset_impl
|
||||
|
||||
public:
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::key_of_value key_of_value;
|
||||
typedef typename implementation_defined::value_traits value_traits;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
@@ -572,16 +594,16 @@ class splay_multiset_impl
|
||||
static const bool constant_time_size = tree_type::constant_time_size;
|
||||
|
||||
public:
|
||||
//! @copydoc ::boost::intrusive::splaytree::splaytree(const value_compare &,const value_traits &)
|
||||
explicit splay_multiset_impl( const value_compare &cmp = value_compare()
|
||||
//! @copydoc ::boost::intrusive::splaytree::splaytree(const key_compare &,const value_traits &)
|
||||
explicit splay_multiset_impl( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::splaytree(bool,Iterator,Iterator,const value_compare &,const value_traits &)
|
||||
//! @copydoc ::boost::intrusive::splaytree::splaytree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
|
||||
template<class Iterator>
|
||||
splay_multiset_impl( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(false, b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -662,11 +684,20 @@ class splay_multiset_impl
|
||||
//! @copydoc ::boost::intrusive::splaytree::swap
|
||||
void swap(splay_multiset_impl& other);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::clone_from
|
||||
//! @copydoc ::boost::intrusive::splaytree::clone_from(const splaytree&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const splay_multiset_impl &src, Cloner cloner, Disposer disposer);
|
||||
|
||||
#endif //#ifdef BOOST_iNTRUSIVE_DOXYGEN_INVOKED
|
||||
#else
|
||||
|
||||
using tree_type::clone_from;
|
||||
|
||||
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::clone_from(splaytree&&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(splay_multiset_impl) src, Cloner cloner, Disposer disposer)
|
||||
{ tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::insert_equal(reference)
|
||||
iterator insert(reference value)
|
||||
@@ -697,12 +728,12 @@ class splay_multiset_impl
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase(const_iterator,const_iterator)
|
||||
iterator erase(const_iterator b, const_iterator e);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase(const_reference)
|
||||
size_type erase(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase(const key_type&)
|
||||
size_type erase(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase_and_dispose(const_iterator,Disposer)
|
||||
template<class Disposer>
|
||||
@@ -712,13 +743,13 @@ class splay_multiset_impl
|
||||
template<class Disposer>
|
||||
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase_and_dispose(const_reference, Disposer)
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase_and_dispose(const key_type&, Disposer)
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer);
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
|
||||
//! @copydoc ::boost::intrusive::splaytree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::clear
|
||||
void clear();
|
||||
@@ -727,88 +758,88 @@ class splay_multiset_impl
|
||||
template<class Disposer>
|
||||
void clear_and_dispose(Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::count(const_reference)
|
||||
size_type count(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::splaytree::count(const key_type&)
|
||||
size_type count(const key_type&);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::splaytree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::lower_bound(const_reference)
|
||||
iterator lower_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::splaytree::lower_bound(const key_type&)
|
||||
iterator lower_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::lower_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::splaytree::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::lower_bound(const_reference)const
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::splaytree::lower_bound(const key_type&)const
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::splaytree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::upper_bound(const_reference)
|
||||
iterator upper_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::splaytree::upper_bound(const key_type&)
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::upper_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::splaytree::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::upper_bound(const_reference)const
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::splaytree::upper_bound(const key_type&)const
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::splaytree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::find(const_reference)
|
||||
iterator find(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::splaytree::find(const key_type&)
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::find(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::splaytree::find(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::find(const_reference)const
|
||||
const_iterator find(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::splaytree::find(const key_type&)const
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::find(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::splaytree::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::equal_range(const_reference)
|
||||
std::pair<iterator,iterator> equal_range(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::splaytree::equal_range(const key_type&)
|
||||
std::pair<iterator,iterator> equal_range(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::equal_range(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::splaytree::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::splaytree::equal_range(const key_type&)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const_reference value) const;
|
||||
equal_range(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::equal_range(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::splaytree::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const KeyType& key, KeyValueCompare comp) const;
|
||||
equal_range(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::splaytree::bounded_range(const key_type&, const key_type&,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::splaytree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::splaytree::bounded_range(const key_type&, const key_type&,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::splaytree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -837,12 +868,12 @@ class splay_multiset_impl
|
||||
//! @copydoc ::boost::intrusive::splaytree::splay_up(iterator)
|
||||
void splay_up(iterator i);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::splay_down(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator splay_down(const KeyType &key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::splaytree::splay_down(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator splay_down(const KeyType &key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::splay_down(const_reference)
|
||||
iterator splay_down(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::splaytree::splay_down(const key_type &key)
|
||||
iterator splay_down(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::splaytree::rebalance
|
||||
void rebalance();
|
||||
@@ -878,7 +909,7 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_splay_multiset
|
||||
{
|
||||
@@ -886,7 +917,7 @@ struct make_splay_multiset
|
||||
typedef typename pack_options
|
||||
< splaytree_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -897,6 +928,7 @@ struct make_splay_multiset
|
||||
|
||||
typedef splay_multiset_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::size_type
|
||||
, packed_options::constant_time_size
|
||||
@@ -909,14 +941,14 @@ struct make_splay_multiset
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class splay_multiset
|
||||
: public make_splay_multiset<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -924,7 +956,7 @@ class splay_multiset
|
||||
{
|
||||
typedef typename make_splay_multiset<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -933,7 +965,7 @@ class splay_multiset
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(splay_multiset)
|
||||
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
typedef typename Base::const_iterator const_iterator;
|
||||
@@ -941,14 +973,14 @@ class splay_multiset
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
explicit splay_multiset( const value_compare &cmp = value_compare()
|
||||
explicit splay_multiset( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, v_traits)
|
||||
{}
|
||||
|
||||
template<class Iterator>
|
||||
splay_multiset( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -960,6 +992,14 @@ class splay_multiset
|
||||
splay_multiset& operator=(BOOST_RV_REF(splay_multiset) x)
|
||||
{ return static_cast<splay_multiset &>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const splay_multiset &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(splay_multiset) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static splay_multiset &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<splay_multiset &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
|
||||
@@ -40,19 +40,14 @@ namespace intrusive {
|
||||
/// @cond
|
||||
|
||||
struct splaytree_defaults
|
||||
{
|
||||
typedef default_bstree_hook_applier proto_value_traits;
|
||||
static const bool constant_time_size = true;
|
||||
typedef std::size_t size_type;
|
||||
typedef void compare;
|
||||
typedef void header_holder_type;
|
||||
};
|
||||
: bstree_defaults
|
||||
{};
|
||||
|
||||
/// @endcond
|
||||
|
||||
//! The class template splaytree is an intrusive splay tree container that
|
||||
//! is used to construct intrusive splay_set and splay_multiset containers. The no-throw
|
||||
//! guarantee holds only, if the value_compare object
|
||||
//! guarantee holds only, if the key_compare object
|
||||
//! doesn't throw.
|
||||
//!
|
||||
//! The template parameter \c T is the type to be managed by the container.
|
||||
@@ -66,17 +61,17 @@ struct splaytree_defaults
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class VoidOrKeyComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
#endif
|
||||
class splaytree_impl
|
||||
/// @cond
|
||||
: public bstree_impl<ValueTraits, VoidOrKeyComp, SizeType, ConstantTimeSize, SplayTreeAlgorithms, HeaderHolder>
|
||||
: public bstree_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType, ConstantTimeSize, SplayTreeAlgorithms, HeaderHolder>
|
||||
/// @endcond
|
||||
{
|
||||
public:
|
||||
typedef ValueTraits value_traits;
|
||||
/// @cond
|
||||
typedef bstree_impl< ValueTraits, VoidOrKeyComp, SizeType
|
||||
typedef bstree_impl< ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType
|
||||
, ConstantTimeSize, SplayTreeAlgorithms
|
||||
, HeaderHolder> tree_type;
|
||||
typedef tree_type implementation_defined;
|
||||
@@ -86,6 +81,7 @@ class splaytree_impl
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::key_of_value key_of_value;
|
||||
typedef typename implementation_defined::reference reference;
|
||||
typedef typename implementation_defined::const_reference const_reference;
|
||||
typedef typename implementation_defined::difference_type difference_type;
|
||||
@@ -115,16 +111,16 @@ class splaytree_impl
|
||||
|
||||
typedef typename implementation_defined::insert_commit_data insert_commit_data;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(const value_compare &,const value_traits &)
|
||||
explicit splaytree_impl( const value_compare &cmp = value_compare()
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(const key_compare &,const value_traits &)
|
||||
explicit splaytree_impl( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(bool,Iterator,Iterator,const value_compare &,const value_traits &)
|
||||
//! @copydoc ::boost::intrusive::bstree::bstree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
|
||||
template<class Iterator>
|
||||
splaytree_impl( bool unique, Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits)
|
||||
{
|
||||
@@ -210,10 +206,24 @@ class splaytree_impl
|
||||
//! @copydoc ::boost::intrusive::bstree::swap
|
||||
void swap(splaytree_impl& other);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from(const bstree&,Cloner,Disposer)
|
||||
//! Additional notes: it also copies the alpha factor from the source container.
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const splaytree_impl &src, Cloner cloner, Disposer disposer);
|
||||
|
||||
#else //BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
using tree_type::clone_from;
|
||||
|
||||
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clone_from(bstree&&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(splaytree_impl) src, Cloner cloner, Disposer disposer)
|
||||
{ tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_equal(reference)
|
||||
iterator insert_equal(reference value);
|
||||
|
||||
@@ -230,16 +240,16 @@ class splaytree_impl
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique(const_iterator,reference)
|
||||
iterator insert_unique(const_iterator hint, reference value);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_unique_check
|
||||
(const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data);
|
||||
(const KeyType &key, KeyTypeKeyCompare comp, insert_commit_data &commit_data);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const_iterator,const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const_iterator,const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, bool> insert_unique_check
|
||||
(const_iterator hint, const KeyType &key
|
||||
,KeyValueCompare key_value_comp, insert_commit_data &commit_data);
|
||||
,KeyTypeKeyCompare comp, insert_commit_data &commit_data);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::insert_unique_commit
|
||||
iterator insert_unique_commit(reference value, const insert_commit_data &commit_data);
|
||||
@@ -263,12 +273,12 @@ class splaytree_impl
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const_iterator,const_iterator)
|
||||
iterator erase(const_iterator b, const_iterator e);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const_reference)
|
||||
size_type erase(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const key_type &)
|
||||
size_type erase(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::erase(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_iterator,Disposer)
|
||||
template<class Disposer>
|
||||
@@ -278,13 +288,13 @@ class splaytree_impl
|
||||
template<class Disposer>
|
||||
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_reference, Disposer)
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const key_type &, Disposer)
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer);
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
|
||||
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::clear
|
||||
void clear();
|
||||
@@ -293,120 +303,120 @@ class splaytree_impl
|
||||
template<class Disposer>
|
||||
void clear_and_dispose(Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const key_type &)const
|
||||
//! Additional note: non-const function, splaying is performed.
|
||||
size_type count(const_reference value);
|
||||
size_type count(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyValueCompare)const
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
//! Additional note: non-const function, splaying is performed.
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType &key, KeyValueCompare comp);
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType &key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const key_type &)const
|
||||
//! Additional note: const function, no splaying is performed
|
||||
size_type count(const_reference value) const;
|
||||
size_type count(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyValueCompare)const
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
//! Additional note: const function, no splaying is performed
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType &key, KeyValueCompare comp) const;
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType &key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)
|
||||
//! Additional note: non-const function, splaying is performed.
|
||||
iterator lower_bound(const_reference value);
|
||||
iterator lower_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)const
|
||||
//! Additional note: const function, no splaying is performed
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare)
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
//! Additional note: non-const function, splaying is performed for the first
|
||||
//! element of the equal range of "key"
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType &key, KeyValueCompare comp);
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType &key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
//! Additional note: const function, no splaying is performed
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType &key, KeyValueCompare comp) const;
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType &key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const_reference)
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)
|
||||
//! Additional note: non-const function, splaying is performed for the first
|
||||
//! element of the equal range of "value"
|
||||
iterator upper_bound(const_reference value);
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)const
|
||||
//! Additional note: const function, no splaying is performed
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyValueCompare)
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
//! Additional note: non-const function, splaying is performed for the first
|
||||
//! element of the equal range of "key"
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType &key, KeyValueCompare comp);
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType &key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
//! Additional note: const function, no splaying is performed
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType &key, KeyValueCompare comp) const;
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType &key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const_reference)
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const key_type &)
|
||||
//! Additional note: non-const function, splaying is performed for the first
|
||||
//! element of the equal range of "value"
|
||||
iterator find(const_reference value);
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const key_type &)const
|
||||
//! Additional note: const function, no splaying is performed
|
||||
const_iterator find(const_reference value) const;
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyValueCompare)
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)
|
||||
//! Additional note: non-const function, splaying is performed for the first
|
||||
//! element of the equal range of "key"
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType &key, KeyValueCompare comp);
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType &key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyValueCompare)const
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
//! Additional note: const function, no splaying is performed
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType &key, KeyValueCompare comp) const;
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType &key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const_reference)
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)
|
||||
//! Additional note: non-const function, splaying is performed for the first
|
||||
//! element of the equal range of "value"
|
||||
std::pair<iterator, iterator> equal_range(const_reference value);
|
||||
std::pair<iterator, iterator> equal_range(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)const
|
||||
//! Additional note: const function, no splaying is performed
|
||||
std::pair<const_iterator, const_iterator> equal_range(const_reference value) const;
|
||||
std::pair<const_iterator, const_iterator> equal_range(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyValueCompare)
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
//! Additional note: non-const function, splaying is performed for the first
|
||||
//! element of the equal range of "key"
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator, iterator> equal_range(const KeyType &key, KeyValueCompare comp);
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator, iterator> equal_range(const KeyType &key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyValueCompare)const
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
//! Additional note: const function, no splaying is performed
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<const_iterator, const_iterator> equal_range(const KeyType &key, KeyValueCompare comp) const;
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator> equal_range(const KeyType &key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type &,const key_type &,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type &,const key_type &,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -455,8 +465,8 @@ class splaytree_impl
|
||||
//! <b>Returns</b>: An iterator to the new root of the tree, end() if the tree is empty.
|
||||
//!
|
||||
//! <b>Throws</b>: If the comparison functor throws.
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator splay_down(const KeyType &key, KeyValueCompare comp)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator splay_down(const KeyType &key, KeyTypeKeyCompare comp)
|
||||
{
|
||||
detail::key_nodeptr_comp<value_compare, value_traits>
|
||||
key_node_comp(comp, &this->get_value_traits());
|
||||
@@ -473,8 +483,8 @@ class splaytree_impl
|
||||
//! <b>Returns</b>: An iterator to the new root of the tree, end() if the tree is empty.
|
||||
//!
|
||||
//! <b>Throws</b>: If the predicate throws.
|
||||
iterator splay_down(const_reference value)
|
||||
{ return this->splay_down(value, this->value_comp()); }
|
||||
iterator splay_down(const key_type &key)
|
||||
{ return this->splay_down(key, this->key_comp()); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
//! @copydoc ::boost::intrusive::bstree::rebalance
|
||||
@@ -507,7 +517,7 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_splaytree
|
||||
{
|
||||
@@ -515,7 +525,7 @@ struct make_splaytree
|
||||
typedef typename pack_options
|
||||
< splaytree_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -526,6 +536,7 @@ struct make_splaytree
|
||||
|
||||
typedef splaytree_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::size_type
|
||||
, packed_options::constant_time_size
|
||||
@@ -539,14 +550,14 @@ struct make_splaytree
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class splaytree
|
||||
: public make_splaytree<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -555,7 +566,7 @@ class splaytree
|
||||
typedef typename make_splaytree
|
||||
<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -563,7 +574,7 @@ class splaytree
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(splaytree)
|
||||
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
typedef typename Base::const_iterator const_iterator;
|
||||
@@ -573,14 +584,14 @@ class splaytree
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
explicit splaytree( const value_compare &cmp = value_compare()
|
||||
explicit splaytree( const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, v_traits)
|
||||
{}
|
||||
|
||||
template<class Iterator>
|
||||
splaytree( bool unique, Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(unique, b, e, cmp, v_traits)
|
||||
{}
|
||||
@@ -592,6 +603,14 @@ class splaytree
|
||||
splaytree& operator=(BOOST_RV_REF(splaytree) x)
|
||||
{ return static_cast<splaytree &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const splaytree &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(splaytree) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static splaytree &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<splaytree &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
|
||||
+185
-164
@@ -47,20 +47,16 @@ namespace intrusive {
|
||||
/// @cond
|
||||
|
||||
struct treap_defaults
|
||||
: bstree_defaults
|
||||
{
|
||||
typedef default_bstree_hook_applier proto_value_traits;
|
||||
static const bool constant_time_size = true;
|
||||
typedef std::size_t size_type;
|
||||
typedef void compare;
|
||||
typedef void priority;
|
||||
typedef void header_holder_type;
|
||||
};
|
||||
|
||||
/// @endcond
|
||||
|
||||
//! The class template treap is an intrusive treap container that
|
||||
//! is used to construct intrusive set and multiset containers. The no-throw
|
||||
//! guarantee holds only, if the value_compare object and priority_compare object
|
||||
//! guarantee holds only, if the key_compare object and priority_compare object
|
||||
//! don't throw.
|
||||
//!
|
||||
//! The template parameter \c T is the type to be managed by the container.
|
||||
@@ -74,24 +70,24 @@ struct treap_defaults
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class VoidOrKeyComp, class VoidOrPrioComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class VoidOrPrioComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
#endif
|
||||
class treap_impl
|
||||
/// @cond
|
||||
: public bstree_impl<ValueTraits, VoidOrKeyComp, SizeType, ConstantTimeSize, BsTreeAlgorithms, HeaderHolder>
|
||||
: public bstree_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType, ConstantTimeSize, BsTreeAlgorithms, HeaderHolder>
|
||||
//Use public inheritance to avoid MSVC bugs with closures
|
||||
, public detail::ebo_functor_holder
|
||||
< typename get_prio
|
||||
< VoidOrPrioComp
|
||||
, typename bstree_impl
|
||||
<ValueTraits, VoidOrKeyComp, SizeType, ConstantTimeSize, BsTreeAlgorithms, HeaderHolder>::value_type>::type
|
||||
<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType, ConstantTimeSize, BsTreeAlgorithms, HeaderHolder>::value_type>::type
|
||||
>
|
||||
/// @endcond
|
||||
{
|
||||
public:
|
||||
typedef ValueTraits value_traits;
|
||||
/// @cond
|
||||
typedef bstree_impl< ValueTraits, VoidOrKeyComp, SizeType
|
||||
typedef bstree_impl< ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType
|
||||
, ConstantTimeSize, BsTreeAlgorithms
|
||||
, HeaderHolder> tree_type;
|
||||
typedef tree_type implementation_defined;
|
||||
@@ -108,6 +104,7 @@ class treap_impl
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::key_of_value key_of_value;
|
||||
typedef typename implementation_defined::reference reference;
|
||||
typedef typename implementation_defined::const_reference const_reference;
|
||||
typedef typename implementation_defined::difference_type difference_type;
|
||||
@@ -129,6 +126,15 @@ class treap_impl
|
||||
static const bool stateful_value_traits = implementation_defined::stateful_value_traits;
|
||||
static const bool safemode_or_autounlink = is_safe_autounlink<value_traits::link_mode>::value;
|
||||
|
||||
typedef detail::key_nodeptr_comp<priority_compare, value_traits> value_node_prio_comp_t;
|
||||
|
||||
template<class KeyPrioComp>
|
||||
detail::key_nodeptr_comp<KeyPrioComp, value_traits> key_node_prio_comp(KeyPrioComp keypriocomp) const
|
||||
{ return detail::key_nodeptr_comp<KeyPrioComp, value_traits>(keypriocomp, &this->get_value_traits()); }
|
||||
|
||||
value_node_prio_comp_t value_node_prio_comp() const
|
||||
{ return this->key_node_prio_comp(this->priv_pcomp()); }
|
||||
|
||||
/// @cond
|
||||
private:
|
||||
|
||||
@@ -153,7 +159,7 @@ class treap_impl
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor of the value_compare/priority_compare objects throw. Basic guarantee.
|
||||
explicit treap_impl( const value_compare &cmp = value_compare()
|
||||
explicit treap_impl( const key_compare &cmp = key_compare()
|
||||
, const priority_compare &pcmp = priority_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits), prio_base(pcmp)
|
||||
@@ -170,11 +176,11 @@ class treap_impl
|
||||
//!
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor/operator() of the value_compare/priority_compare objects
|
||||
//! or the copy constructor/operator() of the key_compare/priority_compare objects
|
||||
//! throw. Basic guarantee.
|
||||
template<class Iterator>
|
||||
treap_impl( bool unique, Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const priority_compare &pcmp = priority_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, v_traits), prio_base(pcmp)
|
||||
@@ -356,6 +362,27 @@ class treap_impl
|
||||
this->priv_pcomp() = src.priv_pcomp();
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
|
||||
//! Cloner should yield to nodes equivalent to the original nodes.
|
||||
//!
|
||||
//! <b>Effects</b>: Erases all the elements from *this
|
||||
//! calling Disposer::operator()(pointer), clones all the
|
||||
//! elements from src calling Cloner::operator()(reference)
|
||||
//! and inserts them on *this. Copies the predicate from the source container.
|
||||
//!
|
||||
//! If cloner throws, all cloned elements are unlinked and disposed
|
||||
//! calling Disposer::operator()(pointer).
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to erased plus inserted elements.
|
||||
//!
|
||||
//! <b>Throws</b>: If cloner throws or predicate copy assignment throws. Basic guarantee.
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(treap_impl) src, Cloner cloner, Disposer disposer)
|
||||
{
|
||||
tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer);
|
||||
this->priv_pcomp() = ::boost::move(src.priv_pcomp());
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: value must be an lvalue
|
||||
//!
|
||||
//! <b>Effects</b>: Inserts value into the container before the upper bound.
|
||||
@@ -363,21 +390,21 @@ class treap_impl
|
||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
||||
//! most logarithmic.
|
||||
//!
|
||||
//! <b>Throws</b>: If the internal value_compare or priority_compare functions throw. Strong guarantee.
|
||||
//! <b>Throws</b>: If the internal key_compare or priority_compare functions throw. Strong guarantee.
|
||||
//!
|
||||
//! <b>Note</b>: Does not affect the validity of iterators and references.
|
||||
//! No copy-constructors are called.
|
||||
iterator insert_equal(reference value)
|
||||
{
|
||||
detail::key_nodeptr_comp<value_compare, value_traits>
|
||||
key_node_comp(this->value_comp(), &this->get_value_traits());
|
||||
detail::key_nodeptr_comp<priority_compare, value_traits>
|
||||
key_node_pcomp(this->priv_pcomp(), &this->get_value_traits());
|
||||
node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
|
||||
iterator ret(node_algorithms::insert_equal_upper_bound
|
||||
(this->tree_type::header_ptr(), to_insert, key_node_comp, key_node_pcomp), this->priv_value_traits_ptr());
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
|
||||
iterator ret
|
||||
( node_algorithms::insert_equal_upper_bound
|
||||
( this->tree_type::header_ptr()
|
||||
, to_insert
|
||||
, this->key_node_comp(this->key_comp())
|
||||
, this->value_node_prio_comp())
|
||||
, this->priv_value_traits_ptr());
|
||||
this->tree_type::sz_traits().increment();
|
||||
return ret;
|
||||
}
|
||||
@@ -392,21 +419,22 @@ class treap_impl
|
||||
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
|
||||
//! constant time if t is inserted immediately before hint.
|
||||
//!
|
||||
//! <b>Throws</b>: If the internal value_compare or priority_compare functions throw. Strong guarantee.
|
||||
//! <b>Throws</b>: If the internal key_compare or priority_compare functions throw. Strong guarantee.
|
||||
//!
|
||||
//! <b>Note</b>: Does not affect the validity of iterators and references.
|
||||
//! No copy-constructors are called.
|
||||
iterator insert_equal(const_iterator hint, reference value)
|
||||
{
|
||||
detail::key_nodeptr_comp<value_compare, value_traits>
|
||||
key_node_comp(this->value_comp(), &this->get_value_traits());
|
||||
detail::key_nodeptr_comp<priority_compare, value_traits>
|
||||
key_node_pcomp(this->priv_pcomp(), &this->get_value_traits());
|
||||
node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
|
||||
iterator ret (node_algorithms::insert_equal
|
||||
(this->tree_type::header_ptr(), hint.pointed_node(), to_insert, key_node_comp, key_node_pcomp), this->priv_value_traits_ptr());
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
|
||||
iterator ret
|
||||
(node_algorithms::insert_equal
|
||||
( this->tree_type::header_ptr()
|
||||
, hint.pointed_node()
|
||||
, to_insert
|
||||
, this->key_node_comp(this->key_comp())
|
||||
, this->value_node_prio_comp())
|
||||
, this->priv_value_traits_ptr());
|
||||
this->tree_type::sz_traits().increment();
|
||||
return ret;
|
||||
}
|
||||
@@ -419,9 +447,9 @@ class treap_impl
|
||||
//!
|
||||
//! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
|
||||
//! size of the range. However, it is linear in N if the range is already sorted
|
||||
//! by value_comp().
|
||||
//! by key_comp().
|
||||
//!
|
||||
//! <b>Throws</b>: If the internal value_compare or priority_compare functions throw.
|
||||
//! <b>Throws</b>: If the internal key_compare or priority_compare functions throw.
|
||||
//! Strong guarantee.
|
||||
//!
|
||||
//! <b>Note</b>: Does not affect the validity of iterators and references.
|
||||
@@ -442,7 +470,7 @@ class treap_impl
|
||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
||||
//! most logarithmic.
|
||||
//!
|
||||
//! <b>Throws</b>: If the internal value_compare or priority_compare functions throw.
|
||||
//! <b>Throws</b>: If the internal key_compare or priority_compare functions throw.
|
||||
//! Strong guarantee.
|
||||
//!
|
||||
//! <b>Note</b>: Does not affect the validity of iterators and references.
|
||||
@@ -450,10 +478,11 @@ class treap_impl
|
||||
std::pair<iterator, bool> insert_unique(reference value)
|
||||
{
|
||||
insert_commit_data commit_data;
|
||||
std::pair<iterator, bool> ret = insert_unique_check(value, this->value_comp(), this->priv_pcomp(), commit_data);
|
||||
std::pair<iterator, bool> ret = this->insert_unique_check
|
||||
(value, this->comp(), this->priv_pcomp(), commit_data);
|
||||
if(!ret.second)
|
||||
return ret;
|
||||
return std::pair<iterator, bool> (insert_unique_commit(value, commit_data), true);
|
||||
return std::pair<iterator, bool> (this->insert_unique_commit(value, commit_data), true);
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: value must be an lvalue, and "hint" must be
|
||||
@@ -466,7 +495,7 @@ class treap_impl
|
||||
//! constant time (two comparisons in the worst case)
|
||||
//! if t is inserted immediately before hint.
|
||||
//!
|
||||
//! <b>Throws</b>: If the internal value_compare or priority_compare functions throw.
|
||||
//! <b>Throws</b>: If the internal key_compare or priority_compare functions throw.
|
||||
//! Strong guarantee.
|
||||
//!
|
||||
//! <b>Note</b>: Does not affect the validity of iterators and references.
|
||||
@@ -474,10 +503,11 @@ class treap_impl
|
||||
iterator insert_unique(const_iterator hint, reference value)
|
||||
{
|
||||
insert_commit_data commit_data;
|
||||
std::pair<iterator, bool> ret = insert_unique_check(hint, value, this->value_comp(), this->priv_pcomp(), commit_data);
|
||||
std::pair<iterator, bool> ret = this->insert_unique_check
|
||||
(hint, value, this->comp(), this->priv_pcomp(), commit_data);
|
||||
if(!ret.second)
|
||||
return ret.first;
|
||||
return insert_unique_commit(value, commit_data);
|
||||
return this->insert_unique_commit(value, commit_data);
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: Dereferencing iterator must yield an lvalue
|
||||
@@ -487,9 +517,9 @@ class treap_impl
|
||||
//!
|
||||
//! <b>Complexity</b>: Insert range is in general O(N * log(N)), where N is the
|
||||
//! size of the range. However, it is linear in N if the range is already sorted
|
||||
//! by value_comp().
|
||||
//! by key_comp().
|
||||
//!
|
||||
//! <b>Throws</b>: If the internal value_compare or priority_compare functions throw.
|
||||
//! <b>Throws</b>: If the internal key_compare or priority_compare functions throw.
|
||||
//! Strong guarantee.
|
||||
//!
|
||||
//! <b>Note</b>: Does not affect the validity of iterators and references.
|
||||
@@ -508,11 +538,11 @@ class treap_impl
|
||||
}
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: key_value_comp must be a comparison function that induces
|
||||
//! the same strict weak ordering as value_compare.
|
||||
//! <b>Requires</b>: comp must be a comparison function that induces
|
||||
//! the same strict weak ordering as key_compare.
|
||||
//! key_value_pcomp must be a comparison function that induces
|
||||
//! the same strict weak ordering as priority_compare. The difference is that
|
||||
//! key_value_pcomp and key_value_comp compare an arbitrary key with the contained values.
|
||||
//! key_value_pcomp and comp compare an arbitrary key with the contained values.
|
||||
//!
|
||||
//! <b>Effects</b>: Checks if a value can be inserted in the container, using
|
||||
//! a user provided key instead of the value itself.
|
||||
@@ -525,7 +555,7 @@ class treap_impl
|
||||
//!
|
||||
//! <b>Complexity</b>: Average complexity is at most logarithmic.
|
||||
//!
|
||||
//! <b>Throws</b>: If the key_value_comp or key_value_pcomp
|
||||
//! <b>Throws</b>: If the comp or key_value_pcomp
|
||||
//! ordering functions throw. Strong guarantee.
|
||||
//!
|
||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
||||
@@ -541,26 +571,23 @@ class treap_impl
|
||||
//!
|
||||
//! "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>
|
||||
template<class KeyType, class KeyTypeKeyCompare, class KeyValuePrioCompare>
|
||||
std::pair<iterator, bool> insert_unique_check
|
||||
( const KeyType &key, KeyValueCompare key_value_comp
|
||||
( const KeyType &key, KeyTypeKeyCompare comp
|
||||
, KeyValuePrioCompare key_value_pcomp, insert_commit_data &commit_data)
|
||||
{
|
||||
detail::key_nodeptr_comp<KeyValueCompare, value_traits>
|
||||
ocomp(key_value_comp, &this->get_value_traits());
|
||||
detail::key_nodeptr_comp<KeyValuePrioCompare, value_traits>
|
||||
pcomp(key_value_pcomp, &this->get_value_traits());
|
||||
std::pair<node_ptr, bool> ret =
|
||||
std::pair<node_ptr, bool> const ret =
|
||||
(node_algorithms::insert_unique_check
|
||||
(this->tree_type::header_ptr(), key, ocomp, pcomp, commit_data));
|
||||
( this->tree_type::header_ptr(), key
|
||||
, this->key_node_comp(comp), this->key_node_prio_comp(key_value_pcomp), commit_data));
|
||||
return std::pair<iterator, bool>(iterator(ret.first, this->priv_value_traits_ptr()), ret.second);
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: key_value_comp must be a comparison function that induces
|
||||
//! the same strict weak ordering as value_compare.
|
||||
//! <b>Requires</b>: comp must be a comparison function that induces
|
||||
//! the same strict weak ordering as key_compare.
|
||||
//! key_value_pcomp must be a comparison function that induces
|
||||
//! the same strict weak ordering as priority_compare. The difference is that
|
||||
//! key_value_pcomp and key_value_comp compare an arbitrary key with the contained values.
|
||||
//! key_value_pcomp and comp compare an arbitrary key with the contained values.
|
||||
//!
|
||||
//! <b>Effects</b>: Checks if a value can be inserted in the container, using
|
||||
//! a user provided key instead of the value itself, using "hint"
|
||||
@@ -575,7 +602,7 @@ class treap_impl
|
||||
//! <b>Complexity</b>: Logarithmic in general, but it's amortized
|
||||
//! constant time if t is inserted immediately before hint.
|
||||
//!
|
||||
//! <b>Throws</b>: If the key_value_comp or key_value_pcomp
|
||||
//! <b>Throws</b>: If the comp or key_value_pcomp
|
||||
//! ordering functions throw. Strong guarantee.
|
||||
//!
|
||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
||||
@@ -591,20 +618,17 @@ class treap_impl
|
||||
//!
|
||||
//! "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>
|
||||
template<class KeyType, class KeyTypeKeyCompare, class KeyValuePrioCompare>
|
||||
std::pair<iterator, bool> insert_unique_check
|
||||
( const_iterator hint, const KeyType &key
|
||||
, KeyValueCompare key_value_comp
|
||||
, KeyTypeKeyCompare comp
|
||||
, KeyValuePrioCompare key_value_pcomp
|
||||
, insert_commit_data &commit_data)
|
||||
{
|
||||
detail::key_nodeptr_comp<KeyValueCompare, value_traits>
|
||||
ocomp(key_value_comp, &this->get_value_traits());
|
||||
detail::key_nodeptr_comp<KeyValuePrioCompare, value_traits>
|
||||
pcomp(key_value_pcomp, &this->get_value_traits());
|
||||
std::pair<node_ptr, bool> ret =
|
||||
std::pair<node_ptr, bool> const ret =
|
||||
(node_algorithms::insert_unique_check
|
||||
(this->tree_type::header_ptr(), hint.pointed_node(), key, ocomp, pcomp, commit_data));
|
||||
( this->tree_type::header_ptr(), hint.pointed_node(), key
|
||||
, this->key_node_comp(comp), this->key_node_prio_comp(key_value_pcomp), commit_data));
|
||||
return std::pair<iterator, bool>(iterator(ret.first, this->priv_value_traits_ptr()), ret.second);
|
||||
}
|
||||
|
||||
@@ -628,8 +652,7 @@ class treap_impl
|
||||
iterator insert_unique_commit(reference value, const insert_commit_data &commit_data)
|
||||
{
|
||||
node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
|
||||
node_algorithms::insert_unique_commit(this->tree_type::header_ptr(), to_insert, commit_data);
|
||||
this->tree_type::sz_traits().increment();
|
||||
return iterator(to_insert, this->priv_value_traits_ptr());
|
||||
@@ -652,12 +675,11 @@ class treap_impl
|
||||
iterator insert_before(const_iterator pos, reference value)
|
||||
{
|
||||
node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
|
||||
detail::key_nodeptr_comp<priority_compare, value_traits>
|
||||
pcomp(this->priv_pcomp(), &this->get_value_traits());
|
||||
iterator ret (node_algorithms::insert_before
|
||||
(this->tree_type::header_ptr(), pos.pointed_node(), to_insert, pcomp), this->priv_value_traits_ptr());
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
|
||||
iterator ret
|
||||
( node_algorithms::insert_before
|
||||
( this->tree_type::header_ptr(), pos.pointed_node(), to_insert, this->value_node_prio_comp())
|
||||
, this->priv_value_traits_ptr());
|
||||
this->tree_type::sz_traits().increment();
|
||||
return ret;
|
||||
}
|
||||
@@ -679,11 +701,8 @@ class treap_impl
|
||||
void push_back(reference value)
|
||||
{
|
||||
node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
|
||||
detail::key_nodeptr_comp<priority_compare, value_traits>
|
||||
pcomp(this->priv_pcomp(), &this->get_value_traits());
|
||||
node_algorithms::push_back(this->tree_type::header_ptr(), to_insert, pcomp);
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
|
||||
node_algorithms::push_back(this->tree_type::header_ptr(), to_insert, this->value_node_prio_comp());
|
||||
this->tree_type::sz_traits().increment();
|
||||
}
|
||||
|
||||
@@ -704,11 +723,8 @@ class treap_impl
|
||||
void push_front(reference value)
|
||||
{
|
||||
node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
|
||||
detail::key_nodeptr_comp<priority_compare, value_traits>
|
||||
pcomp(this->priv_pcomp(), &this->get_value_traits());
|
||||
node_algorithms::push_front(this->tree_type::header_ptr(), to_insert, pcomp);
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
|
||||
node_algorithms::push_front(this->tree_type::header_ptr(), to_insert, this->value_node_prio_comp());
|
||||
this->tree_type::sz_traits().increment();
|
||||
}
|
||||
|
||||
@@ -725,11 +741,8 @@ class treap_impl
|
||||
const_iterator ret(i);
|
||||
++ret;
|
||||
node_ptr to_erase(i.pointed_node());
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!node_algorithms::unique(to_erase));
|
||||
detail::key_nodeptr_comp<priority_compare, value_traits>
|
||||
key_node_pcomp(this->priv_pcomp(), &this->get_value_traits());
|
||||
node_algorithms::erase(this->tree_type::header_ptr(), to_erase, key_node_pcomp);
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || !node_algorithms::unique(to_erase));
|
||||
node_algorithms::erase(this->tree_type::header_ptr(), to_erase, this->value_node_prio_comp());
|
||||
this->tree_type::sz_traits().decrement();
|
||||
if(safemode_or_autounlink)
|
||||
node_algorithms::init(to_erase);
|
||||
@@ -758,8 +771,8 @@ class treap_impl
|
||||
//!
|
||||
//! <b>Note</b>: Invalidates the iterators (but not the references)
|
||||
//! to the erased elements. No destructors are called.
|
||||
size_type erase(const_reference value)
|
||||
{ return this->erase(value, this->value_comp()); }
|
||||
size_type erase(const key_type &key)
|
||||
{ return this->erase(key, this->key_comp()); }
|
||||
|
||||
//! <b>Effects</b>: Erases all the elements with the given key.
|
||||
//! according to the comparison functor "comp".
|
||||
@@ -773,10 +786,10 @@ class treap_impl
|
||||
//!
|
||||
//! <b>Note</b>: Invalidates the iterators (but not the references)
|
||||
//! to the erased elements. No destructors are called.
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
BOOST_INTRUSIVE_DOC1ST(size_type
|
||||
, typename detail::disable_if_convertible<KeyValueCompare BOOST_INTRUSIVE_I const_iterator BOOST_INTRUSIVE_I size_type>::type)
|
||||
erase(const KeyType& key, KeyValueCompare comp)
|
||||
, typename detail::disable_if_convertible<KeyTypeKeyCompare BOOST_INTRUSIVE_I const_iterator BOOST_INTRUSIVE_I size_type>::type)
|
||||
erase(const KeyType& key, KeyTypeKeyCompare comp)
|
||||
{
|
||||
std::pair<iterator,iterator> p = this->equal_range(key, comp);
|
||||
size_type n;
|
||||
@@ -841,9 +854,9 @@ class treap_impl
|
||||
//! <b>Note</b>: Invalidates the iterators (but not the references)
|
||||
//! to the erased elements. No destructors are called.
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer)
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer)
|
||||
{
|
||||
std::pair<iterator,iterator> p = this->equal_range(value);
|
||||
std::pair<iterator,iterator> p = this->equal_range(key);
|
||||
size_type n;
|
||||
private_erase(p.first, p.second, n, disposer);
|
||||
return n;
|
||||
@@ -864,10 +877,10 @@ class treap_impl
|
||||
//!
|
||||
//! <b>Note</b>: Invalidates the iterators
|
||||
//! to the erased elements.
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
BOOST_INTRUSIVE_DOC1ST(size_type
|
||||
, typename detail::disable_if_convertible<KeyValueCompare BOOST_INTRUSIVE_I const_iterator BOOST_INTRUSIVE_I size_type>::type)
|
||||
erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer)
|
||||
, typename detail::disable_if_convertible<KeyTypeKeyCompare BOOST_INTRUSIVE_I const_iterator BOOST_INTRUSIVE_I size_type>::type)
|
||||
erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer)
|
||||
{
|
||||
std::pair<iterator,iterator> p = this->equal_range(key, comp);
|
||||
size_type n;
|
||||
@@ -909,9 +922,8 @@ class treap_impl
|
||||
template <class ExtraChecker>
|
||||
void check(ExtraChecker extra_checker) const
|
||||
{
|
||||
typedef detail::key_nodeptr_comp<priority_compare, value_traits> nodeptr_prio_comp_t;
|
||||
nodeptr_prio_comp_t nodeptr_prio_comp(priv_pcomp(), &this->get_value_traits());
|
||||
tree_type::check(detail::treap_node_extra_checker<ValueTraits, nodeptr_prio_comp_t, ExtraChecker>(nodeptr_prio_comp, extra_checker));
|
||||
tree_type::check(detail::treap_node_extra_checker
|
||||
<ValueTraits, value_node_prio_comp_t, ExtraChecker>(this->value_node_prio_comp(), extra_checker));
|
||||
}
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::check()const
|
||||
@@ -919,88 +931,88 @@ class treap_impl
|
||||
{ check(detail::empty_node_checker<ValueTraits>()); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const_reference)const
|
||||
size_type count(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const key_type &)const
|
||||
size_type count(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)
|
||||
iterator lower_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)
|
||||
iterator lower_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)const
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)const
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const_reference)
|
||||
iterator upper_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const_reference)const
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)const
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const_reference)
|
||||
iterator find(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const key_type &)
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const_reference)const
|
||||
const_iterator find(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const key_type &)const
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const_reference)
|
||||
std::pair<iterator,iterator> equal_range(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)
|
||||
std::pair<iterator,iterator> equal_range(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const_reference value) const;
|
||||
equal_range(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const KeyType& key, KeyValueCompare comp) const;
|
||||
equal_range(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type &,const key_type &,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type &,const key_type &,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
bounded_range(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::bstree::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -1069,14 +1081,14 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_treap
|
||||
{
|
||||
typedef typename pack_options
|
||||
< treap_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -1087,6 +1099,7 @@ struct make_treap
|
||||
|
||||
typedef treap_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::priority
|
||||
, typename packed_options::size_type
|
||||
@@ -1100,14 +1113,14 @@ struct make_treap
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class treap
|
||||
: public make_treap<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -1116,7 +1129,7 @@ class treap
|
||||
typedef typename make_treap
|
||||
<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -1124,7 +1137,7 @@ class treap
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(treap)
|
||||
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::priority_compare priority_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
@@ -1135,7 +1148,7 @@ class treap
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
explicit treap( const value_compare &cmp = value_compare()
|
||||
explicit treap( const key_compare &cmp = key_compare()
|
||||
, const priority_compare &pcmp = priority_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, pcmp, v_traits)
|
||||
@@ -1143,7 +1156,7 @@ class treap
|
||||
|
||||
template<class Iterator>
|
||||
treap( bool unique, Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const priority_compare &pcmp = priority_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(unique, b, e, cmp, pcmp, v_traits)
|
||||
@@ -1156,6 +1169,14 @@ class treap
|
||||
treap& operator=(BOOST_RV_REF(treap) x)
|
||||
{ return static_cast<treap&>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const treap &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(treap) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static treap &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<treap &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
|
||||
@@ -40,16 +40,16 @@ namespace intrusive {
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class VoidOrKeyComp, class VoidOrPrioComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class VoidOrPrioComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
#endif
|
||||
class treap_set_impl
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
: public treap_impl<ValueTraits, VoidOrKeyComp, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder>
|
||||
: public treap_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder>
|
||||
#endif
|
||||
{
|
||||
/// @cond
|
||||
public:
|
||||
typedef treap_impl<ValueTraits, VoidOrKeyComp, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> tree_type;
|
||||
typedef treap_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> tree_type;
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_set_impl)
|
||||
|
||||
typedef tree_type implementation_defined;
|
||||
@@ -58,6 +58,8 @@ class treap_set_impl
|
||||
public:
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::value_traits value_traits;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::key_of_value key_of_value;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
typedef typename implementation_defined::reference reference;
|
||||
@@ -65,8 +67,8 @@ class treap_set_impl
|
||||
typedef typename implementation_defined::difference_type difference_type;
|
||||
typedef typename implementation_defined::size_type size_type;
|
||||
typedef typename implementation_defined::value_compare value_compare;
|
||||
typedef typename implementation_defined::priority_compare priority_compare;
|
||||
typedef typename implementation_defined::key_compare key_compare;
|
||||
typedef typename implementation_defined::priority_compare priority_compare;
|
||||
typedef typename implementation_defined::iterator iterator;
|
||||
typedef typename implementation_defined::const_iterator const_iterator;
|
||||
typedef typename implementation_defined::reverse_iterator reverse_iterator;
|
||||
@@ -87,8 +89,8 @@ class treap_set_impl
|
||||
//!
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor of the value_compare object throws.
|
||||
explicit treap_set_impl( const value_compare &cmp = value_compare()
|
||||
//! or the copy constructor of the key_compare object throws.
|
||||
explicit treap_set_impl( const key_compare &cmp = key_compare()
|
||||
, const priority_compare &pcmp = priority_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, pcmp, v_traits)
|
||||
@@ -105,10 +107,10 @@ class treap_set_impl
|
||||
//!
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor/operator() of the value_compare object throws.
|
||||
//! or the copy constructor/operator() of the key_compare object throws.
|
||||
template<class Iterator>
|
||||
treap_set_impl( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const priority_compare &pcmp = priority_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(true, b, e, cmp, pcmp, v_traits)
|
||||
@@ -192,10 +194,23 @@ class treap_set_impl
|
||||
//! @copydoc ::boost::intrusive::treap::swap
|
||||
void swap(treap_set_impl& other);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::clone_from
|
||||
//! @copydoc ::boost::intrusive::treap::clone_from(const treap&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const treap_set_impl &src, Cloner cloner, Disposer disposer);
|
||||
|
||||
#else
|
||||
|
||||
using tree_type::clone_from;
|
||||
|
||||
#endif
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::clone_from(treap&&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(treap_set_impl) src, Cloner cloner, Disposer disposer)
|
||||
{ tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
|
||||
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::top()
|
||||
iterator top();
|
||||
|
||||
@@ -226,20 +241,20 @@ class treap_set_impl
|
||||
iterator insert(const_iterator hint, reference value)
|
||||
{ return tree_type::insert_unique(hint, value); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::insert_unique_check(const KeyType&,KeyValueCompare,KeyValuePrioCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare, class KeyValuePrioCompare>
|
||||
//! @copydoc ::boost::intrusive::treap::insert_unique_check(const KeyType&,KeyTypeKeyCompare,KeyValuePrioCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class KeyValuePrioCompare>
|
||||
std::pair<iterator, bool> insert_check
|
||||
( const KeyType &key, KeyValueCompare key_value_comp, KeyValuePrioCompare key_value_pcomp
|
||||
( const KeyType &key, KeyTypeKeyCompare comp, KeyValuePrioCompare key_value_pcomp
|
||||
, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(key, key_value_comp, key_value_pcomp, commit_data); }
|
||||
{ return tree_type::insert_unique_check(key, comp, key_value_pcomp, commit_data); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::insert_unique_check(const_iterator,const KeyType&,KeyValueCompare,KeyValuePrioCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyValueCompare, class KeyValuePrioCompare>
|
||||
//! @copydoc ::boost::intrusive::treap::insert_unique_check(const_iterator,const KeyType&,KeyTypeKeyCompare,KeyValuePrioCompare,insert_commit_data&)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class KeyValuePrioCompare>
|
||||
std::pair<iterator, bool> insert_check
|
||||
( const_iterator hint, const KeyType &key
|
||||
, KeyValueCompare key_value_comp, KeyValuePrioCompare key_value_pcomp
|
||||
, KeyTypeKeyCompare comp, KeyValuePrioCompare key_value_pcomp
|
||||
, insert_commit_data &commit_data)
|
||||
{ return tree_type::insert_unique_check(hint, key, key_value_comp, key_value_pcomp, commit_data); }
|
||||
{ return tree_type::insert_unique_check(hint, key, comp, key_value_pcomp, commit_data); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::insert_unique(Iterator,Iterator)
|
||||
template<class Iterator>
|
||||
@@ -266,12 +281,12 @@ class treap_set_impl
|
||||
//! @copydoc ::boost::intrusive::treap::erase(const_iterator,const_iterator)
|
||||
iterator erase(const_iterator b, const_iterator e);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::erase(const_reference)
|
||||
size_type erase(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::treap::erase(const key_type &)
|
||||
size_type erase(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::erase(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::treap::erase(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::erase_and_dispose(const_iterator,Disposer)
|
||||
template<class Disposer>
|
||||
@@ -281,13 +296,13 @@ class treap_set_impl
|
||||
template<class Disposer>
|
||||
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::erase_and_dispose(const_reference, Disposer)
|
||||
//! @copydoc ::boost::intrusive::treap::erase_and_dispose(const key_type &, Disposer)
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer);
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
|
||||
//! @copydoc ::boost::intrusive::treap::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::clear
|
||||
void clear();
|
||||
@@ -298,100 +313,100 @@ class treap_set_impl
|
||||
|
||||
#endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::count(const_reference)const
|
||||
size_type count(const_reference value) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(value) != this->tree_type::cend()); }
|
||||
//! @copydoc ::boost::intrusive::treap::count(const key_type &)const
|
||||
size_type count(const key_type &key) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(key) != this->tree_type::cend()); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp) const
|
||||
//! @copydoc ::boost::intrusive::treap::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp) const
|
||||
{ return static_cast<size_type>(this->tree_type::find(key, comp) != this->tree_type::cend()); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::lower_bound(const_reference)
|
||||
iterator lower_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::treap::lower_bound(const key_type &)
|
||||
iterator lower_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::lower_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::treap::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::lower_bound(const_reference)const
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::treap::lower_bound(const key_type &)const
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::treap::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::upper_bound(const_reference)
|
||||
iterator upper_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::treap::upper_bound(const key_type &)
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::upper_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::treap::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::upper_bound(const_reference)const
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::treap::upper_bound(const key_type &)const
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::treap::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::find(const_reference)
|
||||
iterator find(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::treap::find(const key_type &)
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::find(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::treap::find(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::find(const_reference)const
|
||||
const_iterator find(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::treap::find(const key_type &)const
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::find(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::treap::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
#endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const_reference)
|
||||
std::pair<iterator,iterator> equal_range(const_reference value)
|
||||
{ return this->tree_type::lower_bound_range(value); }
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const key_type &)
|
||||
std::pair<iterator,iterator> equal_range(const key_type &key)
|
||||
{ return this->tree_type::lower_bound_range(key); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp)
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp)
|
||||
{ return this->tree_type::lower_bound_range(key, comp); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const key_type &)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const_reference value) const
|
||||
{ return this->tree_type::lower_bound_range(value); }
|
||||
equal_range(const key_type &key) const
|
||||
{ return this->tree_type::lower_bound_range(key); }
|
||||
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const KeyType& key, KeyValueCompare comp) const
|
||||
equal_range(const KeyType& key, KeyTypeKeyCompare comp) const
|
||||
{ return this->tree_type::lower_bound_range(key, comp); }
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::treap::bounded_range(const key_type &,const key_type &,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::treap::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::treap::bounded_range(const key_type &,const key_type &,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
bounded_range(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::treap::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -428,14 +443,14 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_treap_set
|
||||
{
|
||||
typedef typename pack_options
|
||||
< treap_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -446,6 +461,7 @@ struct make_treap_set
|
||||
|
||||
typedef treap_set_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::priority
|
||||
, typename packed_options::size_type
|
||||
@@ -459,14 +475,14 @@ struct make_treap_set
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class treap_set
|
||||
: public make_treap_set<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -475,7 +491,7 @@ class treap_set
|
||||
typedef typename make_treap_set
|
||||
<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -483,7 +499,7 @@ class treap_set
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_set)
|
||||
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::priority_compare priority_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
@@ -492,7 +508,7 @@ class treap_set
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
explicit treap_set( const value_compare &cmp = value_compare()
|
||||
explicit treap_set( const key_compare &cmp = key_compare()
|
||||
, const priority_compare &pcmp = priority_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, pcmp, v_traits)
|
||||
@@ -500,7 +516,7 @@ class treap_set
|
||||
|
||||
template<class Iterator>
|
||||
treap_set( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const priority_compare &pcmp = priority_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(b, e, cmp, pcmp, v_traits)
|
||||
@@ -513,6 +529,14 @@ class treap_set
|
||||
treap_set& operator=(BOOST_RV_REF(treap_set) x)
|
||||
{ return static_cast<treap_set &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const treap_set &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(treap_set) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static treap_set &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<treap_set &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
@@ -542,15 +566,15 @@ class treap_set
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
template<class T, class ...Options>
|
||||
#else
|
||||
template<class ValueTraits, class VoidOrKeyComp, class VoidOrPrioComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class VoidOrPrioComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
|
||||
#endif
|
||||
class treap_multiset_impl
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
: public treap_impl<ValueTraits, VoidOrKeyComp, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder>
|
||||
: public treap_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder>
|
||||
#endif
|
||||
{
|
||||
/// @cond
|
||||
typedef treap_impl<ValueTraits, VoidOrKeyComp, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> tree_type;
|
||||
typedef treap_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> tree_type;
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_multiset_impl)
|
||||
|
||||
typedef tree_type implementation_defined;
|
||||
@@ -559,6 +583,8 @@ class treap_multiset_impl
|
||||
public:
|
||||
typedef typename implementation_defined::value_type value_type;
|
||||
typedef typename implementation_defined::value_traits value_traits;
|
||||
typedef typename implementation_defined::key_type key_type;
|
||||
typedef typename implementation_defined::key_of_value key_of_value;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
typedef typename implementation_defined::const_pointer const_pointer;
|
||||
typedef typename implementation_defined::reference reference;
|
||||
@@ -566,8 +592,8 @@ class treap_multiset_impl
|
||||
typedef typename implementation_defined::difference_type difference_type;
|
||||
typedef typename implementation_defined::size_type size_type;
|
||||
typedef typename implementation_defined::value_compare value_compare;
|
||||
typedef typename implementation_defined::priority_compare priority_compare;
|
||||
typedef typename implementation_defined::key_compare key_compare;
|
||||
typedef typename implementation_defined::priority_compare priority_compare;
|
||||
typedef typename implementation_defined::iterator iterator;
|
||||
typedef typename implementation_defined::const_iterator const_iterator;
|
||||
typedef typename implementation_defined::reverse_iterator reverse_iterator;
|
||||
@@ -588,8 +614,8 @@ class treap_multiset_impl
|
||||
//!
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor of the value_compare object throws.
|
||||
explicit treap_multiset_impl( const value_compare &cmp = value_compare()
|
||||
//! or the copy constructor of the key_compare object throws.
|
||||
explicit treap_multiset_impl( const key_compare &cmp = key_compare()
|
||||
, const priority_compare &pcmp = priority_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(cmp, pcmp, v_traits)
|
||||
@@ -606,10 +632,10 @@ class treap_multiset_impl
|
||||
//!
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor/operator() of the value_compare object throws.
|
||||
//! or the copy constructor/operator() of the key_compare object throws.
|
||||
template<class Iterator>
|
||||
treap_multiset_impl( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const priority_compare &pcmp = priority_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_type(false, b, e, cmp, pcmp, v_traits)
|
||||
@@ -693,10 +719,23 @@ class treap_multiset_impl
|
||||
//! @copydoc ::boost::intrusive::treap::swap
|
||||
void swap(treap_multiset_impl& other);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::clone_from
|
||||
//! @copydoc ::boost::intrusive::treap::clone_from(const treap&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const treap_multiset_impl &src, Cloner cloner, Disposer disposer);
|
||||
|
||||
#else
|
||||
|
||||
using tree_type::clone_from;
|
||||
|
||||
#endif
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::clone_from(treap&&,Cloner,Disposer)
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(treap_multiset_impl) src, Cloner cloner, Disposer disposer)
|
||||
{ tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
|
||||
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::top()
|
||||
iterator top();
|
||||
|
||||
@@ -748,12 +787,12 @@ class treap_multiset_impl
|
||||
//! @copydoc ::boost::intrusive::treap::erase(const_iterator,const_iterator)
|
||||
iterator erase(const_iterator b, const_iterator e);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::erase(const_reference)
|
||||
size_type erase(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::treap::erase(const key_type &)
|
||||
size_type erase(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::erase(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::treap::erase(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::erase_and_dispose(const_iterator,Disposer)
|
||||
template<class Disposer>
|
||||
@@ -763,13 +802,13 @@ class treap_multiset_impl
|
||||
template<class Disposer>
|
||||
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::erase_and_dispose(const_reference, Disposer)
|
||||
//! @copydoc ::boost::intrusive::treap::erase_and_dispose(const key_type &, Disposer)
|
||||
template<class Disposer>
|
||||
size_type erase_and_dispose(const_reference value, Disposer disposer);
|
||||
size_type erase_and_dispose(const key_type &key, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer)
|
||||
template<class KeyType, class KeyValueCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer);
|
||||
//! @copydoc ::boost::intrusive::treap::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
|
||||
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
|
||||
size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::clear
|
||||
void clear();
|
||||
@@ -778,88 +817,88 @@ class treap_multiset_impl
|
||||
template<class Disposer>
|
||||
void clear_and_dispose(Disposer disposer);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::count(const_reference)const
|
||||
size_type count(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::treap::count(const key_type &)const
|
||||
size_type count(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::count(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
size_type count(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::treap::count(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
size_type count(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::lower_bound(const_reference)
|
||||
iterator lower_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::treap::lower_bound(const key_type &)
|
||||
iterator lower_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::lower_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::treap::lower_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::lower_bound(const_reference)const
|
||||
const_iterator lower_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::treap::lower_bound(const key_type &)const
|
||||
const_iterator lower_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::lower_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::treap::lower_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::upper_bound(const_reference)
|
||||
iterator upper_bound(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::treap::upper_bound(const key_type &)
|
||||
iterator upper_bound(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::upper_bound(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::treap::upper_bound(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::upper_bound(const_reference)const
|
||||
const_iterator upper_bound(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::treap::upper_bound(const key_type &)const
|
||||
const_iterator upper_bound(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::upper_bound(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::treap::upper_bound(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::find(const_reference)
|
||||
iterator find(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::treap::find(const key_type &)
|
||||
iterator find(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::find(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
iterator find(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::treap::find(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
iterator find(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::find(const_reference)const
|
||||
const_iterator find(const_reference value) const;
|
||||
//! @copydoc ::boost::intrusive::treap::find(const key_type &)const
|
||||
const_iterator find(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::find(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
const_iterator find(const KeyType& key, KeyValueCompare comp) const;
|
||||
//! @copydoc ::boost::intrusive::treap::find(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::equal_range(const_reference)
|
||||
std::pair<iterator,iterator> equal_range(const_reference value);
|
||||
//! @copydoc ::boost::intrusive::treap::equal_range(const key_type &)
|
||||
std::pair<iterator,iterator> equal_range(const key_type &key);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::equal_range(const KeyType&,KeyValueCompare)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp);
|
||||
//! @copydoc ::boost::intrusive::treap::equal_range(const KeyType&,KeyTypeKeyCompare)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::equal_range(const_reference)const
|
||||
//! @copydoc ::boost::intrusive::treap::equal_range(const key_type &)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const_reference value) const;
|
||||
equal_range(const key_type &key) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::equal_range(const KeyType&,KeyValueCompare)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::treap::equal_range(const KeyType&,KeyTypeKeyCompare)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<const_iterator, const_iterator>
|
||||
equal_range(const KeyType& key, KeyValueCompare comp) const;
|
||||
equal_range(const KeyType& key, KeyTypeKeyCompare comp) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::bounded_range(const_reference,const_reference,bool,bool)
|
||||
//! @copydoc ::boost::intrusive::treap::bounded_range(const key_type &,const key_type &,bool,bool)
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
|
||||
(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::treap::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
std::pair<iterator,iterator> bounded_range
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::bounded_range(const_reference,const_reference,bool,bool)const
|
||||
//! @copydoc ::boost::intrusive::treap::bounded_range(const key_type &,const key_type &,bool,bool)const
|
||||
std::pair<const_iterator, const_iterator>
|
||||
bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
|
||||
bounded_range(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||
template<class KeyType, class KeyValueCompare>
|
||||
//! @copydoc ::boost::intrusive::treap::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
|
||||
template<class KeyType, class KeyTypeKeyCompare>
|
||||
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;
|
||||
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
|
||||
|
||||
//! @copydoc ::boost::intrusive::treap::s_iterator_to(reference)
|
||||
static iterator s_iterator_to(reference value);
|
||||
@@ -896,14 +935,14 @@ template<class T, class ...Options>
|
||||
#else
|
||||
template<class T, class O1 = void, class O2 = void
|
||||
, class O3 = void, class O4 = void
|
||||
, class O5 = void>
|
||||
, class O5 = void, class O6 = void>
|
||||
#endif
|
||||
struct make_treap_multiset
|
||||
{
|
||||
typedef typename pack_options
|
||||
< treap_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -914,6 +953,7 @@ struct make_treap_multiset
|
||||
|
||||
typedef treap_multiset_impl
|
||||
< value_traits
|
||||
, typename packed_options::key_of_value
|
||||
, typename packed_options::compare
|
||||
, typename packed_options::priority
|
||||
, typename packed_options::size_type
|
||||
@@ -927,14 +967,14 @@ struct make_treap_multiset
|
||||
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class treap_multiset
|
||||
: public make_treap_multiset<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -943,7 +983,7 @@ class treap_multiset
|
||||
typedef typename make_treap_multiset
|
||||
<T,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
@@ -951,7 +991,7 @@ class treap_multiset
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_multiset)
|
||||
|
||||
public:
|
||||
typedef typename Base::value_compare value_compare;
|
||||
typedef typename Base::key_compare key_compare;
|
||||
typedef typename Base::priority_compare priority_compare;
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
@@ -960,7 +1000,7 @@ class treap_multiset
|
||||
//Assert if passed value traits are compatible with the type
|
||||
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
|
||||
|
||||
explicit treap_multiset( const value_compare &cmp = value_compare()
|
||||
explicit treap_multiset( const key_compare &cmp = key_compare()
|
||||
, const priority_compare &pcmp = priority_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(cmp, pcmp, v_traits)
|
||||
@@ -968,7 +1008,7 @@ class treap_multiset
|
||||
|
||||
template<class Iterator>
|
||||
treap_multiset( Iterator b, Iterator e
|
||||
, const value_compare &cmp = value_compare()
|
||||
, const key_compare &cmp = key_compare()
|
||||
, const priority_compare &pcmp = priority_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: Base(b, e, cmp, pcmp, v_traits)
|
||||
@@ -981,6 +1021,14 @@ class treap_multiset
|
||||
treap_multiset& operator=(BOOST_RV_REF(treap_multiset) x)
|
||||
{ return static_cast<treap_multiset &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(const treap_multiset &src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(src, cloner, disposer); }
|
||||
|
||||
template <class Cloner, class Disposer>
|
||||
void clone_from(BOOST_RV_REF(treap_multiset) src, Cloner cloner, Disposer disposer)
|
||||
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
|
||||
|
||||
static treap_multiset &container_from_end_iterator(iterator end_iterator)
|
||||
{ return static_cast<treap_multiset &>(Base::container_from_end_iterator(end_iterator)); }
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -127,6 +127,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "null_iterator", "null_itera
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bs_multiset", "bs_multiset\bsl_multiset.vcproj", "{2017A7A6-C3B8-45BC-C382-C0478A4312B3}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bs_set", "bs_set\bs_set.vcproj", "{19EA9747-E42A-C76A-17C7-A5C920B71727}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
@@ -263,6 +271,14 @@ Global
|
||||
{32A79B10-B2A0-C1B8-9458-9456152413B5}.Debug.Build.0 = Debug|Win32
|
||||
{32A79B10-B2A0-C1B8-9458-9456152413B5}.Release.ActiveCfg = Release|Win32
|
||||
{32A79B10-B2A0-C1B8-9458-9456152413B5}.Release.Build.0 = Release|Win32
|
||||
{2017A7A6-C3B8-45BC-C382-C0478A4312B3}.Debug.ActiveCfg = Debug|Win32
|
||||
{2017A7A6-C3B8-45BC-C382-C0478A4312B3}.Debug.Build.0 = Debug|Win32
|
||||
{2017A7A6-C3B8-45BC-C382-C0478A4312B3}.Release.ActiveCfg = Release|Win32
|
||||
{2017A7A6-C3B8-45BC-C382-C0478A4312B3}.Release.Build.0 = Release|Win32
|
||||
{19EA9747-E42A-C76A-17C7-A5C920B71727}.Debug.ActiveCfg = Debug|Win32
|
||||
{19EA9747-E42A-C76A-17C7-A5C920B71727}.Debug.Build.0 = Debug|Win32
|
||||
{19EA9747-E42A-C76A-17C7-A5C920B71727}.Release.ActiveCfg = Release|Win32
|
||||
{19EA9747-E42A-C76A-17C7-A5C920B71727}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
|
||||
Binary file not shown.
@@ -172,6 +172,9 @@
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\pointer_traits.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\priority_compare.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\rbtree.hpp">
|
||||
</File>
|
||||
@@ -370,6 +373,9 @@
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\tree_node.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\tree_value_compare.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\uncast.hpp">
|
||||
</File>
|
||||
@@ -381,12 +387,18 @@
|
||||
<Filter
|
||||
Name="Test headers"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="..\..\..\test\avl_test_common.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\test\bounded_pointer.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\test\bptr_value.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\test\bs_test_common.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\test\common_functors.hpp">
|
||||
</File>
|
||||
@@ -399,6 +411,12 @@
|
||||
<File
|
||||
RelativePath="..\..\..\test\generic_set_test.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\test\int_holder.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\test\iterator_test.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\test\itestvalue.hpp">
|
||||
</File>
|
||||
@@ -408,15 +426,27 @@
|
||||
<File
|
||||
RelativePath="..\..\..\test\nonhook_node.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\test\rb_test_common.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\test\smart_ptr.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\test\test_common.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\test\test_container.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\test\test_macros.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\test\unordered_test.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\test\unordered_test_common.hpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="example"
|
||||
@@ -469,6 +499,9 @@
|
||||
<File
|
||||
RelativePath="..\..\..\example\doc_list_algorithms.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\example\doc_map.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\example\doc_member_value_traits.cpp">
|
||||
</File>
|
||||
|
||||
+90
-208
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2015.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -11,237 +11,119 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/intrusive/avl_set.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include "itestvalue.hpp"
|
||||
#include "bptr_value.hpp"
|
||||
#include "smart_ptr.hpp"
|
||||
#include "avl_test_common.hpp"
|
||||
#include "generic_multiset_test.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_insert_before<boost::intrusive::avl_multiset<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
template<class VoidPointer>
|
||||
struct hooks
|
||||
template < class ValueTraits, bool ConstantTimeSize, bool DefaultHolder, bool Map >
|
||||
struct rebinder
|
||||
{
|
||||
typedef avl_set_base_hook<void_pointer<VoidPointer> > base_hook_type;
|
||||
typedef avl_set_base_hook
|
||||
<link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer>
|
||||
, tag<my_tag>
|
||||
, optimize_size<true> > auto_base_hook_type;
|
||||
typedef avl_set_member_hook
|
||||
<void_pointer<VoidPointer> > member_hook_type;
|
||||
typedef avl_set_member_hook
|
||||
< link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer> > auto_member_hook_type;
|
||||
typedef nonhook_node_member< avltree_node_traits<VoidPointer, false >,
|
||||
avltree_algorithms
|
||||
> nonhook_node_member_type;
|
||||
typedef tree_rebinder_common<ValueTraits, DefaultHolder, Map> common_t;
|
||||
|
||||
template < class Option1 =void
|
||||
, class Option2 =void
|
||||
>
|
||||
struct container
|
||||
{
|
||||
typedef avl_multiset
|
||||
< typename common_t::value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<ConstantTimeSize>
|
||||
, typename common_t::holder_opt
|
||||
, typename common_t::key_of_value_opt
|
||||
, Option1
|
||||
, Option2
|
||||
> type;
|
||||
BOOST_STATIC_ASSERT((key_type_tester<typename common_t::key_of_value_opt, type>::value));
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with void node allocator
|
||||
template < bool Default_Holder >
|
||||
struct GetContainer_With_Holder
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
typedef boost::intrusive::avl_multiset
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with standard (non-void) node allocator
|
||||
template <>
|
||||
struct GetContainer_With_Holder< false >
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// extract node type through options->value_traits->node_traits->node
|
||||
typedef typename pack_options< avltree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename detail::get_value_traits< ValueType, typename packed_options::proto_value_traits>::type value_traits;
|
||||
typedef typename value_traits::node_traits::node node;
|
||||
|
||||
typedef boost::intrusive::avl_multiset
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
, header_holder_type< pointer_holder< node > >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool constant_time_size, bool Default_Holder>
|
||||
template<class VoidPointer, bool ConstantTimeSize, bool DefaultHolder, bool Map>
|
||||
class test_main_template
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
static void execute()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , constant_time_size> value_type;
|
||||
|
||||
test::test_generic_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_multiset < nonhook_node_member_value_traits< value_type,
|
||||
typename hooks<VoidPointer>::nonhook_node_member_type,
|
||||
&value_type::nhn_member_,
|
||||
safe_link
|
||||
>,
|
||||
GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
return 0;
|
||||
typedef testvalue_traits< avl_hooks<VoidPointer> > testval_traits_t;
|
||||
//base
|
||||
typedef typename detail::if_c
|
||||
< ConstantTimeSize
|
||||
, typename testval_traits_t::base_value_traits
|
||||
, typename testval_traits_t::auto_base_value_traits
|
||||
>::type base_hook_t;
|
||||
test::test_generic_multiset
|
||||
< base_hook_t
|
||||
, rebinder<base_hook_t, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//member
|
||||
typedef typename detail::if_c
|
||||
< ConstantTimeSize
|
||||
, typename testval_traits_t::member_value_traits
|
||||
, typename testval_traits_t::auto_member_value_traits
|
||||
>::type member_hook_t;
|
||||
test::test_generic_multiset
|
||||
< member_hook_t
|
||||
, rebinder<member_hook_t, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//nonmember
|
||||
test::test_generic_multiset
|
||||
< typename testval_traits_t::nonhook_value_traits
|
||||
, rebinder<typename testval_traits_t::nonhook_value_traits, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool Default_Holder>
|
||||
class test_main_template<VoidPointer, false, Default_Holder>
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , false> value_type;
|
||||
|
||||
test::test_generic_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::auto_base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::auto_member_hook_type
|
||||
, &value_type::auto_node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
// container generator which ignores further parametrization, except for compare option
|
||||
template < typename Value_Traits, bool ConstantTimeSize, typename HeaderHolder >
|
||||
struct Get_Preset_Container
|
||||
{
|
||||
template < class
|
||||
, class Option1 = void
|
||||
, class Option2 = void
|
||||
, class Option3 = void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// ignore further paramatrization except for the compare option
|
||||
// notably ignore the size option (use preset)
|
||||
typedef typename pack_options< avltree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename packed_options::compare compare_option;
|
||||
|
||||
typedef boost::intrusive::avl_multiset< typename Value_Traits::value_type,
|
||||
value_traits< Value_Traits >,
|
||||
constant_time_size< ConstantTimeSize >,
|
||||
compare< compare_option >,
|
||||
header_holder_type< HeaderHolder >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template < bool ConstantTimeSize >
|
||||
template < bool ConstantTimeSize, bool Map >
|
||||
struct test_main_template_bptr
|
||||
{
|
||||
void operator () ()
|
||||
{
|
||||
typedef BPtr_Value value_type;
|
||||
typedef BPtr_Value_Traits< AVLTree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< value_type > allocator_type;
|
||||
static void execute()
|
||||
{
|
||||
typedef BPtr_Value_Traits< AVLTree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< BPtr_Value > allocator_type;
|
||||
|
||||
allocator_type::init();
|
||||
test::test_generic_multiset< value_traits,
|
||||
Get_Preset_Container< value_traits, ConstantTimeSize,
|
||||
bounded_pointer_holder< value_type > >::template GetContainer
|
||||
>::test_all();
|
||||
assert(allocator_type::is_clear());
|
||||
allocator_type::destroy();
|
||||
}
|
||||
bounded_allocator_scope<allocator_type> bounded_scope; (void)bounded_scope;
|
||||
test::test_generic_multiset
|
||||
< value_traits
|
||||
, rebinder< value_traits, ConstantTimeSize, true, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
// test (plain/smart pointers) x (nonconst/const size) x (void node allocator)
|
||||
test_main_template<void*, false, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, false, true>()();
|
||||
test_main_template<void*, true, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, true, true>()();
|
||||
// test (plain pointers) x (nonconst/const size) x (standard node allocator)
|
||||
test_main_template<void*, false, false>()();
|
||||
test_main_template<void*, true, false>()();
|
||||
// test (bounded pointers) x (nonconst/const size) x (special node allocator)
|
||||
//AVL with bptr failing in some platforms, to investigate.
|
||||
//test_main_template_bptr< true >()();
|
||||
//test_main_template_bptr< false >()();
|
||||
//Combinations: VoidPointer x ConstantTimeSize x DefaultHolder x Map
|
||||
//Minimize them selecting different combinations for raw and smart pointers
|
||||
//Start with ('false', 'false', 'false') in sets and 'false', 'false', 'true' in multisets
|
||||
|
||||
//void pointer
|
||||
//test_main_template<void*, false, false, false>::execute();
|
||||
test_main_template<void*, false, false, true>::execute();
|
||||
//test_main_template<void*, false, true, false>::execute();
|
||||
test_main_template<void*, false, true, true>::execute();
|
||||
//test_main_template<void*, true, false, false>::execute();
|
||||
test_main_template<void*, true, false, true>::execute();
|
||||
//test_main_template<void*, true, true, false>::execute();
|
||||
test_main_template<void*, true, true, true>::execute();
|
||||
|
||||
//smart_ptr
|
||||
test_main_template<smart_ptr<void>, false, false, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, false, false, true>::execute();
|
||||
test_main_template<smart_ptr<void>, false, true, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, false, true, true>::execute();
|
||||
test_main_template<smart_ptr<void>, true, false, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, false, true>::execute();
|
||||
test_main_template<smart_ptr<void>, true, true, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, true, true>::execute();
|
||||
|
||||
//bounded_ptr (bool ConstantTimeSize, bool Map)
|
||||
//test_main_template_bptr< false, false >::execute();
|
||||
test_main_template_bptr< false, true >::execute();
|
||||
test_main_template_bptr< true, false >::execute();
|
||||
//test_main_template_bptr< true, true >::execute();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
+90
-209
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2015.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -14,235 +14,116 @@
|
||||
#include "itestvalue.hpp"
|
||||
#include "bptr_value.hpp"
|
||||
#include "smart_ptr.hpp"
|
||||
#include "avl_test_common.hpp"
|
||||
#include "generic_set_test.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_insert_before<boost::intrusive::avl_set<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
template<class VoidPointer>
|
||||
struct hooks
|
||||
template < class ValueTraits, bool ConstantTimeSize, bool DefaultHolder, bool Map >
|
||||
struct rebinder
|
||||
{
|
||||
typedef avl_set_base_hook<void_pointer<VoidPointer> > base_hook_type;
|
||||
typedef avl_set_base_hook
|
||||
<link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer>
|
||||
, tag<my_tag>
|
||||
, optimize_size<true> > auto_base_hook_type;
|
||||
typedef avl_set_member_hook
|
||||
<void_pointer<VoidPointer> > member_hook_type;
|
||||
typedef avl_set_member_hook
|
||||
< link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer> > auto_member_hook_type;
|
||||
typedef nonhook_node_member< avltree_node_traits<VoidPointer, false >,
|
||||
avltree_algorithms
|
||||
> nonhook_node_member_type;
|
||||
typedef tree_rebinder_common<ValueTraits, DefaultHolder, Map> common_t;
|
||||
|
||||
template < class Option1 =void
|
||||
, class Option2 =void
|
||||
>
|
||||
struct container
|
||||
{
|
||||
typedef avl_set
|
||||
< typename common_t::value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<ConstantTimeSize>
|
||||
, typename common_t::holder_opt
|
||||
, typename common_t::key_of_value_opt
|
||||
, Option1
|
||||
, Option2
|
||||
> type;
|
||||
BOOST_STATIC_ASSERT((key_type_tester<typename common_t::key_of_value_opt, type>::value));
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with void node allocator
|
||||
template < bool Default_Holder >
|
||||
struct GetContainer_With_Holder
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
typedef boost::intrusive::avl_set
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with standard (non-void) node allocator
|
||||
template <>
|
||||
struct GetContainer_With_Holder< false >
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// extract node type through options->value_traits->node_traits->node
|
||||
typedef typename pack_options< avltree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename detail::get_value_traits< ValueType, typename packed_options::proto_value_traits>::type value_traits;
|
||||
typedef typename value_traits::node_traits::node node;
|
||||
|
||||
typedef boost::intrusive::avl_set
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
, header_holder_type< pointer_holder< node > >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool constant_time_size, bool Default_Holder>
|
||||
template<class VoidPointer, bool ConstantTimeSize, bool DefaultHolder, bool Map>
|
||||
class test_main_template
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
static void execute()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , constant_time_size> value_type;
|
||||
|
||||
test::test_generic_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_set < nonhook_node_member_value_traits< value_type,
|
||||
typename hooks<VoidPointer>::nonhook_node_member_type,
|
||||
&value_type::nhn_member_,
|
||||
safe_link
|
||||
>,
|
||||
GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
return 0;
|
||||
typedef testvalue_traits< avl_hooks<VoidPointer> > testval_traits_t;
|
||||
//base
|
||||
typedef typename detail::if_c
|
||||
< ConstantTimeSize
|
||||
, typename testval_traits_t::base_value_traits
|
||||
, typename testval_traits_t::auto_base_value_traits
|
||||
>::type base_hook_t;
|
||||
test::test_generic_set
|
||||
< base_hook_t
|
||||
, rebinder<base_hook_t, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//member
|
||||
typedef typename detail::if_c
|
||||
< ConstantTimeSize
|
||||
, typename testval_traits_t::member_value_traits
|
||||
, typename testval_traits_t::auto_member_value_traits
|
||||
>::type member_hook_t;
|
||||
test::test_generic_set
|
||||
< member_hook_t
|
||||
, rebinder<member_hook_t, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//nonmember
|
||||
test::test_generic_set
|
||||
< typename testval_traits_t::nonhook_value_traits
|
||||
, rebinder<typename testval_traits_t::nonhook_value_traits, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool Default_Holder>
|
||||
class test_main_template<VoidPointer, false, Default_Holder>
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , false> value_type;
|
||||
|
||||
test::test_generic_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::auto_base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::auto_member_hook_type
|
||||
, &value_type::auto_node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
// container generator which ignores further parametrization, except for compare option
|
||||
template < typename Value_Traits, bool ConstantTimeSize, typename HeaderHolder >
|
||||
struct Get_Preset_Container
|
||||
{
|
||||
template < class
|
||||
, class Option1 = void
|
||||
, class Option2 = void
|
||||
, class Option3 = void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// ignore further paramatrization except for the compare option
|
||||
// notably ignore the size option (use preset)
|
||||
typedef typename pack_options< avltree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename packed_options::compare compare_option;
|
||||
|
||||
typedef boost::intrusive::avl_set< typename Value_Traits::value_type,
|
||||
value_traits< Value_Traits >,
|
||||
constant_time_size< ConstantTimeSize >,
|
||||
compare< compare_option >,
|
||||
header_holder_type< HeaderHolder >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template < bool ConstantTimeSize >
|
||||
template < bool ConstantTimeSize, bool Map >
|
||||
struct test_main_template_bptr
|
||||
{
|
||||
void operator () ()
|
||||
{
|
||||
typedef BPtr_Value value_type;
|
||||
typedef BPtr_Value_Traits< AVLTree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< value_type > allocator_type;
|
||||
static void execute()
|
||||
{
|
||||
typedef BPtr_Value_Traits< AVLTree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< BPtr_Value > allocator_type;
|
||||
|
||||
allocator_type::init();
|
||||
test::test_generic_set< value_traits,
|
||||
Get_Preset_Container< value_traits, ConstantTimeSize,
|
||||
bounded_pointer_holder< value_type > >::template GetContainer
|
||||
>::test_all();
|
||||
assert(allocator_type::is_clear());
|
||||
allocator_type::destroy();
|
||||
}
|
||||
bounded_allocator_scope<allocator_type> bounded_scope; (void)bounded_scope;
|
||||
test::test_generic_set
|
||||
< value_traits
|
||||
, rebinder< value_traits, ConstantTimeSize, true, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
// test (plain/smart pointers) x (nonconst/const size) x (void node allocator)
|
||||
test_main_template<void*, false, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, false, true>()();
|
||||
test_main_template<void*, true, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, true, true>()();
|
||||
// test (plain pointers) x (nonconst/const size) x (standard node allocator)
|
||||
test_main_template<void*, false, false>()();
|
||||
test_main_template<void*, true, false>()();
|
||||
// test (bounded pointers) x (nonconst/const size) x (special node allocator)
|
||||
//AVL with bptr failing in some platforms, to investigate.
|
||||
//test_main_template_bptr< true >()();
|
||||
//test_main_template_bptr< false >()();
|
||||
//Combinations: VoidPointer x ConstantTimeSize x DefaultHolder x Map
|
||||
//Minimize them selecting different combinations for raw and smart pointers
|
||||
//Start with ('false', 'false', 'false') in sets and 'false', 'false', 'true' in multisets
|
||||
|
||||
//void pointer
|
||||
test_main_template<void*, false, false, false>::execute();
|
||||
//test_main_template<void*, false, false, true>::execute();
|
||||
test_main_template<void*, false, true, false>::execute();
|
||||
//test_main_template<void*, false, true, true>::execute();
|
||||
test_main_template<void*, true, false, false>::execute();
|
||||
//test_main_template<void*, true, false, true>::execute();
|
||||
test_main_template<void*, true, true, false>::execute();
|
||||
//test_main_template<void*, true, true, true>::execute();
|
||||
|
||||
//smart_ptr
|
||||
//test_main_template<smart_ptr<void>, false, false, false>::execute();
|
||||
test_main_template<smart_ptr<void>, false, false, true>::execute();
|
||||
//test_main_template<smart_ptr<void>, false, true, false>::execute();
|
||||
test_main_template<smart_ptr<void>, false, true, true>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, false, false>::execute();
|
||||
test_main_template<smart_ptr<void>, true, false, true>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, true, false>::execute();
|
||||
test_main_template<smart_ptr<void>, true, true, true>::execute();
|
||||
|
||||
//bounded_ptr (bool ConstantTimeSize, bool Map)
|
||||
test_main_template_bptr< false, false >::execute();
|
||||
//test_main_template_bptr< false, true >::execute();
|
||||
//test_main_template_bptr< true, false >::execute();
|
||||
test_main_template_bptr< true, true >::execute();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -218,6 +218,7 @@ class bounded_allocator
|
||||
assert(i < max_offset);
|
||||
p.m_offset = i;
|
||||
m_in_use[p.m_offset] = true;
|
||||
++m_in_use_count;
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -227,6 +228,7 @@ class bounded_allocator
|
||||
assert(n == 1);(void)n;
|
||||
assert(m_in_use[p.m_offset]);
|
||||
m_in_use[p.m_offset] = false;
|
||||
--m_in_use_count;
|
||||
}
|
||||
|
||||
// static methods
|
||||
@@ -268,14 +270,31 @@ class bounded_allocator
|
||||
friend class bounded_pointer< const T >;
|
||||
static T* m_base;
|
||||
static boost::container::vector< bool > m_in_use;
|
||||
static std::size_t m_in_use_count;
|
||||
}; // class bounded_allocator
|
||||
|
||||
template <class BoundedAllocator>
|
||||
class bounded_allocator_scope
|
||||
{
|
||||
public:
|
||||
bounded_allocator_scope()
|
||||
{ BoundedAllocator::init(); }
|
||||
|
||||
~bounded_allocator_scope()
|
||||
{
|
||||
assert(BoundedAllocator::is_clear());
|
||||
BoundedAllocator::destroy();
|
||||
}
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
T* bounded_allocator< T >::m_base = 0;
|
||||
|
||||
template < typename T >
|
||||
boost::container::vector< bool > bounded_allocator< T >::m_in_use;
|
||||
|
||||
template < typename T >
|
||||
std::size_t bounded_allocator< T >::m_in_use_count;
|
||||
|
||||
template < typename T >
|
||||
class bounded_reference_cont
|
||||
@@ -306,7 +325,7 @@ class bounded_reference_cont
|
||||
using Base::operator[];
|
||||
using Base::push_back;
|
||||
|
||||
bounded_reference_cont(size_t n = 0)
|
||||
explicit bounded_reference_cont(size_t n = 0)
|
||||
: Base(), m_allocator()
|
||||
{
|
||||
for (size_t i = 0; i < n; ++i){
|
||||
@@ -338,6 +357,17 @@ class bounded_reference_cont
|
||||
}
|
||||
}
|
||||
|
||||
template <typename InputIterator>
|
||||
void assign(InputIterator it_start, InputIterator it_end)
|
||||
{
|
||||
this->clear();
|
||||
for (InputIterator it = it_start; it != it_end;){
|
||||
pointer p = m_allocator.allocate(1);
|
||||
new (p.raw()) val_type(*it++);
|
||||
Base::push_back(*p);
|
||||
}
|
||||
}
|
||||
|
||||
~bounded_reference_cont()
|
||||
{ clear(); }
|
||||
|
||||
|
||||
+52
-45
@@ -26,7 +26,7 @@ struct BPtr_Value
|
||||
{
|
||||
static const bool constant_time_size = true;
|
||||
|
||||
BPtr_Value(int value = 42)
|
||||
explicit BPtr_Value(int value = 42)
|
||||
: value_(value)
|
||||
{}
|
||||
|
||||
@@ -55,7 +55,7 @@ struct BPtr_Value
|
||||
}
|
||||
|
||||
// value
|
||||
int value_;
|
||||
int_holder value_;
|
||||
|
||||
// list node hooks
|
||||
bounded_pointer< BPtr_Value > m_previous;
|
||||
@@ -66,6 +66,12 @@ struct BPtr_Value
|
||||
bounded_pointer< BPtr_Value > m_r_child;
|
||||
signed char m_extra;
|
||||
|
||||
const int_holder &get_int_holder() const
|
||||
{ return value_; }
|
||||
|
||||
int int_value() const
|
||||
{ return value_.int_value(); }
|
||||
|
||||
bool is_linked() const
|
||||
{ return m_previous || m_next || m_parent || m_l_child || m_r_child; }
|
||||
|
||||
@@ -119,47 +125,6 @@ struct List_BPtr_Node_Traits
|
||||
static void set_next(node_ptr p, node_ptr next) { p->m_next = next; }
|
||||
};
|
||||
|
||||
struct RBTree_BPtr_Node_Traits
|
||||
{
|
||||
typedef BPtr_Value val_t;
|
||||
typedef val_t node;
|
||||
typedef bounded_pointer< val_t > node_ptr;
|
||||
typedef bounded_pointer< const val_t > const_node_ptr;
|
||||
typedef signed char color;
|
||||
|
||||
static node_ptr get_parent(const_node_ptr p) { return p->m_parent; }
|
||||
static void set_parent(node_ptr p, node_ptr parent) { p->m_parent = parent; }
|
||||
static node_ptr get_left(const_node_ptr p) { return p->m_l_child; }
|
||||
static void set_left(node_ptr p, node_ptr l_child) { p->m_l_child = l_child; }
|
||||
static node_ptr get_right(const_node_ptr p) { return p->m_r_child; }
|
||||
static void set_right(node_ptr p, node_ptr r_child) { p->m_r_child = r_child; }
|
||||
static color get_color(const_node_ptr p) { return p->m_extra; }
|
||||
static void set_color(node_ptr p, color c) { p->m_extra = c; }
|
||||
static color black() { return 0; }
|
||||
static color red() { return 1; }
|
||||
};
|
||||
|
||||
struct AVLTree_BPtr_Node_Traits
|
||||
{
|
||||
typedef BPtr_Value val_t;
|
||||
typedef val_t node;
|
||||
typedef bounded_pointer< val_t > node_ptr;
|
||||
typedef bounded_pointer< const val_t > const_node_ptr;
|
||||
typedef signed char balance;
|
||||
|
||||
static node_ptr get_parent(const_node_ptr p) { return p->m_parent; }
|
||||
static void set_parent(node_ptr p, node_ptr parent) { p->m_parent = parent; }
|
||||
static node_ptr get_left(const_node_ptr p) { return p->m_l_child; }
|
||||
static void set_left(node_ptr p, node_ptr l_child) { p->m_l_child = l_child; }
|
||||
static node_ptr get_right(const_node_ptr p) { return p->m_r_child; }
|
||||
static void set_right(node_ptr p, node_ptr r_child) { p->m_r_child = r_child; }
|
||||
static balance get_balance(const_node_ptr p) { return p->m_extra; }
|
||||
static void set_balance(node_ptr p, balance b) { p->m_extra = b; }
|
||||
static balance negative() { return -1; }
|
||||
static balance zero() { return 0; }
|
||||
static balance positive() { return 1; }
|
||||
};
|
||||
|
||||
struct Tree_BPtr_Node_Traits
|
||||
{
|
||||
typedef BPtr_Value val_t;
|
||||
@@ -175,6 +140,31 @@ struct Tree_BPtr_Node_Traits
|
||||
static void set_right(node_ptr p, node_ptr r_child) { p->m_r_child = r_child; }
|
||||
};
|
||||
|
||||
struct RBTree_BPtr_Node_Traits
|
||||
: public Tree_BPtr_Node_Traits
|
||||
{
|
||||
typedef signed char color;
|
||||
typedef Tree_BPtr_Node_Traits::node_ptr node_ptr;
|
||||
typedef Tree_BPtr_Node_Traits::const_node_ptr const_node_ptr;
|
||||
static color get_color(const_node_ptr p) { return p->m_extra; }
|
||||
static void set_color(node_ptr p, color c) { p->m_extra = c; }
|
||||
static color black() { return 0; }
|
||||
static color red() { return 1; }
|
||||
};
|
||||
|
||||
struct AVLTree_BPtr_Node_Traits
|
||||
: public Tree_BPtr_Node_Traits
|
||||
{
|
||||
typedef signed char balance;
|
||||
typedef Tree_BPtr_Node_Traits::node_ptr node_ptr;
|
||||
typedef Tree_BPtr_Node_Traits::const_node_ptr const_node_ptr;
|
||||
static balance get_balance(const_node_ptr p) { return p->m_extra; }
|
||||
static void set_balance(node_ptr p, balance b) { p->m_extra = b; }
|
||||
static balance negative() { return -1; }
|
||||
static balance zero() { return 0; }
|
||||
static balance positive() { return 1; }
|
||||
};
|
||||
|
||||
template < typename NodeTraits >
|
||||
struct BPtr_Value_Traits
|
||||
{
|
||||
@@ -197,10 +187,10 @@ struct BPtr_Value_Traits
|
||||
};
|
||||
|
||||
template < typename >
|
||||
struct Value_Container;
|
||||
struct ValueContainer;
|
||||
|
||||
template <>
|
||||
struct Value_Container< BPtr_Value >
|
||||
struct ValueContainer< BPtr_Value >
|
||||
{
|
||||
typedef bounded_reference_cont< BPtr_Value > type;
|
||||
};
|
||||
@@ -224,6 +214,23 @@ class new_cloner< BPtr_Value >
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class new_nonconst_cloner< BPtr_Value >
|
||||
{
|
||||
public:
|
||||
typedef BPtr_Value value_type;
|
||||
typedef bounded_pointer< value_type > pointer;
|
||||
typedef bounded_reference< value_type > reference;
|
||||
typedef bounded_allocator< value_type > allocator_type;
|
||||
|
||||
pointer operator () (reference r)
|
||||
{
|
||||
pointer p = allocator_type().allocate(1);
|
||||
new (p.raw()) value_type(r);
|
||||
return p;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class delete_disposer< BPtr_Value >
|
||||
{
|
||||
|
||||
@@ -42,6 +42,14 @@ class new_cloner
|
||||
{ return new T(t); }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class new_nonconst_cloner
|
||||
{
|
||||
public:
|
||||
T *operator()(T &t)
|
||||
{ return new T(t); }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class new_default_factory
|
||||
{
|
||||
|
||||
@@ -83,12 +83,12 @@ void test_sizes(boolean<true>, std::size_t wordsize)
|
||||
test_iterator_sizes<c>(wordsize);
|
||||
}
|
||||
{
|
||||
typedef list< node< list_base_hook<> >, header_holder_type< pointer_holder< list_node<void*> > > > c;
|
||||
typedef list< node< list_base_hook<> >, header_holder_type< heap_node_holder< list_node<void*>* > > > c;
|
||||
BOOST_TEST_EQ(sizeof(c), wordsize*2);
|
||||
test_iterator_sizes<c>(wordsize);
|
||||
}
|
||||
{
|
||||
typedef list< node< list_base_hook<> >, constant_time_size<false>, header_holder_type< pointer_holder< list_node<void*> > > > c;
|
||||
typedef list< node< list_base_hook<> >, constant_time_size<false>, header_holder_type< heap_node_holder< list_node<void*>* > > > c;
|
||||
BOOST_TEST_EQ(sizeof(c), wordsize*1);
|
||||
test_iterator_sizes<c>(wordsize);
|
||||
}
|
||||
@@ -123,12 +123,12 @@ void test_sizes(boolean<true>, std::size_t wordsize)
|
||||
test_iterator_sizes<c>(wordsize);
|
||||
}
|
||||
{
|
||||
typedef set< node< set_base_hook<> >, header_holder_type< pointer_holder< rbtree_node<void*> > > > c;
|
||||
typedef set< node< set_base_hook<> >, header_holder_type< heap_node_holder< rbtree_node<void*>* > > > c;
|
||||
BOOST_TEST_EQ(sizeof(c), wordsize*2);
|
||||
test_iterator_sizes<c>(wordsize);
|
||||
}
|
||||
{
|
||||
typedef set< node< set_base_hook<> >, constant_time_size<false>, header_holder_type< pointer_holder< rbtree_node<void*> > > > c;
|
||||
typedef set< node< set_base_hook<> >, constant_time_size<false>, header_holder_type< heap_node_holder< rbtree_node<void*>* > > > c;
|
||||
BOOST_TEST_EQ(sizeof(c), wordsize*1);
|
||||
test_iterator_sizes<c>(wordsize);
|
||||
}
|
||||
@@ -148,15 +148,25 @@ void test_sizes(boolean<true>, std::size_t wordsize)
|
||||
test_iterator_sizes<c>(wordsize);
|
||||
}
|
||||
{
|
||||
typedef avl_set< node< avl_set_base_hook<> >, header_holder_type< pointer_holder< avltree_node<void*> > > > c;
|
||||
typedef avl_set< node< avl_set_base_hook<> >, header_holder_type< heap_node_holder< avltree_node<void*>* > > > c;
|
||||
BOOST_TEST_EQ(sizeof(c), wordsize*2);
|
||||
test_iterator_sizes<c>(wordsize);
|
||||
}
|
||||
{
|
||||
typedef avl_set< node< avl_set_base_hook<> >, constant_time_size<false>, header_holder_type< pointer_holder< avltree_node<void*> > > > c;
|
||||
typedef avl_set< node< avl_set_base_hook<> >, constant_time_size<false>, header_holder_type< heap_node_holder< avltree_node<void*>* > > > c;
|
||||
BOOST_TEST_EQ(sizeof(c), wordsize*1);
|
||||
test_iterator_sizes<c>(wordsize);
|
||||
}
|
||||
{ //bs
|
||||
typedef bs_set<node< bs_set_base_hook<> > > c;
|
||||
BOOST_TEST_EQ(sizeof(c), wordsize*4);
|
||||
test_iterator_sizes<c>(wordsize);
|
||||
}
|
||||
{
|
||||
typedef bs_set<node< bs_set_base_hook<> > , constant_time_size<false> > c;
|
||||
BOOST_TEST_EQ(sizeof(c), wordsize*3);
|
||||
test_iterator_sizes<c>(wordsize);
|
||||
}
|
||||
{ //splay
|
||||
typedef splay_set<node< bs_set_base_hook<> > > c;
|
||||
BOOST_TEST_EQ(sizeof(c), wordsize*4);
|
||||
|
||||
+58
-127
@@ -15,6 +15,7 @@
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include "common_functors.hpp"
|
||||
#include <boost/intrusive/options.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_macros.hpp"
|
||||
#include "test_container.hpp"
|
||||
@@ -23,61 +24,25 @@ namespace boost{
|
||||
namespace intrusive{
|
||||
namespace test{
|
||||
|
||||
template<class T>
|
||||
struct has_splay
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED(has_splay, splay)
|
||||
|
||||
template<class T>
|
||||
struct has_rebalance
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED(has_rebalance, rebalance)
|
||||
|
||||
template<class T>
|
||||
struct has_insert_before
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED(has_insert_before, insert_before)
|
||||
|
||||
template<class T>
|
||||
struct has_const_searches
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED(is_treap, priority_comp)
|
||||
|
||||
template<class T, bool = has_const_searches<T>::value>
|
||||
struct search_const_iterator
|
||||
{
|
||||
typedef typename T::const_iterator type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct search_const_iterator<T, false>
|
||||
{
|
||||
typedef typename T::iterator type;
|
||||
};
|
||||
|
||||
template<class T, bool = has_const_searches<T>::value>
|
||||
struct search_const_container
|
||||
{
|
||||
typedef const T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct search_const_container<T, false>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
struct test_generic_assoc
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef typename Value_Container< value_type >::type value_cont_type;
|
||||
typedef typename ValueTraits::reference reference;
|
||||
typedef typename ValueTraits::const_reference const_reference;
|
||||
typedef typename ValueTraits::pointer pointer;
|
||||
typedef typename ValueTraits::const_pointer const_pointer;
|
||||
typedef typename ValueContainer< value_type >::type value_cont_type;
|
||||
typedef typename pointer_traits<pointer>::reference reference;
|
||||
typedef typename pointer_traits
|
||||
<const_pointer>::reference const_reference;
|
||||
|
||||
static void test_all(value_cont_type&);
|
||||
static void test_clone(value_cont_type&);
|
||||
static void test_insert_erase_burst();
|
||||
@@ -95,16 +60,12 @@ struct test_generic_assoc
|
||||
static void test_container_from_iterator(value_cont_type&, detail::false_type) {}
|
||||
};
|
||||
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_assoc<ValueTraits, ContainerDefiner>::
|
||||
test_container_from_iterator(value_cont_type& values, detail::true_type)
|
||||
{
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type assoc_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type assoc_type;
|
||||
assoc_type testset(values.begin(), values.end());
|
||||
typedef typename assoc_type::iterator it_type;
|
||||
typedef typename assoc_type::const_iterator cit_type;
|
||||
@@ -123,11 +84,9 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::
|
||||
}
|
||||
}
|
||||
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_assoc<ValueTraits, ContainerDefiner>::test_insert_erase_burst()
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
|
||||
//value_cont_type values;
|
||||
const std::size_t MaxValues = 200;
|
||||
value_cont_type values(MaxValues);
|
||||
@@ -135,12 +94,8 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::test_insert_erase_burst(
|
||||
(&values[i])->value_ = i;
|
||||
}
|
||||
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type assoc_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type assoc_type;
|
||||
typedef typename assoc_type::iterator iterator;
|
||||
|
||||
{ //Ordered insertion + erasure
|
||||
@@ -181,16 +136,11 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::test_insert_erase_burst(
|
||||
}
|
||||
}
|
||||
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_assoc<ValueTraits, ContainerDefiner>::test_all(value_cont_type& values)
|
||||
{
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type assoc_type;
|
||||
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type assoc_type;
|
||||
test_clone(values);
|
||||
test_container_from_end(values, detail::bool_< assoc_type::has_container_from_iterator >());
|
||||
test_splay_up(values, detail::bool_< has_splay< assoc_type >::value >());
|
||||
@@ -201,52 +151,49 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::test_all(value_cont_type
|
||||
test_container_from_iterator(values, detail::bool_< assoc_type::has_container_from_iterator >());
|
||||
}
|
||||
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_assoc<ValueTraits, ContainerDefiner>
|
||||
::test_clone(value_cont_type& values)
|
||||
{
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type assoc_type;
|
||||
assoc_type testset1 (values.begin(), values.begin() + values.size());
|
||||
assoc_type testset2;
|
||||
{
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type assoc_type;
|
||||
assoc_type testset1 (values.begin(), values.begin() + values.size());
|
||||
assoc_type testset2;
|
||||
|
||||
testset2.clone_from(testset1, test::new_cloner<value_type>(), test::delete_disposer<value_type>());
|
||||
BOOST_TEST (testset2 == testset1);
|
||||
testset2.clear_and_dispose(test::delete_disposer<value_type>());
|
||||
BOOST_TEST (testset2.empty());
|
||||
typedef typename assoc_type::size_type size_type;
|
||||
size_type const testset1_oldsize = testset1.size();
|
||||
testset2.clone_from(testset1, test::new_cloner<value_type>(), test::delete_disposer<value_type>());
|
||||
BOOST_TEST (testset1.size() == testset1_oldsize);
|
||||
BOOST_TEST (testset2 == testset1);
|
||||
testset2.clear_and_dispose(test::delete_disposer<value_type>());
|
||||
BOOST_TEST (testset2.empty());
|
||||
|
||||
//Now test move clone
|
||||
testset2.clone_from(boost::move(testset1), test::new_nonconst_cloner<value_type>(), test::delete_disposer<value_type>());
|
||||
BOOST_TEST (testset2 == testset1);
|
||||
testset2.clear_and_dispose(test::delete_disposer<value_type>());
|
||||
BOOST_TEST (testset2.empty());
|
||||
}
|
||||
}
|
||||
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_assoc<ValueTraits, ContainerDefiner>
|
||||
::test_container_from_end(value_cont_type& values, detail::true_type)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type assoc_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type assoc_type;
|
||||
assoc_type testset (values.begin(), values.begin() + values.size());
|
||||
BOOST_TEST (testset == assoc_type::container_from_end_iterator(testset.end()));
|
||||
BOOST_TEST (testset == assoc_type::container_from_end_iterator(testset.cend()));
|
||||
}
|
||||
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_assoc<ValueTraits, ContainerDefiner>::test_splay_up
|
||||
(value_cont_type& values, detail::true_type)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type assoc_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type assoc_type;
|
||||
|
||||
typedef typename assoc_type::iterator iterator;
|
||||
typedef value_cont_type orig_set_t;
|
||||
@@ -276,17 +223,12 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::test_splay_up
|
||||
}
|
||||
}
|
||||
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_assoc<ValueTraits, ContainerDefiner>::test_splay_down
|
||||
(value_cont_type& values, detail::true_type)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type assoc_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type assoc_type;
|
||||
|
||||
typedef typename assoc_type::iterator iterator;
|
||||
typedef value_cont_type orig_set_t;
|
||||
@@ -317,23 +259,17 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::test_splay_down
|
||||
}
|
||||
}
|
||||
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_assoc<ValueTraits, ContainerDefiner>::test_rebalance
|
||||
(value_cont_type& values, detail::true_type)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type assoc_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type assoc_type;
|
||||
typedef value_cont_type orig_set_t;
|
||||
orig_set_t original_testset;
|
||||
{
|
||||
assoc_type testset (values.begin(), values.end());
|
||||
//original_testset.insert(original_testset.end(), testset.begin(), testset.end());
|
||||
original_testset = value_cont_type(testset.begin(), testset.end());
|
||||
original_testset.assign(testset.begin(), testset.end());
|
||||
}
|
||||
{
|
||||
assoc_type testset(values.begin(), values.end());
|
||||
@@ -358,17 +294,12 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::test_rebalance
|
||||
}
|
||||
}
|
||||
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_assoc<ValueTraits, ContainerDefiner>::test_insert_before
|
||||
(value_cont_type& values, detail::true_type)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type assoc_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type assoc_type;
|
||||
{
|
||||
assoc_type testset;
|
||||
typedef typename value_cont_type::iterator vec_iterator;
|
||||
|
||||
@@ -25,13 +25,17 @@ namespace boost{
|
||||
namespace intrusive{
|
||||
namespace test{
|
||||
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
struct test_generic_multiset
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef typename Value_Container< value_type >::type value_cont_type;
|
||||
typedef typename ValueTraits::reference reference;
|
||||
typedef typename ValueTraits::const_reference const_reference;
|
||||
typedef typename ValueTraits::pointer pointer;
|
||||
typedef typename ValueTraits::const_pointer const_pointer;
|
||||
typedef typename ValueContainer< value_type >::type value_cont_type;
|
||||
typedef typename pointer_traits<pointer>::reference reference;
|
||||
typedef typename pointer_traits
|
||||
<const_pointer>::reference const_reference;
|
||||
|
||||
static void test_all();
|
||||
static void test_sort(value_cont_type&);
|
||||
static void test_insert(value_cont_type&);
|
||||
@@ -40,20 +44,15 @@ struct test_generic_multiset
|
||||
static void test_impl();
|
||||
};
|
||||
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_multiset<ValueTraits, ContainerDefiner>::test_all ()
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
static const int random_init[6] = { 3, 2, 4, 1, 5, 2 };
|
||||
value_cont_type values (6);
|
||||
for (int i = 0; i < 6; ++i)
|
||||
(&values[i])->value_ = random_init[i];
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type multiset_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type multiset_type;
|
||||
{
|
||||
multiset_type testset(values.begin(), values.end());
|
||||
test::test_container(testset);
|
||||
@@ -76,20 +75,14 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_all ()
|
||||
}
|
||||
|
||||
//test case due to an error in tree implementation:
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_multiset<ValueTraits, ContainerDefiner>::test_impl()
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
value_cont_type values (5);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
(&values[i])->value_ = i;
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type multiset_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type multiset_type;
|
||||
|
||||
multiset_type testset;
|
||||
for (int i = 0; i < 5; ++i)
|
||||
@@ -104,16 +97,11 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_impl()
|
||||
}
|
||||
|
||||
//test: constructor, iterator, clear, reverse_iterator, front, back, size:
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_multiset<ValueTraits, ContainerDefiner>::test_sort(value_cont_type& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type multiset_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type multiset_type;
|
||||
|
||||
multiset_type testset1 (values.begin(), values.end());
|
||||
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
|
||||
@@ -122,13 +110,9 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_sort(value_cont_
|
||||
testset1.clear();
|
||||
BOOST_TEST (testset1.empty());
|
||||
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, compare<even_odd>
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function2;
|
||||
typedef typename definer_function2::type multiset_type2;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<compare<even_odd>
|
||||
>::type multiset_type2;
|
||||
|
||||
multiset_type2 testset2 (values.begin(), values.begin() + 6);
|
||||
{ int init_values [] = { 5, 3, 1, 4, 2, 2 };
|
||||
@@ -139,16 +123,11 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_sort(value_cont_
|
||||
}
|
||||
|
||||
//test: insert, const_iterator, const_reverse_iterator, erase, iterator_to:
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_multiset<ValueTraits, ContainerDefiner>::test_insert(value_cont_type& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type multiset_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type multiset_type;
|
||||
|
||||
multiset_type testset;
|
||||
testset.insert(values.begin() + 2, values.begin() + 5);
|
||||
@@ -177,16 +156,11 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_insert(value_con
|
||||
}
|
||||
|
||||
//test: insert (seq-version), swap, erase (seq-version), size:
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_multiset<ValueTraits, ContainerDefiner>::test_swap(value_cont_type& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type multiset_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type multiset_type;
|
||||
multiset_type testset1 (values.begin(), values.begin() + 2);
|
||||
multiset_type testset2;
|
||||
testset2.insert (values.begin() + 2, values.begin() + 6);
|
||||
@@ -203,40 +177,36 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_swap(value_cont_
|
||||
}
|
||||
|
||||
//test: find, equal_range (lower_bound, upper_bound):
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_type& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type multiset_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type multiset_type;
|
||||
typedef typename multiset_type::key_of_value key_of_value;
|
||||
multiset_type testset (values.begin(), values.end());
|
||||
typedef typename multiset_type::iterator iterator;
|
||||
typedef typename multiset_type::const_iterator const_iterator;
|
||||
|
||||
{
|
||||
value_cont_type cmp_val_cont(1);
|
||||
reference cmp_val = cmp_val_cont.front();
|
||||
(&cmp_val)->value_ = 2;
|
||||
iterator i = testset.find (cmp_val);
|
||||
iterator i = testset.find (key_of_value()(cmp_val));
|
||||
BOOST_TEST (i->value_ == 2);
|
||||
BOOST_TEST ((++i)->value_ == 2);
|
||||
std::pair<iterator,iterator> range = testset.equal_range (cmp_val);
|
||||
std::pair<iterator,iterator> range = testset.equal_range (key_of_value()(cmp_val));
|
||||
|
||||
BOOST_TEST (range.first->value_ == 2);
|
||||
BOOST_TEST (range.second->value_ == 3);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 2);
|
||||
|
||||
(&cmp_val)->value_ = 7;
|
||||
BOOST_TEST (testset.find (cmp_val) == testset.end());
|
||||
BOOST_TEST (testset.find(key_of_value()(cmp_val)) == testset.end());
|
||||
}
|
||||
{ //1, 2, 2, 3, 4, 5
|
||||
typename search_const_container<multiset_type>::type &const_testset = testset;
|
||||
const multiset_type &const_testset = testset;
|
||||
std::pair<iterator,iterator> range;
|
||||
std::pair<typename search_const_iterator<multiset_type>::type
|
||||
,typename search_const_iterator<multiset_type>::type> const_range;
|
||||
std::pair<const_iterator, const_iterator> const_range;
|
||||
value_cont_type cmp_val_cont(2);
|
||||
reference cmp_val_lower = cmp_val_cont.front();
|
||||
reference cmp_val_upper = cmp_val_cont.back();
|
||||
@@ -244,7 +214,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
(&cmp_val_upper)->value_ = 2;
|
||||
//left-closed, right-closed
|
||||
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, true, true);
|
||||
range = testset.bounded_range (key_of_value()(cmp_val_lower), key_of_value()(cmp_val_upper), true, true);
|
||||
BOOST_TEST (range.first->value_ == 1);
|
||||
BOOST_TEST (range.second->value_ == 3);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 3);
|
||||
@@ -252,14 +222,14 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
|
||||
{
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
(&cmp_val_upper)->value_ = 2;
|
||||
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
|
||||
const_range = const_testset.bounded_range (key_of_value()(cmp_val_lower), key_of_value()(cmp_val_upper), true, false);
|
||||
BOOST_TEST (const_range.first->value_ == 1);
|
||||
BOOST_TEST (const_range.second->value_ == 2);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 1);
|
||||
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
(&cmp_val_upper)->value_ = 3;
|
||||
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
|
||||
range = testset.bounded_range (key_of_value()(cmp_val_lower), key_of_value()(cmp_val_upper), true, false);
|
||||
BOOST_TEST (range.first->value_ == 1);
|
||||
BOOST_TEST (range.second->value_ == 3);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 3);
|
||||
@@ -267,7 +237,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
|
||||
{
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
(&cmp_val_upper)->value_ = 2;
|
||||
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, false, true);
|
||||
const_range = const_testset.bounded_range (key_of_value()(cmp_val_lower), key_of_value()(cmp_val_upper), false, true);
|
||||
BOOST_TEST (const_range.first->value_ == 2);
|
||||
BOOST_TEST (const_range.second->value_ == 3);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 2);
|
||||
@@ -275,7 +245,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
|
||||
{
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
(&cmp_val_upper)->value_ = 2;
|
||||
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, false, false);
|
||||
range = testset.bounded_range (key_of_value()(cmp_val_lower), key_of_value()(cmp_val_upper), false, false);
|
||||
BOOST_TEST (range.first->value_ == 2);
|
||||
BOOST_TEST (range.second->value_ == 2);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 0);
|
||||
@@ -283,7 +253,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
|
||||
{
|
||||
(&cmp_val_lower)->value_ = 5;
|
||||
(&cmp_val_upper)->value_ = 6;
|
||||
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
|
||||
const_range = const_testset.bounded_range (key_of_value()(cmp_val_lower), key_of_value()(cmp_val_upper), true, false);
|
||||
BOOST_TEST (const_range.first->value_ == 5);
|
||||
BOOST_TEST (const_range.second == const_testset.end());
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 1);
|
||||
|
||||
+79
-100
@@ -16,29 +16,30 @@
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/intrusive/options.hpp>
|
||||
#include <boost/intrusive/detail/iterator.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include "test_macros.hpp"
|
||||
#include "test_container.hpp"
|
||||
#include "generic_assoc_test.hpp"
|
||||
#include <typeinfo>
|
||||
#include <boost/intrusive/priority_compare.hpp>
|
||||
|
||||
namespace boost{
|
||||
namespace intrusive{
|
||||
namespace test{
|
||||
|
||||
template<class T>
|
||||
struct is_treap
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
struct test_generic_set
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef typename Value_Container< value_type >::type value_cont_type;
|
||||
typedef typename ValueTraits::reference reference;
|
||||
typedef typename ValueTraits::const_reference const_reference;
|
||||
static void test_all();
|
||||
private:
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef typename ValueTraits::pointer pointer;
|
||||
typedef typename ValueTraits::const_pointer const_pointer;
|
||||
typedef typename ValueContainer< value_type >::type value_cont_type;
|
||||
typedef typename pointer_traits<pointer>::reference reference;
|
||||
typedef typename pointer_traits
|
||||
<const_pointer>::reference const_reference;
|
||||
|
||||
static void test_sort(value_cont_type&);
|
||||
static void test_insert(value_cont_type&);
|
||||
static void test_insert_advanced(value_cont_type&, detail::true_type);
|
||||
@@ -49,16 +50,11 @@ struct test_generic_set
|
||||
};
|
||||
|
||||
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_set<ValueTraits, ContainerDefiner>::test_all()
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type set_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type set_type;
|
||||
{
|
||||
static const int random_init[6] = { 3, 2, 4, 1, 5, 2 };
|
||||
value_cont_type values(6);
|
||||
@@ -97,21 +93,15 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_all()
|
||||
}
|
||||
|
||||
//test case due to an error in tree implementation:
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_set<ValueTraits, ContainerDefiner>::test_impl()
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
value_cont_type values (5);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
(&values[i])->value_ = i;
|
||||
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type set_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type set_type;
|
||||
set_type testset;
|
||||
for (int i = 0; i < 5; ++i)
|
||||
testset.insert (values[i]);
|
||||
@@ -125,16 +115,11 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_impl()
|
||||
}
|
||||
|
||||
//test: constructor, iterator, clear, reverse_iterator, front, back, size:
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_set<ValueTraits, ContainerDefiner>::test_sort(value_cont_type& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type set_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type set_type;
|
||||
|
||||
set_type testset1 (values.begin(), values.end());
|
||||
{ int init_values [] = { 1, 2, 3, 4, 5 };
|
||||
@@ -143,14 +128,8 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_sort(value_cont_type&
|
||||
testset1.clear();
|
||||
BOOST_TEST (testset1.empty());
|
||||
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, compare<even_odd>
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function2;
|
||||
typedef typename definer_function2::type set_type2;
|
||||
typedef typename ContainerDefiner::template container
|
||||
< compare<even_odd> >::type set_type2;
|
||||
|
||||
set_type2 testset2 (values.begin(), values.begin() + 6);
|
||||
{ int init_values [] = { 5, 3, 1, 4, 2 };
|
||||
@@ -160,16 +139,11 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_sort(value_cont_type&
|
||||
}
|
||||
|
||||
//test: insert, const_iterator, const_reverse_iterator, erase, s_iterator_to:
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_set<ValueTraits, ContainerDefiner>::test_insert(value_cont_type& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type set_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type set_type;
|
||||
{
|
||||
set_type testset;
|
||||
testset.insert(values.begin() + 2, values.begin() + 5);
|
||||
@@ -206,60 +180,69 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_insert(value_cont_typ
|
||||
}
|
||||
|
||||
// treap version
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueType, class KeyType>
|
||||
struct prio_comp
|
||||
: priority_compare<int>
|
||||
{
|
||||
bool operator()(const ValueType &v, const KeyType &k) const
|
||||
{ return this->priority_compare<int>::operator()(v.int_value(), k.int_value()); }
|
||||
|
||||
bool operator()(const KeyType &k, const ValueType &v) const
|
||||
{ return this->priority_compare<int>::operator()(k.int_value(), v.int_value()); }
|
||||
};
|
||||
|
||||
template<class ValueType>
|
||||
struct prio_comp<ValueType, ValueType>
|
||||
: priority_compare<ValueType>
|
||||
{
|
||||
bool operator()(const ValueType &v1, const ValueType &v2) const
|
||||
{ return this->priority_compare<ValueType>::operator()(v1, v2); }
|
||||
};
|
||||
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_set<ValueTraits, ContainerDefiner>::test_insert_advanced
|
||||
(value_cont_type& values, detail::true_type)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type set_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type set_type;
|
||||
typedef typename set_type::key_of_value key_of_value;
|
||||
typedef typename set_type::key_type key_type;
|
||||
typedef typename set_type::value_type value_type;
|
||||
typedef prio_comp<value_type, key_type> prio_comp_t;
|
||||
{
|
||||
set_type testset;
|
||||
testset.insert(values.begin(), values.begin() + values.size());
|
||||
value_type v(1);
|
||||
typename set_type::insert_commit_data data;
|
||||
BOOST_TEST (!testset.insert_check(v, testset.value_comp(), testset.priority_comp(), data).second);
|
||||
BOOST_TEST (!testset.insert_check(testset.begin(), v, testset.value_comp(), testset.priority_comp(), data).second);
|
||||
BOOST_TEST (!testset.insert_check(key_of_value()(v), testset.key_comp(), prio_comp_t(), data).second);
|
||||
BOOST_TEST (!testset.insert_check(testset.begin(), key_of_value()(v), testset.key_comp(), prio_comp_t(), data).second);
|
||||
}
|
||||
}
|
||||
|
||||
//test: insert, const_iterator, const_reverse_iterator, erase, s_iterator_to:
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_set<ValueTraits, ContainerDefiner>::test_insert_advanced
|
||||
(value_cont_type& values, detail::false_type)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type set_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type set_type;
|
||||
typedef typename set_type::key_of_value key_of_value;
|
||||
{
|
||||
set_type testset;
|
||||
testset.insert(values.begin(), values.begin() + values.size());
|
||||
value_type v(1);
|
||||
typename set_type::insert_commit_data data;
|
||||
BOOST_TEST (!testset.insert_check(v, testset.value_comp(), data).second);
|
||||
BOOST_TEST (!testset.insert_check(testset.begin(), v, testset.value_comp(), data).second);
|
||||
BOOST_TEST (!testset.insert_check(key_of_value()(v), testset.key_comp(), data).second);
|
||||
BOOST_TEST (!testset.insert_check(testset.begin(), key_of_value()(v), testset.key_comp(), data).second);
|
||||
}
|
||||
}
|
||||
|
||||
//test: insert (seq-version), swap, erase (seq-version), size:
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_set<ValueTraits, ContainerDefiner>::test_swap(value_cont_type& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type set_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type set_type;
|
||||
set_type testset1 (values.begin(), values.begin() + 2);
|
||||
set_type testset2;
|
||||
testset2.insert (values.begin() + 2, values.begin() + 6);
|
||||
@@ -278,42 +261,38 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_swap(value_cont_type&
|
||||
}
|
||||
|
||||
//test: find, equal_range (lower_bound, upper_bound), bounded_range:
|
||||
template<class ValueTraits, template <class = void, class = void, class = void, class = void> class ContainerDefiner>
|
||||
template<class ValueTraits, class ContainerDefiner>
|
||||
void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> definer_function;
|
||||
typedef typename definer_function::type set_type;
|
||||
typedef typename ContainerDefiner::template container
|
||||
<>::type set_type;
|
||||
set_type testset (values.begin(), values.end());
|
||||
typedef typename set_type::iterator iterator;
|
||||
typedef typename set_type::const_iterator const_iterator;
|
||||
typedef typename set_type::key_of_value key_of_value;
|
||||
|
||||
{
|
||||
//value_type cmp_val;
|
||||
value_cont_type cmp_val_cont(1);
|
||||
reference cmp_val = cmp_val_cont.front();
|
||||
(&cmp_val)->value_ = 2;
|
||||
iterator i = testset.find (cmp_val);
|
||||
iterator i = testset.find(key_of_value()(cmp_val));
|
||||
BOOST_TEST (i->value_ == 2);
|
||||
BOOST_TEST ((++i)->value_ != 2);
|
||||
std::pair<iterator,iterator> range = testset.equal_range (cmp_val);
|
||||
std::pair<iterator,iterator> range = testset.equal_range (key_of_value()(cmp_val));
|
||||
|
||||
BOOST_TEST (range.first->value_ == 2);
|
||||
BOOST_TEST (range.second->value_ == 3);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 1);
|
||||
|
||||
(&cmp_val)->value_ = 7;
|
||||
BOOST_TEST (testset.find (cmp_val) == testset.end());
|
||||
BOOST_TEST (testset.find (key_of_value()(cmp_val)) == testset.end());
|
||||
}
|
||||
|
||||
{
|
||||
typename search_const_container<set_type>::type &const_testset = testset;
|
||||
const set_type &const_testset = testset;
|
||||
std::pair<iterator,iterator> range;
|
||||
std::pair<typename search_const_iterator<set_type>::type
|
||||
,typename search_const_iterator<set_type>::type> const_range;
|
||||
std::pair<const_iterator, const_iterator> const_range;
|
||||
//value_type cmp_val_lower, cmp_val_upper;
|
||||
value_cont_type cmp_val_cont(2);
|
||||
reference cmp_val_lower = cmp_val_cont.front();
|
||||
@@ -322,7 +301,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
(&cmp_val_upper)->value_ = 2;
|
||||
//left-closed, right-closed
|
||||
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, true, true);
|
||||
range = testset.bounded_range (key_of_value()(cmp_val_lower), key_of_value()(cmp_val_upper), true, true);
|
||||
BOOST_TEST (range.first->value_ == 1);
|
||||
BOOST_TEST (range.second->value_ == 3);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 2);
|
||||
@@ -330,14 +309,14 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
|
||||
{
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
(&cmp_val_upper)->value_ = 2;
|
||||
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
|
||||
const_range = const_testset.bounded_range (key_of_value()(cmp_val_lower), key_of_value()(cmp_val_upper), true, false);
|
||||
BOOST_TEST (const_range.first->value_ == 1);
|
||||
BOOST_TEST (const_range.second->value_ == 2);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 1);
|
||||
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
(&cmp_val_upper)->value_ = 3;
|
||||
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
|
||||
range = testset.bounded_range (key_of_value()(cmp_val_lower), key_of_value()(cmp_val_upper), true, false);
|
||||
BOOST_TEST (range.first->value_ == 1);
|
||||
BOOST_TEST (range.second->value_ == 3);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 2);
|
||||
@@ -345,7 +324,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
|
||||
{
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
(&cmp_val_upper)->value_ = 2;
|
||||
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, false, true);
|
||||
const_range = const_testset.bounded_range (key_of_value()(cmp_val_lower), key_of_value()(cmp_val_upper), false, true);
|
||||
BOOST_TEST (const_range.first->value_ == 2);
|
||||
BOOST_TEST (const_range.second->value_ == 3);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 1);
|
||||
@@ -353,7 +332,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
|
||||
{
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
(&cmp_val_upper)->value_ = 2;
|
||||
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, false, false);
|
||||
range = testset.bounded_range (key_of_value()(cmp_val_lower), key_of_value()(cmp_val_upper), false, false);
|
||||
BOOST_TEST (range.first->value_ == 2);
|
||||
BOOST_TEST (range.second->value_ == 2);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 0);
|
||||
@@ -361,7 +340,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
|
||||
{
|
||||
(&cmp_val_lower)->value_ = 5;
|
||||
(&cmp_val_upper)->value_ = 6;
|
||||
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
|
||||
const_range = const_testset.bounded_range (key_of_value()(cmp_val_lower), key_of_value()(cmp_val_upper), true, false);
|
||||
BOOST_TEST (const_range.first->value_ == 5);
|
||||
BOOST_TEST (const_range.second == const_testset.end());
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 1);
|
||||
|
||||
+129
-54
@@ -16,7 +16,10 @@
|
||||
#include <iostream>
|
||||
#include <boost/intrusive/options.hpp>
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include "nonhook_node.hpp"
|
||||
#include "int_holder.hpp"
|
||||
#include <boost/intrusive/detail/get_value_traits.hpp>
|
||||
#include <boost/container/vector.hpp>
|
||||
|
||||
namespace boost{
|
||||
@@ -27,7 +30,7 @@ struct testvalue_filler
|
||||
void *dummy_[3];
|
||||
};
|
||||
|
||||
template<class Hooks, bool ConstantTimeSize>
|
||||
template<class Hooks>
|
||||
struct testvalue
|
||||
: testvalue_filler
|
||||
, Hooks::base_hook_type
|
||||
@@ -36,19 +39,18 @@ struct testvalue
|
||||
typename Hooks::member_hook_type node_;
|
||||
typename Hooks::auto_member_hook_type auto_node_;
|
||||
typename Hooks::nonhook_node_member_type nhn_member_;
|
||||
int value_;
|
||||
|
||||
static const bool constant_time_size = ConstantTimeSize;
|
||||
int_holder value_;
|
||||
|
||||
testvalue()
|
||||
{}
|
||||
|
||||
testvalue(int i)
|
||||
explicit testvalue(int i)
|
||||
: value_(i)
|
||||
{}
|
||||
|
||||
testvalue (const testvalue& src)
|
||||
: value_ (src.value_)
|
||||
: value_(src.value_)
|
||||
{}
|
||||
|
||||
// testvalue is used in boost::container::vector and thus prev and next
|
||||
@@ -82,6 +84,12 @@ struct testvalue
|
||||
nhn_member_.is_linked();
|
||||
}
|
||||
|
||||
const int_holder &get_int_holder() const
|
||||
{ return value_; }
|
||||
|
||||
int int_value() const
|
||||
{ return value_.int_value(); }
|
||||
|
||||
~testvalue()
|
||||
{}
|
||||
|
||||
@@ -95,109 +103,176 @@ struct testvalue
|
||||
{ return value_ != other.value_; }
|
||||
|
||||
friend bool operator< (int other1, const testvalue &other2)
|
||||
{ return other1 < other2.value_; }
|
||||
{ return other1 < other2.value_.int_; }
|
||||
|
||||
friend bool operator< (const testvalue &other1, int other2)
|
||||
{ return other1.value_ < other2; }
|
||||
{ return other1.value_.int_ < other2; }
|
||||
|
||||
friend bool operator== (int other1, const testvalue &other2)
|
||||
{ return other1 == other2.value_; }
|
||||
{ return other1 == other2.value_.int_; }
|
||||
|
||||
friend bool operator== (const testvalue &other1, int other2)
|
||||
{ return other1.value_ == other2; }
|
||||
{ return other1.value_.int_ == other2; }
|
||||
|
||||
friend bool operator!= (int other1, const testvalue &other2)
|
||||
{ return other1 != other2.value_; }
|
||||
{ return other1 != other2.value_.int_; }
|
||||
|
||||
friend bool operator!= (const testvalue &other1, int other2)
|
||||
{ return other1.value_ != other2; }
|
||||
{ return other1.value_.int_ != other2; }
|
||||
|
||||
friend std::size_t hash_value(const testvalue&t)
|
||||
{
|
||||
boost::hash<int> hasher;
|
||||
return hasher((&t)->int_value());
|
||||
}
|
||||
};
|
||||
|
||||
template < typename Node_Algorithms, class Hooks, bool ConstantTimeSize >
|
||||
void swap_nodes(testvalue< Hooks, ConstantTimeSize >& lhs, testvalue< Hooks, ConstantTimeSize >& rhs)
|
||||
{
|
||||
lhs.swap_nodes(rhs);
|
||||
}
|
||||
|
||||
template < typename Value_Type >
|
||||
std::size_t hash_value(const Value_Type& t)
|
||||
template <class Type>
|
||||
bool priority_order(const Type& t1, const Type& t2)
|
||||
{
|
||||
boost::hash<int> hasher;
|
||||
return hasher((&t)->value_);
|
||||
}
|
||||
|
||||
template < typename Value_Type >
|
||||
bool priority_order(const Value_Type& t1, const Value_Type& t2)
|
||||
{
|
||||
std::size_t hash1 = hash_value(t1);
|
||||
std::size_t hash1 = boost::hash<int>()((&t1)->int_value());
|
||||
boost::hash_combine(hash1, &t1);
|
||||
std::size_t hash2 = hash_value(t2);
|
||||
std::size_t hash2 = boost::hash<int>()((&t2)->int_value());
|
||||
boost::hash_combine(hash2, &t2);
|
||||
return hash1 < hash2;
|
||||
}
|
||||
|
||||
template<class Hooks, bool constant_time_size>
|
||||
bool priority_order(int t1, int t2)
|
||||
{
|
||||
std::size_t hash1 = boost::hash<int>()(t1);
|
||||
boost::hash_combine(hash1, &t1);
|
||||
std::size_t hash2 = boost::hash<int>()(t2);
|
||||
boost::hash_combine(hash2, &t2);
|
||||
return hash1 < hash2;
|
||||
}
|
||||
|
||||
template < typename Node_Algorithms, class Hooks>
|
||||
void swap_nodes(testvalue<Hooks>& lhs, testvalue<Hooks>& rhs)
|
||||
{
|
||||
lhs.swap_nodes(rhs);
|
||||
}
|
||||
|
||||
template<class Hooks>
|
||||
std::ostream& operator<<
|
||||
(std::ostream& s, const testvalue<Hooks, constant_time_size>& t)
|
||||
(std::ostream& s, const testvalue<Hooks>& t)
|
||||
{ return s << t.value_; }
|
||||
|
||||
struct even_odd
|
||||
{
|
||||
template < typename value_type_1, typename value_type_2 >
|
||||
template < typename key_type_1, typename key_type_2 >
|
||||
bool operator()
|
||||
(const value_type_1& v1
|
||||
,const value_type_2& v2) const
|
||||
(const key_type_1& v1
|
||||
,const key_type_2& v2) const
|
||||
{
|
||||
if (((&v1)->value_ & 1) == ((&v2)->value_ & 1))
|
||||
return (&v1)->value_ < (&v2)->value_;
|
||||
if (((&v1)->int_value() & 1) == ((&v2)->int_value() & 1))
|
||||
return (&v1)->int_value() < (&v2)->int_value();
|
||||
else
|
||||
return (&v2)->value_ & 1;
|
||||
return (&v2)->int_value() & 1;
|
||||
}
|
||||
};
|
||||
|
||||
struct is_even
|
||||
{
|
||||
template <typename value_type>
|
||||
template <typename key_type>
|
||||
bool operator()
|
||||
(const value_type& v1) const
|
||||
{ return ((&v1)->value_ & 1) == 0; }
|
||||
(const key_type& v1) const
|
||||
{ return ((&v1)->int_value() & 1) == 0; }
|
||||
};
|
||||
|
||||
struct is_odd
|
||||
{
|
||||
template <typename value_type>
|
||||
template <typename key_type>
|
||||
bool operator()
|
||||
(const value_type& v1) const
|
||||
{ return ((&v1)->value_ & 1) != 0; }
|
||||
(const key_type& v1) const
|
||||
{ return ((&v1)->int_value() & 1) != 0; }
|
||||
};
|
||||
|
||||
template <typename>
|
||||
struct Value_Container;
|
||||
struct ValueContainer;
|
||||
|
||||
template < class Hooks, bool ConstantTimeSize >
|
||||
struct Value_Container< testvalue< Hooks, ConstantTimeSize > >
|
||||
template < class Hooks>
|
||||
struct ValueContainer< testvalue<Hooks> >
|
||||
{
|
||||
typedef boost::container::vector< testvalue< Hooks, ConstantTimeSize > > type;
|
||||
typedef boost::container::vector< testvalue<Hooks> > type;
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
class pointer_holder
|
||||
template < typename Pointer >
|
||||
class heap_node_holder
|
||||
{
|
||||
typedef typename pointer_traits<Pointer>::element_type element_type;
|
||||
typedef Pointer pointer;
|
||||
typedef typename pointer_rebind<pointer, const element_type>::type const_pointer;
|
||||
|
||||
public:
|
||||
pointer_holder() : _ptr(new T())
|
||||
heap_node_holder()
|
||||
: m_ptr(pointer_traits<Pointer>::pointer_to(*new element_type))
|
||||
{}
|
||||
|
||||
~pointer_holder()
|
||||
{ delete _ptr; }
|
||||
~heap_node_holder()
|
||||
{ delete &*m_ptr; }
|
||||
|
||||
const T* get_node() const { return _ptr; }
|
||||
T* get_node() { return _ptr; }
|
||||
const_pointer get_node() const
|
||||
{ return m_ptr; }
|
||||
|
||||
pointer get_node()
|
||||
{ return m_ptr; }
|
||||
|
||||
private:
|
||||
T* const _ptr;
|
||||
pointer m_ptr;
|
||||
};
|
||||
|
||||
template<class Hooks>
|
||||
struct testvalue_traits
|
||||
: public Hooks
|
||||
{
|
||||
typedef testvalue< Hooks > value_type;
|
||||
|
||||
//base
|
||||
typedef typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename Hooks::base_hook_type
|
||||
>::type base_value_traits;
|
||||
//auto-base
|
||||
typedef typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename Hooks::auto_base_hook_type
|
||||
>::type auto_base_value_traits;
|
||||
//member
|
||||
typedef typename detail::get_member_value_traits
|
||||
< member_hook
|
||||
< value_type
|
||||
, typename Hooks::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type member_value_traits;
|
||||
//auto-member
|
||||
typedef typename detail::get_member_value_traits
|
||||
< member_hook
|
||||
< value_type
|
||||
, typename Hooks::auto_member_hook_type
|
||||
, &value_type::auto_node_
|
||||
>
|
||||
>::type auto_member_value_traits;
|
||||
//nonmember
|
||||
typedef nonhook_node_member_value_traits
|
||||
< value_type
|
||||
, typename Hooks::nonhook_node_member_type
|
||||
, &value_type::nhn_member_
|
||||
, safe_link
|
||||
> nonhook_value_traits;
|
||||
};
|
||||
|
||||
} //namespace boost{
|
||||
} //namespace intrusive{
|
||||
} //namespace boost{
|
||||
|
||||
bool priority_order(int t1, int t2)
|
||||
{
|
||||
std::size_t hash1 = boost::hash<int>()(t1);
|
||||
boost::hash_combine(hash1, &t1);
|
||||
std::size_t hash2 = boost::hash<int>()(t2);
|
||||
boost::hash_combine(hash2, &t2);
|
||||
return hash1 < hash2;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+60
-63
@@ -24,15 +24,13 @@
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
class my_tag;
|
||||
|
||||
template<class VoidPointer>
|
||||
struct hooks
|
||||
{
|
||||
typedef list_base_hook<void_pointer<VoidPointer> > base_hook_type;
|
||||
typedef list_base_hook< link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer>, tag<my_tag> > auto_base_hook_type;
|
||||
typedef list_member_hook<void_pointer<VoidPointer>, tag<my_tag> > member_hook_type;
|
||||
, void_pointer<VoidPointer>, tag<void> > auto_base_hook_type;
|
||||
typedef list_member_hook<void_pointer<VoidPointer>, tag<void> > member_hook_type;
|
||||
typedef list_member_hook< link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer> > auto_member_hook_type;
|
||||
typedef nonhook_node_member< list_node_traits< VoidPointer >,
|
||||
@@ -40,29 +38,29 @@ struct hooks
|
||||
};
|
||||
|
||||
|
||||
template < typename List_Type, typename Value_Container >
|
||||
template < typename ListType, typename ValueContainer >
|
||||
struct test_list
|
||||
{
|
||||
typedef List_Type list_type;
|
||||
typedef ListType list_type;
|
||||
typedef typename list_type::value_traits value_traits;
|
||||
typedef typename value_traits::value_type value_type;
|
||||
typedef typename list_type::node_algorithms node_algorithms;
|
||||
|
||||
static void test_all(Value_Container&);
|
||||
static void test_front_back(Value_Container&);
|
||||
static void test_sort(Value_Container&);
|
||||
static void test_merge(Value_Container&);
|
||||
static void test_remove_unique(Value_Container&);
|
||||
static void test_insert(Value_Container&);
|
||||
static void test_shift(Value_Container&);
|
||||
static void test_swap(Value_Container&);
|
||||
static void test_clone(Value_Container&);
|
||||
static void test_container_from_end(Value_Container&, detail::true_type);
|
||||
static void test_container_from_end(Value_Container&, detail::false_type) {}
|
||||
static void test_all(ValueContainer&);
|
||||
static void test_front_back(ValueContainer&);
|
||||
static void test_sort(ValueContainer&);
|
||||
static void test_merge(ValueContainer&);
|
||||
static void test_remove_unique(ValueContainer&);
|
||||
static void test_insert(ValueContainer&);
|
||||
static void test_shift(ValueContainer&);
|
||||
static void test_swap(ValueContainer&);
|
||||
static void test_clone(ValueContainer&);
|
||||
static void test_container_from_end(ValueContainer&, detail::true_type);
|
||||
static void test_container_from_end(ValueContainer&, detail::false_type) {}
|
||||
};
|
||||
|
||||
template < typename List_Type, typename Value_Container >
|
||||
void test_list< List_Type, Value_Container >::test_all(Value_Container& values)
|
||||
template < typename ListType, typename ValueContainer >
|
||||
void test_list< ListType, ValueContainer >::test_all(ValueContainer& values)
|
||||
{
|
||||
{
|
||||
list_type list(values.begin(), values.end());
|
||||
@@ -84,13 +82,13 @@ void test_list< List_Type, Value_Container >::test_all(Value_Container& values)
|
||||
test_shift(values);
|
||||
test_swap(values);
|
||||
test_clone(values);
|
||||
test_container_from_end(values, detail::bool_< List_Type::has_container_from_iterator >());
|
||||
test_container_from_end(values, detail::bool_< ListType::has_container_from_iterator >());
|
||||
}
|
||||
|
||||
//test: push_front, pop_front, push_back, pop_back, front, back, size, empty:
|
||||
template < class List_Type, typename Value_Container >
|
||||
void test_list< List_Type, Value_Container >
|
||||
::test_front_back(Value_Container& values)
|
||||
template < class ListType, typename ValueContainer >
|
||||
void test_list< ListType, ValueContainer >
|
||||
::test_front_back(ValueContainer& values)
|
||||
{
|
||||
list_type testlist;
|
||||
BOOST_TEST (testlist.empty());
|
||||
@@ -116,9 +114,9 @@ void test_list< List_Type, Value_Container >
|
||||
}
|
||||
|
||||
//test: constructor, iterator, reverse_iterator, sort, reverse:
|
||||
template < class List_Type, typename Value_Container >
|
||||
void test_list< List_Type, Value_Container >
|
||||
::test_sort(Value_Container& values)
|
||||
template < class ListType, typename ValueContainer >
|
||||
void test_list< ListType, ValueContainer >
|
||||
::test_sort(ValueContainer& values)
|
||||
{
|
||||
list_type testlist(values.begin(), values.end());
|
||||
|
||||
@@ -135,9 +133,9 @@ void test_list< List_Type, Value_Container >
|
||||
}
|
||||
|
||||
//test: merge due to error in merge implementation:
|
||||
template < class List_Type, typename Value_Container >
|
||||
void test_list< List_Type, Value_Container >
|
||||
::test_remove_unique (Value_Container& values)
|
||||
template < class ListType, typename ValueContainer >
|
||||
void test_list< ListType, ValueContainer >
|
||||
::test_remove_unique (ValueContainer& values)
|
||||
{
|
||||
{
|
||||
list_type list(values.begin(), values.end());
|
||||
@@ -164,7 +162,7 @@ void test_list< List_Type, Value_Container >
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, list.begin() );
|
||||
}
|
||||
{
|
||||
Value_Container values2(values);
|
||||
ValueContainer values2(values);
|
||||
list_type list(values.begin(), values.end());
|
||||
list.insert(list.end(), values2.begin(), values2.end());
|
||||
list.sort();
|
||||
@@ -177,9 +175,9 @@ void test_list< List_Type, Value_Container >
|
||||
}
|
||||
|
||||
//test: merge due to error in merge implementation:
|
||||
template < class List_Type, typename Value_Container >
|
||||
void test_list< List_Type, Value_Container >
|
||||
::test_merge (Value_Container& values)
|
||||
template < class ListType, typename ValueContainer >
|
||||
void test_list< ListType, ValueContainer >
|
||||
::test_merge (ValueContainer& values)
|
||||
{
|
||||
list_type testlist1, testlist2;
|
||||
testlist1.push_front (values[0]);
|
||||
@@ -193,9 +191,9 @@ void test_list< List_Type, Value_Container >
|
||||
}
|
||||
|
||||
//test: assign, insert, const_iterator, const_reverse_iterator, erase, s_iterator_to:
|
||||
template < class List_Type, typename Value_Container >
|
||||
void test_list< List_Type, Value_Container >
|
||||
::test_insert(Value_Container& values)
|
||||
template < class ListType, typename ValueContainer >
|
||||
void test_list< ListType, ValueContainer >
|
||||
::test_insert(ValueContainer& values)
|
||||
{
|
||||
list_type testlist;
|
||||
testlist.assign (values.begin() + 2, values.begin() + 5);
|
||||
@@ -236,9 +234,9 @@ void test_list< List_Type, Value_Container >
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, const_testlist.begin() ); }
|
||||
}
|
||||
|
||||
template < class List_Type, typename Value_Container >
|
||||
void test_list< List_Type, Value_Container >
|
||||
::test_shift(Value_Container& values)
|
||||
template < class ListType, typename ValueContainer >
|
||||
void test_list< ListType, ValueContainer >
|
||||
::test_shift(ValueContainer& values)
|
||||
{
|
||||
list_type testlist;
|
||||
const int num_values = (int)values.size();
|
||||
@@ -271,9 +269,9 @@ void test_list< List_Type, Value_Container >
|
||||
}
|
||||
|
||||
//test: insert (seq-version), swap, splice, erase (seq-version):
|
||||
template < class List_Type, typename Value_Container >
|
||||
void test_list< List_Type, Value_Container >
|
||||
::test_swap(Value_Container& values)
|
||||
template < class ListType, typename ValueContainer >
|
||||
void test_list< ListType, ValueContainer >
|
||||
::test_swap(ValueContainer& values)
|
||||
{
|
||||
{
|
||||
list_type testlist1 (values.begin(), values.begin() + 2);
|
||||
@@ -347,18 +345,18 @@ void test_list< List_Type, Value_Container >
|
||||
}
|
||||
}
|
||||
|
||||
template < class List_Type, typename Value_Container >
|
||||
void test_list< List_Type, Value_Container >
|
||||
::test_container_from_end(Value_Container& values, detail::true_type)
|
||||
template < class ListType, typename ValueContainer >
|
||||
void test_list< ListType, ValueContainer >
|
||||
::test_container_from_end(ValueContainer& values, detail::true_type)
|
||||
{
|
||||
list_type testlist1 (values.begin(), values.begin() + values.size());
|
||||
BOOST_TEST (testlist1 == list_type::container_from_end_iterator(testlist1.end()));
|
||||
BOOST_TEST (testlist1 == list_type::container_from_end_iterator(testlist1.cend()));
|
||||
}
|
||||
|
||||
template < class List_Type, typename Value_Container >
|
||||
void test_list< List_Type, Value_Container >
|
||||
::test_clone(Value_Container& values)
|
||||
template < class ListType, typename ValueContainer >
|
||||
void test_list< ListType, ValueContainer >
|
||||
::test_clone(ValueContainer& values)
|
||||
{
|
||||
list_type testlist1 (values.begin(), values.begin() + values.size());
|
||||
list_type testlist2;
|
||||
@@ -369,26 +367,26 @@ void test_list< List_Type, Value_Container >
|
||||
BOOST_TEST (testlist2.empty());
|
||||
}
|
||||
|
||||
template < typename Value_Traits, bool ConstantTimeSize, bool Default_Holder, typename Value_Container >
|
||||
template < typename ValueTraits, bool ConstantTimeSize, bool Default_Holder, typename ValueContainer >
|
||||
struct make_and_test_list
|
||||
: test_list< list< typename Value_Traits::value_type,
|
||||
value_traits< Value_Traits >,
|
||||
: test_list< list< typename ValueTraits::value_type,
|
||||
value_traits< ValueTraits >,
|
||||
size_type< std::size_t >,
|
||||
constant_time_size< ConstantTimeSize >
|
||||
>,
|
||||
Value_Container
|
||||
ValueContainer
|
||||
>
|
||||
{};
|
||||
|
||||
template < typename Value_Traits, bool ConstantTimeSize, typename Value_Container >
|
||||
struct make_and_test_list< Value_Traits, ConstantTimeSize, false, Value_Container >
|
||||
: test_list< list< typename Value_Traits::value_type,
|
||||
value_traits< Value_Traits >,
|
||||
template < typename ValueTraits, bool ConstantTimeSize, typename ValueContainer >
|
||||
struct make_and_test_list< ValueTraits, ConstantTimeSize, false, ValueContainer >
|
||||
: test_list< list< typename ValueTraits::value_type,
|
||||
value_traits< ValueTraits >,
|
||||
size_type< std::size_t >,
|
||||
constant_time_size< ConstantTimeSize >,
|
||||
header_holder_type< pointer_holder< typename Value_Traits::node_traits::node > >
|
||||
header_holder_type< heap_node_holder< typename ValueTraits::pointer > >
|
||||
>,
|
||||
Value_Container
|
||||
ValueContainer
|
||||
>
|
||||
{};
|
||||
|
||||
@@ -399,7 +397,7 @@ class test_main_template
|
||||
public:
|
||||
int operator()()
|
||||
{
|
||||
typedef testvalue<hooks<VoidPointer>, ConstantTimeSize> value_type;
|
||||
typedef testvalue< hooks<VoidPointer> > value_type;
|
||||
std::vector<value_type> data (5);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
data[i].value_ = i + 1;
|
||||
@@ -440,7 +438,7 @@ class test_main_template< VoidPointer, false, Default_Holder >
|
||||
public:
|
||||
int operator()()
|
||||
{
|
||||
typedef testvalue<hooks<VoidPointer>, false> value_type;
|
||||
typedef testvalue< hooks<VoidPointer> > value_type;
|
||||
std::vector<value_type> data (5);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
data[i].value_ = i + 1;
|
||||
@@ -503,7 +501,8 @@ struct test_main_template_bptr
|
||||
typedef typename list_value_traits::node_ptr node_ptr;
|
||||
typedef bounded_allocator< value_type > allocator_type;
|
||||
|
||||
allocator_type::init();
|
||||
bounded_allocator_scope<allocator_type> bounded_scope; (void)bounded_scope;
|
||||
|
||||
allocator_type allocator;
|
||||
|
||||
{
|
||||
@@ -525,8 +524,6 @@ struct test_main_template_bptr
|
||||
>::test_all(ref_cont);
|
||||
}
|
||||
|
||||
assert(allocator_type::is_clear());
|
||||
allocator_type::destroy();
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <boost/intrusive/avl_set.hpp>
|
||||
#include <boost/intrusive/sg_set.hpp>
|
||||
#include <boost/intrusive/splay_set.hpp>
|
||||
#include <boost/intrusive/bs_set.hpp>
|
||||
#include <boost/intrusive/treap_set.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
@@ -27,6 +28,7 @@ using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
struct my_tag2;
|
||||
struct my_tag3;
|
||||
|
||||
typedef make_bs_set_base_hook
|
||||
< void_pointer<smart_ptr<void> >, link_mode<normal_link>
|
||||
@@ -34,6 +36,9 @@ typedef make_bs_set_base_hook
|
||||
typedef make_bs_set_base_hook
|
||||
< void_pointer<smart_ptr<void> >, link_mode<normal_link>
|
||||
, tag<my_tag2> >::type SplayHook;
|
||||
typedef make_bs_set_base_hook
|
||||
< void_pointer<smart_ptr<void> >, link_mode<normal_link>
|
||||
, tag<my_tag3> >::type BsHook;
|
||||
|
||||
class MyClass
|
||||
: public make_list_base_hook
|
||||
@@ -50,6 +55,7 @@ class MyClass
|
||||
< void_pointer<smart_ptr<void> >, link_mode<normal_link> >::type
|
||||
, public TreapHook
|
||||
, public SplayHook
|
||||
, public BsHook
|
||||
{
|
||||
int int_;
|
||||
|
||||
@@ -83,6 +89,8 @@ typedef make_treap_set<MyClass
|
||||
, base_hook<TreapHook> >::type TreapSet;
|
||||
typedef make_splay_set<MyClass
|
||||
, base_hook<SplayHook> >::type SplaySet;
|
||||
typedef make_bs_set<MyClass
|
||||
, base_hook<BsHook> >::type BsSet;
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -103,6 +111,7 @@ int main()
|
||||
|
||||
AvlSet my_avlset;
|
||||
SplaySet my_splayset;
|
||||
BsSet my_bsset;
|
||||
SgSet my_sgset;
|
||||
TreapSet my_treapset;
|
||||
|
||||
@@ -114,6 +123,7 @@ int main()
|
||||
my_uset.insert(*it);
|
||||
my_avlset.insert(*it);
|
||||
my_splayset.insert(*it);
|
||||
my_bsset.insert(*it);
|
||||
my_sgset.insert(*it);
|
||||
my_treapset.insert(*it);
|
||||
}
|
||||
@@ -126,6 +136,7 @@ int main()
|
||||
|
||||
AvlSet::const_reverse_iterator avlset_rit(my_avlset.crbegin());
|
||||
SplaySet::const_reverse_iterator splayset_rit(my_splayset.crbegin());
|
||||
BsSet::const_reverse_iterator bsset_rit(my_bsset.crbegin());
|
||||
SgSet::const_reverse_iterator sgset_rit(my_sgset.crbegin());
|
||||
TreapSet::const_reverse_iterator treapset_rit(my_treapset.crbegin());
|
||||
|
||||
@@ -134,7 +145,7 @@ int main()
|
||||
//Test the objects inserted in the base hook list
|
||||
for( ; vect_it != vect_itend
|
||||
; ++vect_it, ++list_it, ++slist_it, ++set_rit
|
||||
, ++avlset_rit, ++splayset_rit, ++sgset_rit, ++treapset_rit
|
||||
, ++avlset_rit, ++splayset_rit, ++bsset_rit, ++sgset_rit, ++treapset_rit
|
||||
){
|
||||
if(&*list_it != &*vect_it) return 1;
|
||||
if(&*slist_it != &*vect_it) return 1;
|
||||
@@ -142,6 +153,7 @@ int main()
|
||||
if(my_uset.find(*set_rit) == my_uset.cend()) return 1;
|
||||
if(&*avlset_rit != &*vect_it) return 1;
|
||||
if(&*splayset_rit != &*vect_it) return 1;
|
||||
if(&*bsset_rit != &*vect_it) return 1;
|
||||
if(&*sgset_rit != &*vect_it) return 1;
|
||||
if(&*treapset_rit != &*vect_it) return 1;
|
||||
}
|
||||
|
||||
+90
-204
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2015.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -14,230 +14,116 @@
|
||||
#include "itestvalue.hpp"
|
||||
#include "bptr_value.hpp"
|
||||
#include "smart_ptr.hpp"
|
||||
#include "rb_test_common.hpp"
|
||||
#include "generic_multiset_test.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_insert_before<boost::intrusive::multiset<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
template<class VoidPointer>
|
||||
struct hooks
|
||||
template < class ValueTraits, bool ConstantTimeSize, bool DefaultHolder, bool Map >
|
||||
struct rebinder
|
||||
{
|
||||
typedef set_base_hook
|
||||
<void_pointer<VoidPointer> > base_hook_type;
|
||||
typedef set_base_hook
|
||||
<link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer>
|
||||
, tag<my_tag>
|
||||
, optimize_size<true> > auto_base_hook_type;
|
||||
typedef set_member_hook<void_pointer
|
||||
<VoidPointer>, optimize_size<true> > member_hook_type;
|
||||
typedef set_member_hook
|
||||
<link_mode<auto_unlink>, void_pointer<VoidPointer> > auto_member_hook_type;
|
||||
typedef nonhook_node_member< rbtree_node_traits <VoidPointer, false >,
|
||||
rbtree_algorithms
|
||||
> nonhook_node_member_type;
|
||||
typedef tree_rebinder_common<ValueTraits, DefaultHolder, Map> common_t;
|
||||
|
||||
template < class Option1 =void
|
||||
, class Option2 =void
|
||||
>
|
||||
struct container
|
||||
{
|
||||
typedef multiset
|
||||
< typename common_t::value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<ConstantTimeSize>
|
||||
, typename common_t::holder_opt
|
||||
, typename common_t::key_of_value_opt
|
||||
, Option1
|
||||
, Option2
|
||||
> type;
|
||||
BOOST_STATIC_ASSERT((key_type_tester<typename common_t::key_of_value_opt, type>::value));
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with void node allocator
|
||||
template < bool Default_Holder >
|
||||
struct GetContainer_With_Holder
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
typedef boost::intrusive::multiset
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with standard (non-void) node allocator
|
||||
template <>
|
||||
struct GetContainer_With_Holder< false >
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// extract node type through options->value_traits->node_traits->node
|
||||
typedef typename pack_options< rbtree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename detail::get_value_traits< ValueType, typename packed_options::proto_value_traits>::type value_traits;
|
||||
typedef typename value_traits::node_traits::node node;
|
||||
|
||||
typedef boost::intrusive::multiset
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
, header_holder_type< pointer_holder< node > >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template<class VoidPointer, bool constant_time_size, bool Default_Holder>
|
||||
template<class VoidPointer, bool ConstantTimeSize, bool DefaultHolder, bool Map>
|
||||
class test_main_template
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
static void execute()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , constant_time_size> value_type;
|
||||
|
||||
test::test_generic_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_multiset < nonhook_node_member_value_traits< value_type,
|
||||
typename hooks<VoidPointer>::nonhook_node_member_type,
|
||||
&value_type::nhn_member_,
|
||||
safe_link
|
||||
>,
|
||||
GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
return 0;
|
||||
typedef testvalue_traits< rb_hooks<VoidPointer> > testval_traits_t;
|
||||
//base
|
||||
typedef typename detail::if_c
|
||||
< ConstantTimeSize
|
||||
, typename testval_traits_t::base_value_traits
|
||||
, typename testval_traits_t::auto_base_value_traits
|
||||
>::type base_hook_t;
|
||||
test::test_generic_multiset
|
||||
< base_hook_t
|
||||
, rebinder<base_hook_t, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//member
|
||||
typedef typename detail::if_c
|
||||
< ConstantTimeSize
|
||||
, typename testval_traits_t::member_value_traits
|
||||
, typename testval_traits_t::auto_member_value_traits
|
||||
>::type member_hook_t;
|
||||
test::test_generic_multiset
|
||||
< member_hook_t
|
||||
, rebinder<member_hook_t, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//nonmember
|
||||
test::test_generic_multiset
|
||||
< typename testval_traits_t::nonhook_value_traits
|
||||
, rebinder<typename testval_traits_t::nonhook_value_traits, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool Default_Holder>
|
||||
class test_main_template<VoidPointer, false, Default_Holder>
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , false> value_type;
|
||||
|
||||
test::test_generic_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::auto_base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::auto_member_hook_type
|
||||
, &value_type::auto_node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
// container generator which ignores further parametrization, except for compare option
|
||||
template < typename Value_Traits, bool ConstantTimeSize, typename HeaderHolder >
|
||||
struct Get_Preset_Container
|
||||
{
|
||||
template < class
|
||||
, class Option1 = void
|
||||
, class Option2 = void
|
||||
, class Option3 = void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// ignore further paramatrization except for the compare option
|
||||
// notably ignore the size option (use preset)
|
||||
typedef typename pack_options< rbtree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename packed_options::compare compare_option;
|
||||
|
||||
typedef boost::intrusive::multiset< typename Value_Traits::value_type,
|
||||
value_traits< Value_Traits >,
|
||||
constant_time_size< ConstantTimeSize >,
|
||||
compare< compare_option >,
|
||||
header_holder_type< HeaderHolder >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template < bool ConstantTimeSize >
|
||||
template < bool ConstantTimeSize, bool Map >
|
||||
struct test_main_template_bptr
|
||||
{
|
||||
void operator () ()
|
||||
{
|
||||
typedef BPtr_Value value_type;
|
||||
typedef BPtr_Value_Traits< RBTree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< value_type > allocator_type;
|
||||
static void execute()
|
||||
{
|
||||
typedef BPtr_Value_Traits< RBTree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< BPtr_Value > allocator_type;
|
||||
|
||||
allocator_type::init();
|
||||
test::test_generic_multiset< value_traits,
|
||||
Get_Preset_Container< value_traits, ConstantTimeSize,
|
||||
bounded_pointer_holder< value_type > >::template GetContainer
|
||||
>::test_all();
|
||||
assert(allocator_type::is_clear());
|
||||
allocator_type::destroy();
|
||||
}
|
||||
bounded_allocator_scope<allocator_type> bounded_scope; (void)bounded_scope;
|
||||
test::test_generic_multiset
|
||||
< value_traits
|
||||
, rebinder< value_traits, ConstantTimeSize, true, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
// test (plain/smart pointers) x (nonconst/const size) x (void node allocator)
|
||||
test_main_template<void*, false, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, false, true>()();
|
||||
test_main_template<void*, true, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, true, true>()();
|
||||
// test (bounded pointers) x (nonconst/const size) x (special node allocator)
|
||||
test_main_template_bptr< true >()();
|
||||
test_main_template_bptr< false >()();
|
||||
//Combinations: VoidPointer x ConstantTimeSize x DefaultHolder x Map
|
||||
//Minimize them selecting different combinations for raw and smart pointers
|
||||
//Start with ('false', 'false', 'false') in sets and 'false', 'false', 'true' in multisets
|
||||
|
||||
//void pointer
|
||||
//test_main_template<void*, false, false, false>::execute();
|
||||
test_main_template<void*, false, false, true>::execute();
|
||||
//test_main_template<void*, false, true, false>::execute();
|
||||
test_main_template<void*, false, true, true>::execute();
|
||||
//test_main_template<void*, true, false, false>::execute();
|
||||
test_main_template<void*, true, false, true>::execute();
|
||||
//test_main_template<void*, true, true, false>::execute();
|
||||
test_main_template<void*, true, true, true>::execute();
|
||||
|
||||
//smart_ptr
|
||||
test_main_template<smart_ptr<void>, false, false, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, false, false, true>::execute();
|
||||
test_main_template<smart_ptr<void>, false, true, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, false, true, true>::execute();
|
||||
test_main_template<smart_ptr<void>, true, false, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, false, true>::execute();
|
||||
test_main_template<smart_ptr<void>, true, true, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, true, true>::execute();
|
||||
|
||||
//bounded_ptr (bool ConstantTimeSize, bool Map)
|
||||
//test_main_template_bptr< false, false >::execute();
|
||||
test_main_template_bptr< false, true >::execute();
|
||||
test_main_template_bptr< true, false >::execute();
|
||||
//test_main_template_bptr< true, true >::execute();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/intrusive/detail/to_raw_pointer.hpp>
|
||||
#include <boost/intrusive/detail/parent_from_member.hpp>
|
||||
|
||||
|
||||
namespace boost{
|
||||
|
||||
+90
-206
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2015.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -14,232 +14,116 @@
|
||||
#include "itestvalue.hpp"
|
||||
#include "bptr_value.hpp"
|
||||
#include "smart_ptr.hpp"
|
||||
#include "rb_test_common.hpp"
|
||||
#include "generic_set_test.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_insert_before<boost::intrusive::set<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
struct my_tag;
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
template<class VoidPointer>
|
||||
struct hooks
|
||||
template < class ValueTraits, bool ConstantTimeSize, bool DefaultHolder, bool Map >
|
||||
struct rebinder
|
||||
{
|
||||
typedef set_base_hook
|
||||
<void_pointer<VoidPointer> > base_hook_type;
|
||||
typedef set_base_hook
|
||||
<link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer>
|
||||
, tag<my_tag>
|
||||
, optimize_size<true> > auto_base_hook_type;
|
||||
typedef set_member_hook<void_pointer
|
||||
<VoidPointer>, optimize_size<true> > member_hook_type;
|
||||
typedef set_member_hook
|
||||
<link_mode<auto_unlink>, void_pointer<VoidPointer> > auto_member_hook_type;
|
||||
typedef nonhook_node_member< rbtree_node_traits <VoidPointer, false >,
|
||||
rbtree_algorithms
|
||||
> nonhook_node_member_type;
|
||||
typedef tree_rebinder_common<ValueTraits, DefaultHolder, Map> common_t;
|
||||
|
||||
template < class Option1 =void
|
||||
, class Option2 =void
|
||||
>
|
||||
struct container
|
||||
{
|
||||
typedef set
|
||||
< typename common_t::value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<ConstantTimeSize>
|
||||
, typename common_t::holder_opt
|
||||
, typename common_t::key_of_value_opt
|
||||
, Option1
|
||||
, Option2
|
||||
> type;
|
||||
BOOST_STATIC_ASSERT((key_type_tester<typename common_t::key_of_value_opt, type>::value));
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with void node allocator
|
||||
template < bool Default_Holder >
|
||||
struct GetContainer_With_Holder
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
typedef boost::intrusive::set
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with standard (non-void) node allocator
|
||||
template <>
|
||||
struct GetContainer_With_Holder< false >
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// extract node type through options->value_traits->node_traits->node
|
||||
typedef typename pack_options< rbtree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename detail::get_value_traits< ValueType, typename packed_options::proto_value_traits>::type value_traits;
|
||||
typedef typename value_traits::node_traits::node node;
|
||||
|
||||
typedef boost::intrusive::set
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
, header_holder_type< pointer_holder< node > >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template<class VoidPointer, bool constant_time_size, bool Default_Holder>
|
||||
template<class VoidPointer, bool ConstantTimeSize, bool DefaultHolder, bool Map>
|
||||
class test_main_template
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
static void execute()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , constant_time_size> value_type;
|
||||
|
||||
test::test_generic_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_set < nonhook_node_member_value_traits< value_type,
|
||||
typename hooks<VoidPointer>::nonhook_node_member_type,
|
||||
&value_type::nhn_member_,
|
||||
safe_link
|
||||
>,
|
||||
GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
return 0;
|
||||
typedef testvalue_traits< rb_hooks<VoidPointer> > testval_traits_t;
|
||||
//base
|
||||
typedef typename detail::if_c
|
||||
< ConstantTimeSize
|
||||
, typename testval_traits_t::base_value_traits
|
||||
, typename testval_traits_t::auto_base_value_traits
|
||||
>::type base_hook_t;
|
||||
test::test_generic_set
|
||||
< base_hook_t
|
||||
, rebinder<base_hook_t, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//member
|
||||
typedef typename detail::if_c
|
||||
< ConstantTimeSize
|
||||
, typename testval_traits_t::member_value_traits
|
||||
, typename testval_traits_t::auto_member_value_traits
|
||||
>::type member_hook_t;
|
||||
test::test_generic_set
|
||||
< member_hook_t
|
||||
, rebinder<member_hook_t, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//nonmember
|
||||
test::test_generic_set
|
||||
< typename testval_traits_t::nonhook_value_traits
|
||||
, rebinder<typename testval_traits_t::nonhook_value_traits, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool Default_Holder>
|
||||
class test_main_template<VoidPointer, false, Default_Holder>
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , false> value_type;
|
||||
|
||||
test::test_generic_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::auto_base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::auto_member_hook_type
|
||||
, &value_type::auto_node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
// container generator which ignores further parametrization, except for compare option
|
||||
template < typename Value_Traits, bool ConstantTimeSize, typename HeaderHolder >
|
||||
struct Get_Preset_Container
|
||||
{
|
||||
template < class
|
||||
, class Option1 = void
|
||||
, class Option2 = void
|
||||
, class Option3 = void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// ignore further paramatrization except for the compare option
|
||||
// notably ignore the size option (use preset)
|
||||
typedef typename pack_options< rbtree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename packed_options::compare compare_option;
|
||||
|
||||
typedef boost::intrusive::set< typename Value_Traits::value_type,
|
||||
value_traits< Value_Traits >,
|
||||
constant_time_size< ConstantTimeSize >,
|
||||
compare< compare_option >,
|
||||
header_holder_type< HeaderHolder >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template < bool ConstantTimeSize >
|
||||
template < bool ConstantTimeSize, bool Map >
|
||||
struct test_main_template_bptr
|
||||
{
|
||||
void operator () ()
|
||||
{
|
||||
typedef BPtr_Value value_type;
|
||||
typedef BPtr_Value_Traits< RBTree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< value_type > allocator_type;
|
||||
static void execute()
|
||||
{
|
||||
typedef BPtr_Value_Traits< RBTree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< BPtr_Value > allocator_type;
|
||||
|
||||
allocator_type::init();
|
||||
test::test_generic_set< value_traits,
|
||||
Get_Preset_Container< value_traits, ConstantTimeSize,
|
||||
bounded_pointer_holder< value_type >
|
||||
>::template GetContainer
|
||||
>::test_all();
|
||||
assert(allocator_type::is_clear());
|
||||
allocator_type::destroy();
|
||||
}
|
||||
bounded_allocator_scope<allocator_type> bounded_scope; (void)bounded_scope;
|
||||
test::test_generic_set
|
||||
< value_traits
|
||||
, rebinder< value_traits, ConstantTimeSize, true, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
// test (plain/smart pointers) x (nonconst/const size) x (void node allocator)
|
||||
test_main_template<void*, false, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, false, true>()();
|
||||
test_main_template<void*, true, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, true, true>()();
|
||||
// test (bounded pointers) x (nonconst/const size) x (special node allocator)
|
||||
test_main_template_bptr< true >()();
|
||||
test_main_template_bptr< false >()();
|
||||
//Combinations: VoidPointer x ConstantTimeSize x DefaultHolder x Map
|
||||
//Minimize them selecting different combinations for raw and smart pointers
|
||||
//Start with ('false', 'false', 'false') in sets and 'false', 'false', 'true' in multisets
|
||||
|
||||
//void pointer
|
||||
test_main_template<void*, false, false, false>::execute();
|
||||
//test_main_template<void*, false, false, true>::execute();
|
||||
test_main_template<void*, false, true, false>::execute();
|
||||
//test_main_template<void*, false, true, true>::execute();
|
||||
test_main_template<void*, true, false, false>::execute();
|
||||
//test_main_template<void*, true, false, true>::execute();
|
||||
test_main_template<void*, true, true, false>::execute();
|
||||
//test_main_template<void*, true, true, true>::execute();
|
||||
|
||||
//smart_ptr
|
||||
//test_main_template<smart_ptr<void>, false, false, false>::execute();
|
||||
test_main_template<smart_ptr<void>, false, false, true>::execute();
|
||||
//test_main_template<smart_ptr<void>, false, true, false>::execute();
|
||||
test_main_template<smart_ptr<void>, false, true, true>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, false, false>::execute();
|
||||
test_main_template<smart_ptr<void>, true, false, true>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, true, false>::execute();
|
||||
test_main_template<smart_ptr<void>, true, true, true>::execute();
|
||||
|
||||
//bounded_ptr (bool ConstantTimeSize, bool Map)
|
||||
test_main_template_bptr< false, false >::execute();
|
||||
//test_main_template_bptr< false, true >::execute();
|
||||
//test_main_template_bptr< true, false >::execute();
|
||||
test_main_template_bptr< true, true >::execute();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
+82
-262
@@ -1,7 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013.
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -14,287 +13,108 @@
|
||||
#include "itestvalue.hpp"
|
||||
#include "bptr_value.hpp"
|
||||
#include "smart_ptr.hpp"
|
||||
#include "bs_test_common.hpp"
|
||||
#include "generic_multiset_test.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_rebalance<boost::intrusive::sg_multiset<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_insert_before<boost::intrusive::sg_multiset<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
template<class VoidPointer>
|
||||
struct hooks
|
||||
template < class ValueTraits, bool FloatingPoint, bool DefaultHolder, bool Map >
|
||||
struct rebinder
|
||||
{
|
||||
typedef bs_set_base_hook<void_pointer<VoidPointer> > base_hook_type;
|
||||
typedef bs_set_member_hook<void_pointer<VoidPointer> > member_hook_type;
|
||||
typedef member_hook_type auto_member_hook_type;
|
||||
struct auto_base_hook_type
|
||||
: bs_set_base_hook<void_pointer<VoidPointer>, tag<my_tag> >
|
||||
{};
|
||||
typedef nonhook_node_member< tree_node_traits < VoidPointer >,
|
||||
sgtree_algorithms
|
||||
> nonhook_node_member_type;
|
||||
typedef tree_rebinder_common<ValueTraits, DefaultHolder, Map> common_t;
|
||||
|
||||
template < class Option1 =void
|
||||
, class Option2 =void
|
||||
>
|
||||
struct container
|
||||
{
|
||||
typedef sg_multiset
|
||||
< typename common_t::value_type
|
||||
, value_traits<ValueTraits>
|
||||
, floating_point<FloatingPoint>
|
||||
, typename common_t::holder_opt
|
||||
, typename common_t::key_of_value_opt
|
||||
, Option1
|
||||
, Option2
|
||||
> type;
|
||||
BOOST_STATIC_ASSERT((key_type_tester<typename common_t::key_of_value_opt, type>::value));
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
typedef boost::intrusive::sg_set
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
> type;
|
||||
};
|
||||
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainerFixedAlpha
|
||||
{
|
||||
typedef boost::intrusive::sg_set
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
, boost::intrusive::floating_point<false>
|
||||
> type;
|
||||
};
|
||||
|
||||
// container generator with void node allocator
|
||||
template < bool Default_Holder >
|
||||
struct GetContainer_With_Holder
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
typedef boost::intrusive::sg_multiset
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with standard (non-void) node allocator
|
||||
template <>
|
||||
struct GetContainer_With_Holder< false >
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// extract node type through options->value_traits->node_traits->node
|
||||
typedef typename pack_options< sgtree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename detail::get_value_traits< ValueType, typename packed_options::proto_value_traits>::type value_traits;
|
||||
typedef typename value_traits::node_traits::node node;
|
||||
|
||||
typedef boost::intrusive::sg_multiset
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
, header_holder_type< pointer_holder< node > >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with void node allocator
|
||||
template < bool Default_Holder >
|
||||
struct GetContainerFixedAlpha_With_Holder
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainerFixedAlpha
|
||||
{
|
||||
typedef boost::intrusive::sg_multiset
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with standard (non-void) node allocator
|
||||
template <>
|
||||
struct GetContainerFixedAlpha_With_Holder< false >
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainerFixedAlpha
|
||||
{
|
||||
// extract node type through options->value_traits->node_traits->node
|
||||
typedef typename pack_options< sgtree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename detail::get_value_traits< ValueType, typename packed_options::proto_value_traits>::type value_traits;
|
||||
typedef typename value_traits::node_traits::node node;
|
||||
|
||||
typedef boost::intrusive::sg_multiset
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
, boost::intrusive::floating_point<false>
|
||||
, header_holder_type< pointer_holder< node > >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template<class VoidPointer, bool Default_Holder>
|
||||
template<class VoidPointer, bool FloatingPoint, bool DefaultHolder, bool Map>
|
||||
class test_main_template
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
static void execute()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , true> value_type;
|
||||
|
||||
test::test_generic_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainerFixedAlpha_With_Holder< Default_Holder >::template GetContainerFixedAlpha
|
||||
>::test_all();
|
||||
test::test_generic_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainerFixedAlpha_With_Holder< Default_Holder >::template GetContainerFixedAlpha
|
||||
>::test_all();
|
||||
test::test_generic_multiset < nonhook_node_member_value_traits< value_type,
|
||||
typename hooks<VoidPointer>::nonhook_node_member_type,
|
||||
&value_type::nhn_member_,
|
||||
safe_link
|
||||
>,
|
||||
GetContainerFixedAlpha_With_Holder< Default_Holder >::template GetContainerFixedAlpha
|
||||
>::test_all();
|
||||
return 0;
|
||||
typedef testvalue_traits< bs_hooks<VoidPointer> > testval_traits_t;
|
||||
//base
|
||||
typedef typename testval_traits_t::base_value_traits base_hook_t;
|
||||
test::test_generic_multiset
|
||||
< base_hook_t
|
||||
, rebinder<base_hook_t, FloatingPoint, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//member
|
||||
typedef typename testval_traits_t::member_value_traits member_hook_t;
|
||||
test::test_generic_multiset
|
||||
< member_hook_t
|
||||
, rebinder<member_hook_t, FloatingPoint, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//nonmember
|
||||
test::test_generic_multiset
|
||||
< typename testval_traits_t::nonhook_value_traits
|
||||
, rebinder<typename testval_traits_t::nonhook_value_traits, FloatingPoint, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
// container generator which ignores further parametrization, except for compare option
|
||||
template < typename Value_Traits, bool ConstantTimeSize, typename HeaderHolder >
|
||||
struct Get_Preset_Container
|
||||
{
|
||||
template < class
|
||||
, class Option1 = void
|
||||
, class Option2 = void
|
||||
, class Option3 = void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// ignore further paramatrization except for the compare option
|
||||
// notably ignore the size option (use preset)
|
||||
typedef typename pack_options< sgtree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename packed_options::compare compare_option;
|
||||
|
||||
typedef boost::intrusive::sg_multiset< typename Value_Traits::value_type,
|
||||
value_traits< Value_Traits >,
|
||||
constant_time_size< ConstantTimeSize >,
|
||||
compare< compare_option >,
|
||||
header_holder_type< HeaderHolder >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template < bool FloatingPoint, bool Map >
|
||||
struct test_main_template_bptr
|
||||
{
|
||||
void operator () ()
|
||||
{
|
||||
typedef BPtr_Value value_type;
|
||||
typedef BPtr_Value_Traits< Tree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< value_type > allocator_type;
|
||||
static void execute()
|
||||
{
|
||||
typedef BPtr_Value_Traits< Tree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< BPtr_Value > allocator_type;
|
||||
|
||||
allocator_type::init();
|
||||
test::test_generic_multiset< value_traits,
|
||||
Get_Preset_Container< value_traits, true,
|
||||
bounded_pointer_holder< value_type > >::GetContainer
|
||||
>::test_all();
|
||||
assert(allocator_type::is_clear());
|
||||
allocator_type::destroy();
|
||||
}
|
||||
bounded_allocator_scope<allocator_type> bounded_scope; (void)bounded_scope;
|
||||
test::test_generic_multiset
|
||||
< value_traits
|
||||
, rebinder< value_traits, FloatingPoint, true, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
// test (plain/smart pointers) x (const size) x (void node allocator)
|
||||
test_main_template<void*, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, true >()();
|
||||
// test (bounded pointers) x (nonconst/const size) x (special node allocator)
|
||||
test_main_template_bptr()();
|
||||
//Combinations: VoidPointer x FloatingPoint x DefaultHolder x Map
|
||||
//Minimize them selecting different combinations for raw and smart pointers
|
||||
//Start with ('false', 'false', 'false') in sets and 'false', 'false', 'true' in multisets
|
||||
|
||||
//void pointer
|
||||
//test_main_template<void*, false, false, false>::execute();
|
||||
test_main_template<void*, false, false, true>::execute();
|
||||
//test_main_template<void*, false, true, false>::execute();
|
||||
test_main_template<void*, false, true, true>::execute();
|
||||
//test_main_template<void*, true, false, false>::execute();
|
||||
test_main_template<void*, true, false, true>::execute();
|
||||
//test_main_template<void*, true, true, false>::execute();
|
||||
test_main_template<void*, true, true, true>::execute();
|
||||
|
||||
//smart_ptr
|
||||
test_main_template<smart_ptr<void>, false, false, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, false, false, true>::execute();
|
||||
test_main_template<smart_ptr<void>, false, true, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, false, true, true>::execute();
|
||||
test_main_template<smart_ptr<void>, true, false, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, false, true>::execute();
|
||||
test_main_template<smart_ptr<void>, true, true, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, true, true>::execute();
|
||||
|
||||
//bounded_ptr (bool FloatingPoint, bool Map)
|
||||
//test_main_template_bptr< false, false >::execute();
|
||||
test_main_template_bptr< false, true >::execute();
|
||||
test_main_template_bptr< true, false >::execute();
|
||||
//test_main_template_bptr< true, true >::execute();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
+81
-261
@@ -13,288 +13,108 @@
|
||||
#include "itestvalue.hpp"
|
||||
#include "bptr_value.hpp"
|
||||
#include "smart_ptr.hpp"
|
||||
#include "bs_test_common.hpp"
|
||||
#include "generic_set_test.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_rebalance<boost::intrusive::sg_set<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_insert_before<boost::intrusive::sg_set<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
template<class VoidPointer>
|
||||
struct hooks
|
||||
template < class ValueTraits, bool FloatingPoint, bool DefaultHolder, bool Map >
|
||||
struct rebinder
|
||||
{
|
||||
typedef bs_set_base_hook<void_pointer<VoidPointer> > base_hook_type;
|
||||
typedef bs_set_member_hook<void_pointer<VoidPointer> > member_hook_type;
|
||||
typedef member_hook_type auto_member_hook_type;
|
||||
struct auto_base_hook_type
|
||||
: bs_set_base_hook<void_pointer<VoidPointer>, tag<my_tag> >
|
||||
{};
|
||||
typedef nonhook_node_member< tree_node_traits < VoidPointer >,
|
||||
sgtree_algorithms
|
||||
> nonhook_node_member_type;
|
||||
typedef tree_rebinder_common<ValueTraits, DefaultHolder, Map> common_t;
|
||||
|
||||
template < class Option1 =void
|
||||
, class Option2 =void
|
||||
>
|
||||
struct container
|
||||
{
|
||||
typedef sg_set
|
||||
< typename common_t::value_type
|
||||
, value_traits<ValueTraits>
|
||||
, floating_point<FloatingPoint>
|
||||
, typename common_t::holder_opt
|
||||
, typename common_t::key_of_value_opt
|
||||
, Option1
|
||||
, Option2
|
||||
> type;
|
||||
BOOST_STATIC_ASSERT((key_type_tester<typename common_t::key_of_value_opt, type>::value));
|
||||
};
|
||||
};
|
||||
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
typedef boost::intrusive::sg_set
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
> type;
|
||||
};
|
||||
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainerFixedAlpha
|
||||
{
|
||||
typedef boost::intrusive::sg_set
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
, boost::intrusive::floating_point<false>
|
||||
> type;
|
||||
};
|
||||
|
||||
// container generator with void node allocator
|
||||
template < bool Default_Holder >
|
||||
struct GetContainer_With_Holder
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
typedef boost::intrusive::sg_set
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with standard (non-void) node allocator
|
||||
template <>
|
||||
struct GetContainer_With_Holder< false >
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// extract node type through options->value_traits->node_traits->node
|
||||
typedef typename pack_options< sgtree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename detail::get_value_traits< ValueType, typename packed_options::proto_value_traits>::type value_traits;
|
||||
typedef typename value_traits::node_traits::node node;
|
||||
|
||||
typedef boost::intrusive::sg_set
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
, header_holder_type< pointer_holder< node > >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with void node allocator
|
||||
template < bool Default_Holder >
|
||||
struct GetContainerFixedAlpha_With_Holder
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainerFixedAlpha
|
||||
{
|
||||
typedef boost::intrusive::sg_set
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with standard (non-void) node allocator
|
||||
template <>
|
||||
struct GetContainerFixedAlpha_With_Holder< false >
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainerFixedAlpha
|
||||
{
|
||||
// extract node type through options->value_traits->node_traits->node
|
||||
typedef typename pack_options< sgtree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename detail::get_value_traits< ValueType, typename packed_options::proto_value_traits>::type value_traits;
|
||||
typedef typename value_traits::node_traits::node node;
|
||||
|
||||
typedef boost::intrusive::sg_set
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
, boost::intrusive::floating_point<false>
|
||||
, header_holder_type< pointer_holder< node > >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool Default_Holder>
|
||||
template<class VoidPointer, bool FloatingPoint, bool DefaultHolder, bool Map>
|
||||
class test_main_template
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
static void execute()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , true> value_type;
|
||||
|
||||
test::test_generic_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainerFixedAlpha_With_Holder< Default_Holder >::template GetContainerFixedAlpha
|
||||
>::test_all();
|
||||
test::test_generic_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainerFixedAlpha_With_Holder< Default_Holder >::template GetContainerFixedAlpha
|
||||
>::test_all();
|
||||
test::test_generic_set < nonhook_node_member_value_traits< value_type,
|
||||
typename hooks<VoidPointer>::nonhook_node_member_type,
|
||||
&value_type::nhn_member_,
|
||||
safe_link
|
||||
>,
|
||||
GetContainerFixedAlpha_With_Holder< Default_Holder >::template GetContainerFixedAlpha
|
||||
>::test_all();
|
||||
return 0;
|
||||
typedef testvalue_traits< bs_hooks<VoidPointer> > testval_traits_t;
|
||||
//base
|
||||
typedef typename testval_traits_t::base_value_traits base_hook_t;
|
||||
test::test_generic_set
|
||||
< base_hook_t
|
||||
, rebinder<base_hook_t, FloatingPoint, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//member
|
||||
typedef typename testval_traits_t::member_value_traits member_hook_t;
|
||||
test::test_generic_set
|
||||
< member_hook_t
|
||||
, rebinder<member_hook_t, FloatingPoint, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//nonmember
|
||||
test::test_generic_set
|
||||
< typename testval_traits_t::nonhook_value_traits
|
||||
, rebinder<typename testval_traits_t::nonhook_value_traits, FloatingPoint, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
// container generator which ignores further parametrization, except for compare option
|
||||
template < typename Value_Traits, bool ConstantTimeSize, typename HeaderHolder >
|
||||
struct Get_Preset_Container
|
||||
{
|
||||
template < class
|
||||
, class Option1 = void
|
||||
, class Option2 = void
|
||||
, class Option3 = void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// ignore further paramatrization except for the compare option
|
||||
// notably ignore the size option (use preset)
|
||||
typedef typename pack_options< sgtree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename packed_options::compare compare_option;
|
||||
|
||||
typedef boost::intrusive::sg_set< typename Value_Traits::value_type,
|
||||
value_traits< Value_Traits >,
|
||||
constant_time_size< ConstantTimeSize >,
|
||||
compare< compare_option >,
|
||||
header_holder_type< HeaderHolder >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template < bool FloatingPoint, bool Map >
|
||||
struct test_main_template_bptr
|
||||
{
|
||||
void operator () ()
|
||||
{
|
||||
typedef BPtr_Value value_type;
|
||||
typedef BPtr_Value_Traits< Tree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< value_type > allocator_type;
|
||||
static void execute()
|
||||
{
|
||||
typedef BPtr_Value_Traits< Tree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< BPtr_Value > allocator_type;
|
||||
|
||||
allocator_type::init();
|
||||
test::test_generic_set< value_traits,
|
||||
Get_Preset_Container< value_traits, true,
|
||||
bounded_pointer_holder< value_type > >::GetContainer
|
||||
>::test_all();
|
||||
assert(allocator_type::is_clear());
|
||||
allocator_type::destroy();
|
||||
}
|
||||
bounded_allocator_scope<allocator_type> bounded_scope; (void)bounded_scope;
|
||||
test::test_generic_set
|
||||
< value_traits
|
||||
, rebinder< value_traits, FloatingPoint, true, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
// test (plain/smart pointers) x (const size) x (void node allocator)
|
||||
test_main_template<void*, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, true >()();
|
||||
// test (plain pointers) x (const size) x (standard node allocator)
|
||||
test_main_template<void*, false>()();
|
||||
// test (bounded pointers) x (nonconst/const size) x (special node allocator)
|
||||
test_main_template_bptr()();
|
||||
//Combinations: VoidPointer x FloatingPoint x DefaultHolder x Map
|
||||
//Minimize them selecting different combinations for raw and smart pointers
|
||||
//Start with ('false', 'false', 'false') in sets and 'false', 'false', 'true' in multisets
|
||||
|
||||
//void pointer
|
||||
test_main_template<void*, false, false, false>::execute();
|
||||
//test_main_template<void*, false, false, true>::execute();
|
||||
test_main_template<void*, false, true, false>::execute();
|
||||
//test_main_template<void*, false, true, true>::execute();
|
||||
test_main_template<void*, true, false, false>::execute();
|
||||
//test_main_template<void*, true, false, true>::execute();
|
||||
test_main_template<void*, true, true, false>::execute();
|
||||
//test_main_template<void*, true, true, true>::execute();
|
||||
|
||||
//smart_ptr
|
||||
//test_main_template<smart_ptr<void>, false, false, false>::execute();
|
||||
test_main_template<smart_ptr<void>, false, false, true>::execute();
|
||||
//test_main_template<smart_ptr<void>, false, true, false>::execute();
|
||||
test_main_template<smart_ptr<void>, false, true, true>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, false, false>::execute();
|
||||
test_main_template<smart_ptr<void>, true, false, true>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, true, false>::execute();
|
||||
test_main_template<smart_ptr<void>, true, true, true>::execute();
|
||||
|
||||
//bounded_ptr (bool FloatingPoint, bool Map)
|
||||
test_main_template_bptr< false, false >::execute();
|
||||
//test_main_template_bptr< false, true >::execute();
|
||||
//test_main_template_bptr< true, false >::execute();
|
||||
test_main_template_bptr< true, true >::execute();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
+68
-73
@@ -25,15 +25,13 @@
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
template<class VoidPointer>
|
||||
struct hooks
|
||||
{
|
||||
typedef slist_base_hook<void_pointer<VoidPointer> > base_hook_type;
|
||||
typedef slist_base_hook< link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer>, tag<my_tag> > auto_base_hook_type;
|
||||
typedef slist_member_hook<void_pointer<VoidPointer>, tag<my_tag> > member_hook_type;
|
||||
, void_pointer<VoidPointer>, tag<void> > auto_base_hook_type;
|
||||
typedef slist_member_hook<void_pointer<VoidPointer>, tag<void> > member_hook_type;
|
||||
typedef slist_member_hook< link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer> > auto_member_hook_type;
|
||||
typedef nonhook_node_member< slist_node_traits< VoidPointer >,
|
||||
@@ -41,33 +39,33 @@ struct hooks
|
||||
> nonhook_node_member_type;
|
||||
};
|
||||
|
||||
template < typename List_Type, typename Value_Container >
|
||||
template < typename ListType, typename ValueContainer >
|
||||
struct test_slist
|
||||
{
|
||||
typedef List_Type list_type;
|
||||
typedef ListType list_type;
|
||||
typedef typename list_type::value_traits value_traits;
|
||||
typedef typename value_traits::value_type value_type;
|
||||
typedef typename list_type::node_algorithms node_algorithms;
|
||||
|
||||
static void test_all(Value_Container&);
|
||||
static void test_front(Value_Container&);
|
||||
static void test_back(Value_Container&, detail::true_type);
|
||||
static void test_back(Value_Container&, detail::false_type) {}
|
||||
static void test_sort(Value_Container&);
|
||||
static void test_merge(Value_Container&);
|
||||
static void test_remove_unique(Value_Container&);
|
||||
static void test_insert(Value_Container&);
|
||||
static void test_shift(Value_Container&);
|
||||
static void test_swap(Value_Container&);
|
||||
static void test_slow_insert(Value_Container&);
|
||||
static void test_clone(Value_Container&);
|
||||
static void test_container_from_end(Value_Container&, detail::true_type);
|
||||
static void test_container_from_end(Value_Container&, detail::false_type) {}
|
||||
static void test_all(ValueContainer&);
|
||||
static void test_front(ValueContainer&);
|
||||
static void test_back(ValueContainer&, detail::true_type);
|
||||
static void test_back(ValueContainer&, detail::false_type) {}
|
||||
static void test_sort(ValueContainer&);
|
||||
static void test_merge(ValueContainer&);
|
||||
static void test_remove_unique(ValueContainer&);
|
||||
static void test_insert(ValueContainer&);
|
||||
static void test_shift(ValueContainer&);
|
||||
static void test_swap(ValueContainer&);
|
||||
static void test_slow_insert(ValueContainer&);
|
||||
static void test_clone(ValueContainer&);
|
||||
static void test_container_from_end(ValueContainer&, detail::true_type);
|
||||
static void test_container_from_end(ValueContainer&, detail::false_type) {}
|
||||
};
|
||||
|
||||
template < typename List_Type, typename Value_Container >
|
||||
void test_slist< List_Type, Value_Container >
|
||||
::test_all (Value_Container& values)
|
||||
template < typename ListType, typename ValueContainer >
|
||||
void test_slist< ListType, ValueContainer >
|
||||
::test_all (ValueContainer& values)
|
||||
{
|
||||
{
|
||||
list_type list(values.begin(), values.end());
|
||||
@@ -94,9 +92,9 @@ void test_slist< List_Type, Value_Container >
|
||||
}
|
||||
|
||||
//test: push_front, pop_front, front, size, empty:
|
||||
template < typename List_Type, typename Value_Container >
|
||||
void test_slist< List_Type, Value_Container >
|
||||
::test_front(Value_Container& values)
|
||||
template < typename ListType, typename ValueContainer >
|
||||
void test_slist< ListType, ValueContainer >
|
||||
::test_front(ValueContainer& values)
|
||||
{
|
||||
list_type testlist;
|
||||
BOOST_TEST (testlist.empty());
|
||||
@@ -118,9 +116,9 @@ void test_slist< List_Type, Value_Container >
|
||||
}
|
||||
|
||||
//test: push_front, pop_front, front, size, empty:
|
||||
template < typename List_Type, typename Value_Container >
|
||||
void test_slist< List_Type, Value_Container >
|
||||
::test_back(Value_Container& values, detail::true_type)
|
||||
template < typename ListType, typename ValueContainer >
|
||||
void test_slist< ListType, ValueContainer >
|
||||
::test_back(ValueContainer& values, detail::true_type)
|
||||
{
|
||||
list_type testlist;
|
||||
BOOST_TEST (testlist.empty());
|
||||
@@ -136,9 +134,9 @@ void test_slist< List_Type, Value_Container >
|
||||
}
|
||||
|
||||
//test: merge due to error in merge implementation:
|
||||
template < typename List_Type, typename Value_Container >
|
||||
void test_slist< List_Type, Value_Container >
|
||||
::test_merge (Value_Container& values)
|
||||
template < typename ListType, typename ValueContainer >
|
||||
void test_slist< ListType, ValueContainer >
|
||||
::test_merge (ValueContainer& values)
|
||||
{
|
||||
list_type testlist1, testlist2;
|
||||
testlist1.push_front (values[0]);
|
||||
@@ -152,9 +150,9 @@ void test_slist< List_Type, Value_Container >
|
||||
}
|
||||
|
||||
//test: merge due to error in merge implementation:
|
||||
template < typename List_Type, typename Value_Container >
|
||||
void test_slist< List_Type, Value_Container >
|
||||
::test_remove_unique (Value_Container& values)
|
||||
template < typename ListType, typename ValueContainer >
|
||||
void test_slist< ListType, ValueContainer >
|
||||
::test_remove_unique (ValueContainer& values)
|
||||
{
|
||||
{
|
||||
list_type list(values.begin(), values.end());
|
||||
@@ -181,7 +179,7 @@ void test_slist< List_Type, Value_Container >
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, list.begin() );
|
||||
}
|
||||
{
|
||||
Value_Container values2(values);
|
||||
ValueContainer values2(values);
|
||||
list_type list(values.begin(), values.end());
|
||||
list.insert_after(list.before_begin(), values2.begin(), values2.end());
|
||||
list.sort();
|
||||
@@ -194,9 +192,9 @@ void test_slist< List_Type, Value_Container >
|
||||
}
|
||||
|
||||
//test: constructor, iterator, sort, reverse:
|
||||
template < typename List_Type, typename Value_Container >
|
||||
void test_slist< List_Type, Value_Container >
|
||||
::test_sort(Value_Container& values)
|
||||
template < typename ListType, typename ValueContainer >
|
||||
void test_slist< ListType, ValueContainer >
|
||||
::test_sort(ValueContainer& values)
|
||||
{
|
||||
list_type testlist (values.begin(), values.end());
|
||||
|
||||
@@ -213,9 +211,9 @@ void test_slist< List_Type, Value_Container >
|
||||
}
|
||||
|
||||
//test: assign, insert_after, const_iterator, erase_after, s_iterator_to, previous:
|
||||
template < typename List_Type, typename Value_Container >
|
||||
void test_slist< List_Type, Value_Container >
|
||||
::test_insert(Value_Container& values)
|
||||
template < typename ListType, typename ValueContainer >
|
||||
void test_slist< ListType, ValueContainer >
|
||||
::test_insert(ValueContainer& values)
|
||||
{
|
||||
list_type testlist;
|
||||
testlist.assign (values.begin() + 2, values.begin() + 5);
|
||||
@@ -252,9 +250,9 @@ void test_slist< List_Type, Value_Container >
|
||||
}
|
||||
|
||||
//test: insert, const_iterator, erase, siterator_to:
|
||||
template < typename List_Type, typename Value_Container >
|
||||
void test_slist< List_Type, Value_Container >
|
||||
::test_slow_insert (Value_Container& values)
|
||||
template < typename ListType, typename ValueContainer >
|
||||
void test_slist< ListType, ValueContainer >
|
||||
::test_slow_insert (ValueContainer& values)
|
||||
{
|
||||
list_type testlist;
|
||||
testlist.push_front (values[4]);
|
||||
@@ -288,9 +286,9 @@ void test_slist< List_Type, Value_Container >
|
||||
BOOST_TEST (testlist.begin()->value_ == 3);
|
||||
}
|
||||
|
||||
template < typename List_Type, typename Value_Container >
|
||||
void test_slist< List_Type, Value_Container >
|
||||
::test_shift(Value_Container& values)
|
||||
template < typename ListType, typename ValueContainer >
|
||||
void test_slist< ListType, ValueContainer >
|
||||
::test_shift(ValueContainer& values)
|
||||
{
|
||||
list_type testlist;
|
||||
const int num_values = (int)values.size();
|
||||
@@ -325,9 +323,9 @@ void test_slist< List_Type, Value_Container >
|
||||
}
|
||||
|
||||
//test: insert_after (seq-version), swap, splice_after:
|
||||
template < typename List_Type, typename Value_Container >
|
||||
void test_slist< List_Type, Value_Container >
|
||||
::test_swap(Value_Container& values)
|
||||
template < typename ListType, typename ValueContainer >
|
||||
void test_slist< ListType, ValueContainer >
|
||||
::test_swap(ValueContainer& values)
|
||||
{
|
||||
{
|
||||
list_type testlist1 (values.begin(), values.begin() + 2);
|
||||
@@ -426,9 +424,9 @@ void test_slist< List_Type, Value_Container >
|
||||
}
|
||||
}
|
||||
|
||||
template < typename List_Type, typename Value_Container >
|
||||
void test_slist< List_Type, Value_Container >
|
||||
::test_clone(Value_Container& values)
|
||||
template < typename ListType, typename ValueContainer >
|
||||
void test_slist< ListType, ValueContainer >
|
||||
::test_clone(ValueContainer& values)
|
||||
{
|
||||
list_type testlist1 (values.begin(), values.begin() + values.size());
|
||||
list_type testlist2;
|
||||
@@ -439,39 +437,39 @@ void test_slist< List_Type, Value_Container >
|
||||
BOOST_TEST (testlist2.empty());
|
||||
}
|
||||
|
||||
template < typename List_Type, typename Value_Container >
|
||||
void test_slist< List_Type, Value_Container >
|
||||
::test_container_from_end(Value_Container& values, detail::true_type)
|
||||
template < typename ListType, typename ValueContainer >
|
||||
void test_slist< ListType, ValueContainer >
|
||||
::test_container_from_end(ValueContainer& values, detail::true_type)
|
||||
{
|
||||
list_type testlist1 (values.begin(), values.begin() + values.size());
|
||||
BOOST_TEST (testlist1 == list_type::container_from_end_iterator(testlist1.end()));
|
||||
BOOST_TEST (testlist1 == list_type::container_from_end_iterator(testlist1.cend()));
|
||||
}
|
||||
|
||||
template < typename Value_Traits, bool ConstantTimeSize, bool Linear, bool CacheLast, bool Default_Holder, typename Value_Container >
|
||||
template < typename ValueTraits, bool ConstantTimeSize, bool Linear, bool CacheLast, bool Default_Holder, typename ValueContainer >
|
||||
struct make_and_test_slist
|
||||
: test_slist< slist< typename Value_Traits::value_type,
|
||||
value_traits< Value_Traits >,
|
||||
: test_slist< slist< typename ValueTraits::value_type,
|
||||
value_traits< ValueTraits >,
|
||||
size_type< std::size_t >,
|
||||
constant_time_size< ConstantTimeSize >,
|
||||
linear<Linear>,
|
||||
cache_last<CacheLast>
|
||||
>,
|
||||
Value_Container
|
||||
ValueContainer
|
||||
>
|
||||
{};
|
||||
|
||||
template < typename Value_Traits, bool ConstantTimeSize, bool Linear, bool CacheLast, typename Value_Container >
|
||||
struct make_and_test_slist< Value_Traits, ConstantTimeSize, Linear, CacheLast, false, Value_Container >
|
||||
: test_slist< slist< typename Value_Traits::value_type,
|
||||
value_traits< Value_Traits >,
|
||||
template < typename ValueTraits, bool ConstantTimeSize, bool Linear, bool CacheLast, typename ValueContainer >
|
||||
struct make_and_test_slist< ValueTraits, ConstantTimeSize, Linear, CacheLast, false, ValueContainer >
|
||||
: test_slist< slist< typename ValueTraits::value_type,
|
||||
value_traits< ValueTraits >,
|
||||
size_type< std::size_t >,
|
||||
constant_time_size< ConstantTimeSize >,
|
||||
linear<Linear>,
|
||||
cache_last<CacheLast>,
|
||||
header_holder_type< pointer_holder< typename Value_Traits::node_traits::node > >
|
||||
header_holder_type< heap_node_holder< typename ValueTraits::pointer > >
|
||||
>,
|
||||
Value_Container
|
||||
ValueContainer
|
||||
>
|
||||
{};
|
||||
|
||||
@@ -481,7 +479,7 @@ class test_main_template
|
||||
public:
|
||||
int operator()()
|
||||
{
|
||||
typedef testvalue<hooks<VoidPointer> , constant_time_size> value_type;
|
||||
typedef testvalue< hooks<VoidPointer> > value_type;
|
||||
std::vector< value_type > data (5);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
data[i].value_ = i + 1;
|
||||
@@ -603,7 +601,7 @@ class test_main_template<VoidPointer, false, Default_Holder>
|
||||
public:
|
||||
int operator()()
|
||||
{
|
||||
typedef testvalue<hooks<VoidPointer> , false> value_type;
|
||||
typedef testvalue< hooks<VoidPointer> > value_type;
|
||||
std::vector< value_type > data (5);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
data[i].value_ = i + 1;
|
||||
@@ -742,7 +740,7 @@ struct test_main_template_bptr
|
||||
typedef typename list_value_traits::node_ptr node_ptr;
|
||||
typedef bounded_allocator< value_type > allocator_type;
|
||||
|
||||
allocator_type::init();
|
||||
bounded_allocator_scope<allocator_type> bounded_scope; (void)bounded_scope;
|
||||
allocator_type allocator;
|
||||
|
||||
{
|
||||
@@ -763,9 +761,6 @@ struct test_main_template_bptr
|
||||
bounded_reference_cont< value_type >
|
||||
>::test_all(ref_cont);
|
||||
}
|
||||
|
||||
assert(allocator_type::is_clear());
|
||||
allocator_type::destroy();
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
+82
-237
@@ -1,7 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013.
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -11,265 +10,111 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/intrusive/splay_set.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include "itestvalue.hpp"
|
||||
#include "bptr_value.hpp"
|
||||
#include "smart_ptr.hpp"
|
||||
#include "bs_test_common.hpp"
|
||||
#include "generic_multiset_test.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_splay<boost::intrusive::splay_multiset<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_rebalance<boost::intrusive::splay_multiset<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_const_searches<boost::intrusive::splay_multiset<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
|
||||
}}}
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
template<class VoidPointer>
|
||||
struct hooks
|
||||
template < class ValueTraits, bool ConstantTimeSize, bool DefaultHolder, bool Map >
|
||||
struct rebinder
|
||||
{
|
||||
typedef bs_set_base_hook<void_pointer<VoidPointer> > base_hook_type;
|
||||
typedef bs_set_base_hook
|
||||
< link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer>
|
||||
, tag<my_tag> > auto_base_hook_type;
|
||||
typedef bs_set_member_hook<void_pointer<VoidPointer> > member_hook_type;
|
||||
typedef bs_set_member_hook
|
||||
< link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer> > auto_member_hook_type;
|
||||
typedef nonhook_node_member< tree_node_traits< VoidPointer >,
|
||||
splaytree_algorithms
|
||||
> nonhook_node_member_type;
|
||||
typedef tree_rebinder_common<ValueTraits, DefaultHolder, Map> common_t;
|
||||
|
||||
template < class Option1 =void
|
||||
, class Option2 =void
|
||||
>
|
||||
struct container
|
||||
{
|
||||
typedef splay_multiset
|
||||
< typename common_t::value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<ConstantTimeSize>
|
||||
, typename common_t::holder_opt
|
||||
, typename common_t::key_of_value_opt
|
||||
, Option1
|
||||
, Option2
|
||||
> type;
|
||||
BOOST_STATIC_ASSERT((key_type_tester<typename common_t::key_of_value_opt, type>::value));
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with void node allocator
|
||||
template < bool Default_Holder >
|
||||
struct GetContainer_With_Holder
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
typedef boost::intrusive::splay_multiset
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with standard (non-void) node allocator
|
||||
template <>
|
||||
struct GetContainer_With_Holder< false >
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// extract node type through options->value_traits->node_traits->node
|
||||
typedef typename pack_options< splaytree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename detail::get_value_traits< ValueType, typename packed_options::proto_value_traits>::type value_traits;
|
||||
typedef typename value_traits::node_traits::node node;
|
||||
|
||||
typedef boost::intrusive::splay_multiset
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
, header_holder_type< pointer_holder< node > >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool constant_time_size, bool Default_Holder>
|
||||
template<class VoidPointer, bool ConstantTimeSize, bool DefaultHolder, bool Map>
|
||||
class test_main_template
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
static void execute()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , constant_time_size> value_type;
|
||||
|
||||
test::test_generic_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_multiset < nonhook_node_member_value_traits< value_type,
|
||||
typename hooks<VoidPointer>::nonhook_node_member_type,
|
||||
&value_type::nhn_member_,
|
||||
safe_link
|
||||
>,
|
||||
GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
return 0;
|
||||
typedef testvalue_traits< bs_hooks<VoidPointer> > testval_traits_t;
|
||||
//base
|
||||
typedef typename testval_traits_t::base_value_traits base_hook_t;
|
||||
test::test_generic_multiset
|
||||
< base_hook_t
|
||||
, rebinder<base_hook_t, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//member
|
||||
typedef typename testval_traits_t::member_value_traits member_hook_t;
|
||||
test::test_generic_multiset
|
||||
< member_hook_t
|
||||
, rebinder<member_hook_t, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//nonmember
|
||||
test::test_generic_multiset
|
||||
< typename testval_traits_t::nonhook_value_traits
|
||||
, rebinder<typename testval_traits_t::nonhook_value_traits, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool Default_Holder>
|
||||
class test_main_template<VoidPointer, false, Default_Holder>
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , false> value_type;
|
||||
|
||||
test::test_generic_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::auto_base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::auto_member_hook_type
|
||||
, &value_type::auto_node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
// container generator which ignores further parametrization, except for compare option
|
||||
template < typename Value_Traits, bool ConstantTimeSize, typename HeaderHolder >
|
||||
struct Get_Preset_Container
|
||||
{
|
||||
template < class
|
||||
, class Option1 = void
|
||||
, class Option2 = void
|
||||
, class Option3 = void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// ignore further paramatrization except for the compare option
|
||||
// notably ignore the size option (use preset)
|
||||
typedef typename pack_options< splaytree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename packed_options::compare compare_option;
|
||||
|
||||
typedef boost::intrusive::splay_multiset< typename Value_Traits::value_type,
|
||||
value_traits< Value_Traits >,
|
||||
constant_time_size< ConstantTimeSize >,
|
||||
compare< compare_option >,
|
||||
header_holder_type< HeaderHolder >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template < bool ConstantTimeSize >
|
||||
template < bool ConstantTimeSize, bool Map >
|
||||
struct test_main_template_bptr
|
||||
{
|
||||
void operator () ()
|
||||
{
|
||||
typedef BPtr_Value value_type;
|
||||
typedef BPtr_Value_Traits< Tree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< value_type > allocator_type;
|
||||
static void execute()
|
||||
{
|
||||
typedef BPtr_Value_Traits< Tree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< BPtr_Value > allocator_type;
|
||||
|
||||
allocator_type::init();
|
||||
test::test_generic_multiset< value_traits,
|
||||
Get_Preset_Container< value_traits, ConstantTimeSize,
|
||||
bounded_pointer_holder< value_type > >::template GetContainer
|
||||
>::test_all();
|
||||
assert(allocator_type::is_clear());
|
||||
allocator_type::destroy();
|
||||
}
|
||||
bounded_allocator_scope<allocator_type> bounded_scope; (void)bounded_scope;
|
||||
test::test_generic_multiset
|
||||
< value_traits
|
||||
, rebinder< value_traits, ConstantTimeSize, true, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
// test (plain/smart pointers) x (nonconst/const size) x (void node allocator)
|
||||
test_main_template<void*, false, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, false, true>()();
|
||||
test_main_template<void*, true, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, true, true>()();
|
||||
// test (bounded pointers) x (nonconst/const size) x (special node allocator)
|
||||
test_main_template_bptr< true >()();
|
||||
test_main_template_bptr< false >()();
|
||||
//Combinations: VoidPointer x ConstantTimeSize x DefaultHolder x Map
|
||||
//Minimize them selecting different combinations for raw and smart pointers
|
||||
//Start with ('false', 'false', 'false') in sets and 'false', 'false', 'true' in multisets
|
||||
|
||||
//void pointer
|
||||
//test_main_template<void*, false, false, false>::execute();
|
||||
test_main_template<void*, false, false, true>::execute();
|
||||
//test_main_template<void*, false, true, false>::execute();
|
||||
test_main_template<void*, false, true, true>::execute();
|
||||
//test_main_template<void*, true, false, false>::execute();
|
||||
test_main_template<void*, true, false, true>::execute();
|
||||
//test_main_template<void*, true, true, false>::execute();
|
||||
test_main_template<void*, true, true, true>::execute();
|
||||
|
||||
//smart_ptr
|
||||
test_main_template<smart_ptr<void>, false, false, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, false, false, true>::execute();
|
||||
test_main_template<smart_ptr<void>, false, true, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, false, true, true>::execute();
|
||||
test_main_template<smart_ptr<void>, true, false, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, false, true>::execute();
|
||||
test_main_template<smart_ptr<void>, true, true, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, true, true>::execute();
|
||||
|
||||
//bounded_ptr (bool ConstantTimeSize, bool Map)
|
||||
//test_main_template_bptr< false, false >::execute();
|
||||
test_main_template_bptr< false, true >::execute();
|
||||
test_main_template_bptr< true, false >::execute();
|
||||
//test_main_template_bptr< true, true >::execute();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
+82
-234
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
// (C) Copyright Ion Gaztanaga 2007-2015
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -13,260 +13,108 @@
|
||||
#include "itestvalue.hpp"
|
||||
#include "bptr_value.hpp"
|
||||
#include "smart_ptr.hpp"
|
||||
#include "bs_test_common.hpp"
|
||||
#include "generic_set_test.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_splay<boost::intrusive::splay_set<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_rebalance<boost::intrusive::splay_set<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_const_searches<boost::intrusive::splay_set<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
template<class VoidPointer>
|
||||
struct hooks
|
||||
template < class ValueTraits, bool ConstantTimeSize, bool DefaultHolder, bool Map >
|
||||
struct rebinder
|
||||
{
|
||||
typedef bs_set_base_hook<void_pointer<VoidPointer> > base_hook_type;
|
||||
typedef bs_set_base_hook
|
||||
< link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer>
|
||||
, tag<my_tag> > auto_base_hook_type;
|
||||
typedef bs_set_member_hook<void_pointer<VoidPointer> > member_hook_type;
|
||||
typedef bs_set_member_hook
|
||||
< link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer> > auto_member_hook_type;
|
||||
typedef nonhook_node_member< tree_node_traits< VoidPointer >,
|
||||
splaytree_algorithms
|
||||
> nonhook_node_member_type;
|
||||
typedef tree_rebinder_common<ValueTraits, DefaultHolder, Map> common_t;
|
||||
|
||||
template < class Option1 =void
|
||||
, class Option2 =void
|
||||
>
|
||||
struct container
|
||||
{
|
||||
typedef splay_set
|
||||
< typename common_t::value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<ConstantTimeSize>
|
||||
, typename common_t::holder_opt
|
||||
, typename common_t::key_of_value_opt
|
||||
, Option1
|
||||
, Option2
|
||||
> type;
|
||||
BOOST_STATIC_ASSERT((key_type_tester<typename common_t::key_of_value_opt, type>::value));
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with void node allocator
|
||||
template < bool Default_Holder >
|
||||
struct GetContainer_With_Holder
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
typedef boost::intrusive::splay_set
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with standard (non-void) node allocator
|
||||
template <>
|
||||
struct GetContainer_With_Holder< false >
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// extract node type through options->value_traits->node_traits->node
|
||||
typedef typename pack_options< splaytree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename detail::get_value_traits< ValueType, typename packed_options::proto_value_traits>::type value_traits;
|
||||
typedef typename value_traits::node_traits::node node;
|
||||
|
||||
typedef boost::intrusive::splay_set
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
, header_holder_type< pointer_holder< node > >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool constant_time_size, bool Default_Holder>
|
||||
template<class VoidPointer, bool ConstantTimeSize, bool DefaultHolder, bool Map>
|
||||
class test_main_template
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
static void execute()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , constant_time_size> value_type;
|
||||
|
||||
test::test_generic_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_set < nonhook_node_member_value_traits< value_type,
|
||||
typename hooks<VoidPointer>::nonhook_node_member_type,
|
||||
&value_type::nhn_member_,
|
||||
safe_link
|
||||
>,
|
||||
GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
return 0;
|
||||
typedef testvalue_traits< bs_hooks<VoidPointer> > testval_traits_t;
|
||||
//base
|
||||
typedef typename testval_traits_t::base_value_traits base_hook_t;
|
||||
test::test_generic_set
|
||||
< base_hook_t
|
||||
, rebinder<base_hook_t, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//member
|
||||
typedef typename testval_traits_t::member_value_traits member_hook_t;
|
||||
test::test_generic_set
|
||||
< member_hook_t
|
||||
, rebinder<member_hook_t, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//nonmember
|
||||
test::test_generic_set
|
||||
< typename testval_traits_t::nonhook_value_traits
|
||||
, rebinder<typename testval_traits_t::nonhook_value_traits, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool Default_Holder>
|
||||
class test_main_template<VoidPointer, false, Default_Holder>
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , false> value_type;
|
||||
|
||||
test::test_generic_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::auto_base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::auto_member_hook_type
|
||||
, &value_type::auto_node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
// container generator which ignores further parametrization, except for compare option
|
||||
template < typename Value_Traits, bool ConstantTimeSize, typename HeaderHolder >
|
||||
struct Get_Preset_Container
|
||||
{
|
||||
template < class
|
||||
, class Option1 = void
|
||||
, class Option2 = void
|
||||
, class Option3 = void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// ignore further paramatrization except for the compare option
|
||||
// notably ignore the size option (use preset)
|
||||
typedef typename pack_options< splaytree_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename packed_options::compare compare_option;
|
||||
|
||||
typedef boost::intrusive::splay_set< typename Value_Traits::value_type,
|
||||
value_traits< Value_Traits >,
|
||||
constant_time_size< ConstantTimeSize >,
|
||||
compare< compare_option >,
|
||||
header_holder_type< HeaderHolder >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template < bool ConstantTimeSize >
|
||||
template < bool ConstantTimeSize, bool Map >
|
||||
struct test_main_template_bptr
|
||||
{
|
||||
void operator () ()
|
||||
{
|
||||
typedef BPtr_Value value_type;
|
||||
typedef BPtr_Value_Traits< Tree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< value_type > allocator_type;
|
||||
static void execute()
|
||||
{
|
||||
typedef BPtr_Value_Traits< Tree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< BPtr_Value > allocator_type;
|
||||
|
||||
allocator_type::init();
|
||||
test::test_generic_set< value_traits,
|
||||
Get_Preset_Container< value_traits, ConstantTimeSize,
|
||||
bounded_pointer_holder< value_type > >::template GetContainer
|
||||
>::test_all();
|
||||
assert(allocator_type::is_clear());
|
||||
allocator_type::destroy();
|
||||
}
|
||||
bounded_allocator_scope<allocator_type> bounded_scope; (void)bounded_scope;
|
||||
test::test_generic_set
|
||||
< value_traits
|
||||
, rebinder< value_traits, ConstantTimeSize, true, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
// test (plain/smart pointers) x (nonconst/const size) x (void node allocator)
|
||||
test_main_template<void*, false, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, false, true>()();
|
||||
test_main_template<void*, true, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, true, true>()();
|
||||
// test (bounded pointers) x (nonconst/const size) x (special node allocator)
|
||||
test_main_template_bptr< true >()();
|
||||
test_main_template_bptr< false >()();
|
||||
//Combinations: VoidPointer x ConstantTimeSize x DefaultHolder x Map
|
||||
//Minimize them selecting different combinations for raw and smart pointers
|
||||
//Start with ('false', 'false', 'false') in sets and 'false', 'false', 'true' in multisets
|
||||
|
||||
//void pointer
|
||||
test_main_template<void*, false, false, false>::execute();
|
||||
//test_main_template<void*, false, false, true>::execute();
|
||||
test_main_template<void*, false, true, false>::execute();
|
||||
//test_main_template<void*, false, true, true>::execute();
|
||||
test_main_template<void*, true, false, false>::execute();
|
||||
//test_main_template<void*, true, false, true>::execute();
|
||||
test_main_template<void*, true, true, false>::execute();
|
||||
//test_main_template<void*, true, true, true>::execute();
|
||||
|
||||
//smart_ptr
|
||||
//test_main_template<smart_ptr<void>, false, false, false>::execute();
|
||||
test_main_template<smart_ptr<void>, false, false, true>::execute();
|
||||
//test_main_template<smart_ptr<void>, false, true, false>::execute();
|
||||
test_main_template<smart_ptr<void>, false, true, true>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, false, false>::execute();
|
||||
test_main_template<smart_ptr<void>, true, false, true>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, true, false>::execute();
|
||||
test_main_template<smart_ptr<void>, true, true, true>::execute();
|
||||
|
||||
//bounded_ptr (bool ConstantTimeSize, bool Map)
|
||||
test_main_template_bptr< false, false >::execute();
|
||||
//test_main_template_bptr< false, true >::execute();
|
||||
//test_main_template_bptr< true, false >::execute();
|
||||
test_main_template_bptr< true, true >::execute();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
+142
-60
@@ -18,17 +18,15 @@
|
||||
#include <boost/intrusive/detail/simple_disposers.hpp>
|
||||
#include <boost/intrusive/detail/iterator.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include "iterator_test.hpp"
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace test {
|
||||
|
||||
template<class T>
|
||||
struct is_unordered
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED(is_unordered, hasher)
|
||||
|
||||
template<class Container>
|
||||
struct test_container_typedefs
|
||||
@@ -174,42 +172,66 @@ template< class Container, class Data >
|
||||
void test_common_unordered_and_associative_container(Container & c, Data & d, boost::intrusive::detail::true_ unordered)
|
||||
{
|
||||
(void)unordered;
|
||||
typedef typename Container::size_type size_type;
|
||||
typedef typename Container::size_type size_type;
|
||||
typedef typename Container::key_of_value key_of_value;
|
||||
typedef typename Container::iterator iterator;
|
||||
typedef typename Container::const_iterator const_iterator;
|
||||
|
||||
assert( d.size() > 2 );
|
||||
|
||||
c.clear();
|
||||
c.insert(d.begin(), d.end());
|
||||
|
||||
for( typename Data::const_iterator di = d.begin(), de = d.end();
|
||||
di != de; ++di )
|
||||
{
|
||||
BOOST_TEST( c.find(*di) != c.end() );
|
||||
Container const &cc = c;
|
||||
for( typename Data::const_iterator di = d.begin(), de = d.end();
|
||||
di != de; ++di )
|
||||
{
|
||||
BOOST_TEST( cc.find(key_of_value()(*di), c.hash_function(), c.key_eq()) != cc.end() );
|
||||
std::pair<const_iterator, const_iterator> rdi = cc.equal_range(key_of_value()(*di), c.hash_function(), c.key_eq());
|
||||
BOOST_TEST(rdi.first != rdi.second);
|
||||
BOOST_TEST(size_type(boost::intrusive::iterator_distance(rdi.first, rdi.second)) == cc.count(key_of_value()(*di), c.hash_function(), c.key_eq()));
|
||||
}
|
||||
|
||||
for( iterator ci = c.begin(), ce = c.end(); ci != ce; )
|
||||
{
|
||||
BOOST_TEST( c.find(key_of_value()(*ci)) != c.end() );
|
||||
std::pair<iterator, iterator> rci = c.equal_range(key_of_value()(*ci), c.hash_function(), c.key_eq());
|
||||
BOOST_TEST(rci.first != rci.second);
|
||||
size_type const sc = c.count(key_of_value()(*ci), c.hash_function(), c.key_eq());
|
||||
BOOST_TEST(size_type(boost::intrusive::iterator_distance(rci.first, rci.second)) == sc);
|
||||
BOOST_TEST(sc == c.erase(key_of_value()(*ci), c.hash_function(), c.key_eq()));
|
||||
ci = rci.second;
|
||||
}
|
||||
BOOST_TEST(c.empty());
|
||||
}
|
||||
|
||||
c.clear();
|
||||
c.insert(d.begin(), d.end());
|
||||
|
||||
typename Data::const_iterator db = d.begin();
|
||||
typename Data::const_iterator da = db++;
|
||||
|
||||
size_type old_size = c.size();
|
||||
|
||||
c.erase(*da, c.hash_function(), c.key_eq());
|
||||
c.erase(key_of_value()(*da), c.hash_function(), c.key_eq());
|
||||
BOOST_TEST( c.size() == old_size-1 );
|
||||
//This should not eras anyone
|
||||
size_type second_erase = c.erase_and_dispose
|
||||
( *da, c.hash_function(), c.key_eq(), detail::null_disposer() );
|
||||
( key_of_value()(*da), c.hash_function(), c.key_eq(), detail::null_disposer() );
|
||||
BOOST_TEST( second_erase == 0 );
|
||||
|
||||
BOOST_TEST( c.count(*da, c.hash_function(), c.key_eq()) == 0 );
|
||||
BOOST_TEST( c.count(*db, c.hash_function(), c.key_eq()) != 0 );
|
||||
BOOST_TEST( c.count(key_of_value()(*da), c.hash_function(), c.key_eq()) == 0 );
|
||||
BOOST_TEST( c.count(key_of_value()(*db), c.hash_function(), c.key_eq()) != 0 );
|
||||
|
||||
BOOST_TEST( c.find(*da, c.hash_function(), c.key_eq()) == c.end() );
|
||||
BOOST_TEST( c.find(*db, c.hash_function(), c.key_eq()) != c.end() );
|
||||
BOOST_TEST( c.find(key_of_value()(*da), c.hash_function(), c.key_eq()) == c.end() );
|
||||
BOOST_TEST( c.find(key_of_value()(*db), c.hash_function(), c.key_eq()) != c.end() );
|
||||
|
||||
BOOST_TEST( c.equal_range(*db, c.hash_function(), c.key_eq()).first != c.end() );
|
||||
BOOST_TEST( c.equal_range(key_of_value()(*db), c.hash_function(), c.key_eq()).first != c.end() );
|
||||
|
||||
c.clear();
|
||||
|
||||
BOOST_TEST( c.equal_range(*da, c.hash_function(), c.key_eq()).first == c.end() );
|
||||
BOOST_TEST( c.equal_range(key_of_value()(*da), c.hash_function(), c.key_eq()).first == c.end() );
|
||||
|
||||
//
|
||||
//suggested_upper_bucket_count
|
||||
@@ -243,7 +265,10 @@ template< class Container, class Data >
|
||||
void test_common_unordered_and_associative_container(Container & c, Data & d, boost::intrusive::detail::false_ unordered)
|
||||
{
|
||||
(void)unordered;
|
||||
typedef typename Container::size_type size_type;
|
||||
typedef typename Container::size_type size_type;
|
||||
typedef typename Container::key_of_value key_of_value;
|
||||
typedef typename Container::iterator iterator;
|
||||
typedef typename Container::const_iterator const_iterator;
|
||||
|
||||
assert( d.size() > 2 );
|
||||
|
||||
@@ -255,37 +280,61 @@ void test_common_unordered_and_associative_container(Container & c, Data & d, bo
|
||||
|
||||
c.clear();
|
||||
c.insert(d.begin(), d.end());
|
||||
|
||||
for( typename Data::const_iterator di = d.begin(), de = d.end();
|
||||
di != de; ++di )
|
||||
{
|
||||
BOOST_TEST( c.find(*di, c.key_comp()) != c.end() );
|
||||
Container const &cc = c;
|
||||
for( typename Data::const_iterator di = d.begin(), de = d.end();
|
||||
di != de; ++di )
|
||||
{
|
||||
BOOST_TEST( cc.find(key_of_value()(*di), c.key_comp()) != cc.end() );
|
||||
std::pair<const_iterator, const_iterator> rdi = cc.equal_range(key_of_value()(*di), c.key_comp());
|
||||
BOOST_TEST(rdi.first != rdi.second);
|
||||
BOOST_TEST(size_type(boost::intrusive::iterator_distance(rdi.first, rdi.second)) == cc.count(key_of_value()(*di), c.key_comp()));
|
||||
}
|
||||
|
||||
for( iterator ci = c.begin(), ce = c.end(); ci != ce; )
|
||||
{
|
||||
BOOST_TEST( c.find(key_of_value()(*ci)) != c.end() );
|
||||
std::pair<iterator, iterator> rci = c.equal_range(key_of_value()(*ci), c.key_comp());
|
||||
BOOST_TEST(rci.first != rci.second);
|
||||
size_type const sc = c.count(key_of_value()(*ci), c.key_comp());
|
||||
BOOST_TEST(size_type(boost::intrusive::iterator_distance(rci.first, rci.second)) == sc);
|
||||
BOOST_TEST(sc == c.erase(key_of_value()(*ci), c.key_comp()));
|
||||
ci = rci.second;
|
||||
}
|
||||
BOOST_TEST(c.empty());
|
||||
}
|
||||
|
||||
c.clear();
|
||||
c.insert(d.begin(), d.end());
|
||||
|
||||
typename Data::const_iterator db = d.begin();
|
||||
typename Data::const_iterator da = db++;
|
||||
|
||||
size_type old_size = c.size();
|
||||
|
||||
c.erase(*da, c.key_comp());
|
||||
c.erase(key_of_value()(*da), c.key_comp());
|
||||
BOOST_TEST( c.size() == old_size-1 );
|
||||
//This should not erase any
|
||||
size_type second_erase = c.erase_and_dispose( *da, c.key_comp(), detail::null_disposer() );
|
||||
size_type second_erase = c.erase_and_dispose( key_of_value()(*da), c.key_comp(), detail::null_disposer() );
|
||||
BOOST_TEST( second_erase == 0 );
|
||||
|
||||
BOOST_TEST( c.count(*da, c.key_comp()) == 0 );
|
||||
BOOST_TEST( c.count(*db, c.key_comp()) != 0 );
|
||||
BOOST_TEST( c.find(*da, c.key_comp()) == c.end() );
|
||||
BOOST_TEST( c.find(*db, c.key_comp()) != c.end() );
|
||||
BOOST_TEST( c.equal_range(*db, c.key_comp()).first != c.end() );
|
||||
BOOST_TEST( c.count(key_of_value()(*da), c.key_comp()) == 0 );
|
||||
BOOST_TEST( c.count(key_of_value()(*db), c.key_comp()) != 0 );
|
||||
BOOST_TEST( c.find(key_of_value()(*da), c.key_comp()) == c.end() );
|
||||
BOOST_TEST( c.find(key_of_value()(*db), c.key_comp()) != c.end() );
|
||||
BOOST_TEST( c.equal_range(key_of_value()(*db), c.key_comp()).first != c.end() );
|
||||
c.clear();
|
||||
BOOST_TEST( c.equal_range(*da, c.key_comp()).first == c.end() );
|
||||
BOOST_TEST( c.equal_range(key_of_value()(*da), c.key_comp()).first == c.end() );
|
||||
}
|
||||
|
||||
template< class Container, class Data >
|
||||
void test_common_unordered_and_associative_container(Container & c, Data & d)
|
||||
{
|
||||
typedef typename Container::size_type size_type;
|
||||
typedef typename Container::size_type size_type;
|
||||
typedef typename Container::key_of_value key_of_value;
|
||||
typedef typename Container::iterator iterator;
|
||||
typedef typename Container::const_iterator const_iterator;
|
||||
|
||||
{
|
||||
assert( d.size() > 2 );
|
||||
|
||||
@@ -298,31 +347,51 @@ void test_common_unordered_and_associative_container(Container & c, Data & d)
|
||||
c.clear();
|
||||
c.insert(d.begin(), d.end());
|
||||
|
||||
Container const &cc = c;
|
||||
for( typename Data::const_iterator di = d.begin(), de = d.end();
|
||||
di != de; ++di )
|
||||
{
|
||||
BOOST_TEST( c.find(*di) != c.end() );
|
||||
BOOST_TEST( cc.find(key_of_value()(*di)) != cc.end() );
|
||||
std::pair<const_iterator, const_iterator> rdi = cc.equal_range(key_of_value()(*di));
|
||||
BOOST_TEST(rdi.first != rdi.second);
|
||||
BOOST_TEST(size_type(boost::intrusive::iterator_distance(rdi.first, rdi.second)) == cc.count(key_of_value()(*di)));
|
||||
}
|
||||
|
||||
for( iterator ci = c.begin(), ce = c.end(); ci != ce; )
|
||||
{
|
||||
BOOST_TEST( c.find(key_of_value()(*ci)) != c.end() );
|
||||
std::pair<iterator, iterator> rci = c.equal_range(key_of_value()(*ci));
|
||||
BOOST_TEST(rci.first != rci.second);
|
||||
size_type const sc = c.count(key_of_value()(*ci));
|
||||
BOOST_TEST(size_type(boost::intrusive::iterator_distance(rci.first, rci.second)) == sc);
|
||||
BOOST_TEST(sc == c.erase(key_of_value()(*ci)));
|
||||
ci = rci.second;
|
||||
}
|
||||
BOOST_TEST(c.empty());
|
||||
}
|
||||
{
|
||||
c.clear();
|
||||
c.insert(d.begin(), d.end());
|
||||
|
||||
typename Data::const_iterator db = d.begin();
|
||||
typename Data::const_iterator da = db++;
|
||||
|
||||
size_type old_size = c.size();
|
||||
|
||||
c.erase(*da);
|
||||
c.erase(key_of_value()(*da));
|
||||
BOOST_TEST( c.size() == old_size-1 );
|
||||
//This should erase nothing
|
||||
size_type second_erase = c.erase_and_dispose( *da, detail::null_disposer() );
|
||||
size_type second_erase = c.erase_and_dispose( key_of_value()(*da), detail::null_disposer() );
|
||||
BOOST_TEST( second_erase == 0 );
|
||||
|
||||
BOOST_TEST( c.count(*da) == 0 );
|
||||
BOOST_TEST( c.count(*db) != 0 );
|
||||
BOOST_TEST( c.count(key_of_value()(*da)) == 0 );
|
||||
BOOST_TEST( c.count(key_of_value()(*db)) != 0 );
|
||||
|
||||
BOOST_TEST( c.find(*da) == c.end() );
|
||||
BOOST_TEST( c.find(*db) != c.end() );
|
||||
BOOST_TEST( c.find(key_of_value()(*da)) == c.end() );
|
||||
BOOST_TEST( c.find(key_of_value()(*db)) != c.end() );
|
||||
|
||||
BOOST_TEST( c.equal_range(*db).first != c.end() );
|
||||
BOOST_TEST( c.equal_range(*da).first == c.equal_range(*da).second );
|
||||
BOOST_TEST( c.equal_range(key_of_value()(*db)).first != c.end() );
|
||||
BOOST_TEST( c.equal_range(key_of_value()(*da)).first == c.equal_range(key_of_value()(*da)).second );
|
||||
}
|
||||
{
|
||||
c.clear();
|
||||
@@ -333,12 +402,12 @@ void test_common_unordered_and_associative_container(Container & c, Data & d)
|
||||
BOOST_TEST( c.empty());
|
||||
for( typename Data::const_iterator di = d.begin(), de = d.end();
|
||||
di != de; ++di )
|
||||
{ BOOST_TEST( move_c.find(*di) != move_c.end() ); }
|
||||
{ BOOST_TEST( move_c.find(key_of_value()(*di)) != move_c.end() ); }
|
||||
|
||||
c = ::boost::move(move_c);
|
||||
for( typename Data::const_iterator di = d.begin(), de = d.end();
|
||||
di != de; ++di )
|
||||
{ BOOST_TEST( c.find(*di) != c.end() ); }
|
||||
{ BOOST_TEST( c.find(key_of_value()(*di)) != c.end() ); }
|
||||
BOOST_TEST( move_c.empty());
|
||||
}
|
||||
typedef detail::bool_<is_unordered<Container>::value> enabler;
|
||||
@@ -348,25 +417,29 @@ void test_common_unordered_and_associative_container(Container & c, Data & d)
|
||||
template< class Container, class Data >
|
||||
void test_associative_container_invariants(Container & c, Data & d)
|
||||
{
|
||||
typedef typename Container::const_iterator const_iterator;
|
||||
typedef typename Container::const_iterator const_iterator;
|
||||
typedef typename Container::key_of_value key_of_value;
|
||||
for( typename Data::const_iterator di = d.begin(), de = d.end();
|
||||
di != de; ++di)
|
||||
{
|
||||
const_iterator ci = c.find(*di);
|
||||
const_iterator ci = c.find(key_of_value()(*di));
|
||||
BOOST_TEST( ci != c.end() );
|
||||
BOOST_TEST( ! c.value_comp()(*ci, *di) );
|
||||
const_iterator cil = c.lower_bound(*di);
|
||||
const_iterator ciu = c.upper_bound(*di);
|
||||
std::pair<const_iterator, const_iterator> er = c.equal_range(*di);
|
||||
BOOST_TEST( ! c.key_comp()(key_of_value()(*ci), key_of_value()(*di)) );
|
||||
const_iterator cil = c.lower_bound(key_of_value()(*di));
|
||||
const_iterator ciu = c.upper_bound(key_of_value()(*di));
|
||||
std::pair<const_iterator, const_iterator> er = c.equal_range(key_of_value()(*di));
|
||||
BOOST_TEST( cil == er.first );
|
||||
BOOST_TEST( ciu == er.second );
|
||||
if(ciu != c.end()){
|
||||
BOOST_TEST( c.value_comp()(*cil, *ciu) );
|
||||
BOOST_TEST( c.key_comp()(key_of_value()(*cil), key_of_value()(*ciu)) );
|
||||
}
|
||||
if(c.count(*di) > 1){
|
||||
if(c.count(key_of_value()(*di)) > 1){
|
||||
const_iterator ci_next = cil; ++ci_next;
|
||||
for( ; ci_next != ciu; ++cil, ++ci_next){
|
||||
BOOST_TEST( !c.value_comp()(*ci_next, *cil) );
|
||||
BOOST_TEST( !c.key_comp()(key_of_value()(*ci_next), key_of_value()(*cil)) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -390,29 +463,30 @@ void test_associative_container(Container & c, Data & d)
|
||||
template< class Container, class Data >
|
||||
void test_unordered_associative_container_invariants(Container & c, Data & d)
|
||||
{
|
||||
typedef typename Container::size_type size_type;
|
||||
typedef typename Container::const_iterator const_iterator;
|
||||
typedef typename Container::size_type size_type;
|
||||
typedef typename Container::const_iterator const_iterator;
|
||||
typedef typename Container::key_of_value key_of_value;
|
||||
|
||||
for( typename Data::const_iterator di = d.begin(), de = d.end() ;
|
||||
di != de ; ++di ){
|
||||
const_iterator i = c.find(*di);
|
||||
size_type nb = c.bucket(*i);
|
||||
const_iterator i = c.find(key_of_value()(*di));
|
||||
size_type nb = c.bucket(key_of_value()(*i));
|
||||
size_type bucket_elem = boost::intrusive::iterator_distance(c.begin(nb), c.end(nb));
|
||||
BOOST_TEST( bucket_elem == c.bucket_size(nb) );
|
||||
BOOST_TEST( &*c.local_iterator_to(*c.find(*di)) == &*i );
|
||||
BOOST_TEST( &*c.local_iterator_to(*const_cast<const Container &>(c).find(*di)) == &*i );
|
||||
BOOST_TEST( &*Container::s_local_iterator_to(*c.find(*di)) == &*i );
|
||||
BOOST_TEST( &*Container::s_local_iterator_to(*const_cast<const Container &>(c).find(*di)) == &*i );
|
||||
std::pair<const_iterator, const_iterator> er = c.equal_range(*di);
|
||||
BOOST_TEST( &*c.local_iterator_to(*c.find(key_of_value()(*di))) == &*i );
|
||||
BOOST_TEST( &*c.local_iterator_to(*const_cast<const Container &>(c).find(key_of_value()(*di))) == &*i );
|
||||
BOOST_TEST( &*Container::s_local_iterator_to(*c.find(key_of_value()(*di))) == &*i );
|
||||
BOOST_TEST( &*Container::s_local_iterator_to(*const_cast<const Container &>(c).find(key_of_value()(*di))) == &*i );
|
||||
std::pair<const_iterator, const_iterator> er = c.equal_range(key_of_value()(*di));
|
||||
size_type cnt = boost::intrusive::iterator_distance(er.first, er.second);
|
||||
BOOST_TEST( cnt == c.count(*di));
|
||||
BOOST_TEST( cnt == c.count(key_of_value()(*di)));
|
||||
if(cnt > 1){
|
||||
const_iterator n = er.first;
|
||||
i = n++;
|
||||
const_iterator e = er.second;
|
||||
for(; n != e; ++i, ++n){
|
||||
BOOST_TEST( c.key_eq()(*i, *n) );
|
||||
BOOST_TEST( c.hash_function()(*i) == c.hash_function()(*n) );
|
||||
BOOST_TEST( c.key_eq()(key_of_value()(*i), key_of_value()(*n)) );
|
||||
BOOST_TEST( (c.hash_function()(key_of_value()(*i))) == (c.hash_function()(key_of_value()(*n))) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -470,6 +544,14 @@ void test_non_unique_container(Container & c, Data & d)
|
||||
c.clear();
|
||||
}
|
||||
|
||||
template< class Container, class Data >
|
||||
void test_maybe_unique_container(Container & c, Data & d, detail::false_)//is_unique
|
||||
{ test_unique_container(c, d); }
|
||||
|
||||
template< class Container, class Data >
|
||||
void test_maybe_unique_container(Container & c, Data & d, detail::true_)//!is_unique
|
||||
{ test_non_unique_container(c, d); }
|
||||
|
||||
}}}
|
||||
|
||||
#endif //#ifndef BOOST_INTRUSIVE_TEST_CONTAINER_HPP
|
||||
|
||||
@@ -13,8 +13,25 @@
|
||||
#ifndef BOOST_INTRUSIVE_TEST_TEST_MACROS_HPP
|
||||
#define BOOST_INTRUSIVE_TEST_TEST_MACROS_HPP
|
||||
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
#include <algorithm> //std::unique
|
||||
|
||||
namespace boost{
|
||||
namespace intrusive{
|
||||
namespace test{
|
||||
|
||||
template <class T>
|
||||
struct is_multikey_true
|
||||
{
|
||||
typedef char yes_type;
|
||||
template<bool IsMultikey>
|
||||
struct two { yes_type _[1+IsMultikey]; };
|
||||
template <class U> static yes_type test(...);
|
||||
template <class U> static two<U::is_multikey>test(int);
|
||||
static const bool value = sizeof(test<T>(0)) != sizeof(yes_type);
|
||||
};
|
||||
|
||||
} //namespace test{
|
||||
|
||||
template<class It1, class It2>
|
||||
bool test_equal(It1 f1, It1 l1, It2 f2)
|
||||
@@ -39,6 +56,25 @@ bool test_equal(It1 f1, It1 l1, It2 f2)
|
||||
BOOST_TEST (boost::intrusive::test_equal(EXPECTEDVECTOR.begin(), EXPECTEDVECTOR.end(), ITERATOR) ); \
|
||||
}
|
||||
|
||||
namespace test{
|
||||
|
||||
template<class Container, class Vector>
|
||||
void test_intrusive_maybe_unique(const Container &c, Vector &v)
|
||||
{
|
||||
if(!is_multikey_true<Container>::value)
|
||||
v.erase(std::unique(v.begin(), v.end()), v.end());
|
||||
BOOST_TEST (boost::intrusive::test_equal(v.begin(), v.end(), c.begin()) );
|
||||
}
|
||||
|
||||
} //namespace test{
|
||||
|
||||
#define TEST_INTRUSIVE_SEQUENCE_MAYBEUNIQUE(INTVALUES, CONTAINER)\
|
||||
{\
|
||||
boost::container::vector<int>v(&INTVALUES[0], &INTVALUES[0] + sizeof(INTVALUES)/sizeof(INTVALUES[0]));\
|
||||
boost::intrusive::test::test_intrusive_maybe_unique(CONTAINER, v);\
|
||||
}\
|
||||
//
|
||||
|
||||
} //namespace boost{
|
||||
} //namespace intrusive{
|
||||
|
||||
|
||||
+83
-202
@@ -1,7 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013.
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -10,230 +9,112 @@
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/intrusive/treap_set.hpp>
|
||||
#include <boost/intrusive/sg_set.hpp>
|
||||
#include "itestvalue.hpp"
|
||||
#include "bptr_value.hpp"
|
||||
#include "smart_ptr.hpp"
|
||||
#include "bs_test_common.hpp"
|
||||
#include "generic_multiset_test.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_insert_before<boost::intrusive::treap_multiset<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
template<class VoidPointer>
|
||||
struct hooks
|
||||
template < class ValueTraits, bool ConstantTimeSize, bool DefaultHolder, bool Map >
|
||||
struct rebinder
|
||||
{
|
||||
typedef bs_set_base_hook<void_pointer<VoidPointer> > base_hook_type;
|
||||
typedef bs_set_base_hook
|
||||
< void_pointer<VoidPointer>
|
||||
, tag<my_tag> > auto_base_hook_type;
|
||||
typedef bs_set_member_hook
|
||||
< void_pointer<VoidPointer> > member_hook_type;
|
||||
typedef bs_set_member_hook
|
||||
< void_pointer<VoidPointer> > auto_member_hook_type;
|
||||
typedef nonhook_node_member< tree_node_traits< VoidPointer >,
|
||||
treap_algorithms
|
||||
> nonhook_node_member_type;
|
||||
typedef tree_rebinder_common<ValueTraits, DefaultHolder, Map> common_t;
|
||||
|
||||
template < class Option1 =void
|
||||
, class Option2 =void
|
||||
>
|
||||
struct container
|
||||
{
|
||||
typedef sg_multiset
|
||||
< typename common_t::value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<ConstantTimeSize>
|
||||
, typename common_t::holder_opt
|
||||
, typename common_t::key_of_value_opt
|
||||
, Option1
|
||||
, Option2
|
||||
> type;
|
||||
BOOST_STATIC_ASSERT((key_type_tester<typename common_t::key_of_value_opt, type>::value));
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with void node allocator
|
||||
template < bool Default_Holder >
|
||||
struct GetContainer_With_Holder
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
typedef boost::intrusive::treap_multiset
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with standard (non-void) node allocator
|
||||
template <>
|
||||
struct GetContainer_With_Holder< false >
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// extract node type through options->value_traits->node_traits->node
|
||||
typedef typename pack_options< treap_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename detail::get_value_traits< ValueType, typename packed_options::proto_value_traits>::type value_traits;
|
||||
typedef typename value_traits::node_traits::node node;
|
||||
|
||||
typedef boost::intrusive::treap_multiset
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
, header_holder_type< pointer_holder< node > >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool constant_time_size, bool Default_Holder>
|
||||
template<class VoidPointer, bool ConstantTimeSize, bool DefaultHolder, bool Map>
|
||||
class test_main_template
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
static void execute()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , constant_time_size> value_type;
|
||||
|
||||
test::test_generic_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_multiset < nonhook_node_member_value_traits< value_type,
|
||||
typename hooks<VoidPointer>::nonhook_node_member_type,
|
||||
&value_type::nhn_member_,
|
||||
safe_link
|
||||
>,
|
||||
GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
return 0;
|
||||
typedef testvalue_traits< bs_hooks<VoidPointer> > testval_traits_t;
|
||||
//base
|
||||
typedef typename testval_traits_t::base_value_traits base_hook_t;
|
||||
test::test_generic_multiset
|
||||
< base_hook_t
|
||||
, rebinder<base_hook_t, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//member
|
||||
typedef typename testval_traits_t::member_value_traits member_hook_t;
|
||||
test::test_generic_multiset
|
||||
< member_hook_t
|
||||
, rebinder<member_hook_t, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//nonmember
|
||||
test::test_generic_multiset
|
||||
< typename testval_traits_t::nonhook_value_traits
|
||||
, rebinder<typename testval_traits_t::nonhook_value_traits, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool Default_Holder>
|
||||
class test_main_template<VoidPointer, false, Default_Holder>
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , false> value_type;
|
||||
|
||||
test::test_generic_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::auto_base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::auto_member_hook_type
|
||||
, &value_type::auto_node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
// container generator which ignores further parametrization, except for compare option
|
||||
template < typename Value_Traits, bool ConstantTimeSize, typename HeaderHolder >
|
||||
struct Get_Preset_Container
|
||||
{
|
||||
template < class
|
||||
, class Option1 = void
|
||||
, class Option2 = void
|
||||
, class Option3 = void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// ignore further paramatrization except for the compare option
|
||||
// notably ignore the size option (use preset)
|
||||
typedef typename pack_options< treap_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename packed_options::compare compare_option;
|
||||
|
||||
typedef boost::intrusive::treap_multiset< typename Value_Traits::value_type,
|
||||
value_traits< Value_Traits >,
|
||||
constant_time_size< ConstantTimeSize >,
|
||||
compare< compare_option >,
|
||||
header_holder_type< HeaderHolder >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template < bool ConstantTimeSize >
|
||||
template < bool ConstantTimeSize, bool Map >
|
||||
struct test_main_template_bptr
|
||||
{
|
||||
void operator () ()
|
||||
{
|
||||
typedef BPtr_Value value_type;
|
||||
typedef BPtr_Value_Traits< Tree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< value_type > allocator_type;
|
||||
static void execute()
|
||||
{
|
||||
typedef BPtr_Value_Traits< Tree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< BPtr_Value > allocator_type;
|
||||
|
||||
allocator_type::init();
|
||||
test::test_generic_multiset< value_traits,
|
||||
Get_Preset_Container< value_traits, ConstantTimeSize,
|
||||
bounded_pointer_holder< value_type > >::template GetContainer
|
||||
>::test_all();
|
||||
assert(allocator_type::is_clear());
|
||||
allocator_type::destroy();
|
||||
}
|
||||
bounded_allocator_scope<allocator_type> bounded_scope; (void)bounded_scope;
|
||||
test::test_generic_multiset
|
||||
< value_traits
|
||||
, rebinder< value_traits, ConstantTimeSize, true, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
// test (plain/smart pointers) x (nonconst/const size) x (void node allocator)
|
||||
test_main_template<void*, false, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, false, true>()();
|
||||
test_main_template<void*, true, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, true, true>()();
|
||||
// test (bounded pointers) x (nonconst/const size) x (special node allocator)
|
||||
test_main_template_bptr< true >()();
|
||||
test_main_template_bptr< false >()();
|
||||
//Combinations: VoidPointer x ConstantTimeSize x DefaultHolder x Map
|
||||
//Minimize them selecting different combinations for raw and smart pointers
|
||||
//Start with ('false', 'false', 'false') in sets and 'false', 'false', 'true' in multisets
|
||||
|
||||
//void pointer
|
||||
//test_main_template<void*, false, false, false>::execute();
|
||||
test_main_template<void*, false, false, true>::execute();
|
||||
//test_main_template<void*, false, true, false>::execute();
|
||||
test_main_template<void*, false, true, true>::execute();
|
||||
//test_main_template<void*, true, false, false>::execute();
|
||||
test_main_template<void*, true, false, true>::execute();
|
||||
//test_main_template<void*, true, true, false>::execute();
|
||||
test_main_template<void*, true, true, true>::execute();
|
||||
|
||||
//smart_ptr
|
||||
test_main_template<smart_ptr<void>, false, false, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, false, false, true>::execute();
|
||||
test_main_template<smart_ptr<void>, false, true, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, false, true, true>::execute();
|
||||
test_main_template<smart_ptr<void>, true, false, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, false, true>::execute();
|
||||
test_main_template<smart_ptr<void>, true, true, false>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, true, true>::execute();
|
||||
|
||||
//bounded_ptr (bool ConstantTimeSize, bool Map)
|
||||
//test_main_template_bptr< false, false >::execute();
|
||||
test_main_template_bptr< false, true >::execute();
|
||||
test_main_template_bptr< true, false >::execute();
|
||||
//test_main_template_bptr< true, true >::execute();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
+83
-219
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013.
|
||||
// (C) Copyright Ion Gaztanaga 2007-2015
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -9,248 +9,112 @@
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/intrusive/treap_set.hpp>
|
||||
#include "itestvalue.hpp"
|
||||
#include <boost/intrusive/treap_set.hpp>
|
||||
#include "bptr_value.hpp"
|
||||
#include "smart_ptr.hpp"
|
||||
#include "bs_test_common.hpp"
|
||||
#include "generic_set_test.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_insert_before<boost::intrusive::treap_set<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct is_treap<boost::intrusive::treap_set<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
template<class VoidPointer>
|
||||
struct hooks
|
||||
template < class ValueTraits, bool ConstantTimeSize, bool DefaultHolder, bool Map >
|
||||
struct rebinder
|
||||
{
|
||||
typedef bs_set_base_hook<void_pointer<VoidPointer> > base_hook_type;
|
||||
typedef bs_set_base_hook
|
||||
< void_pointer<VoidPointer>
|
||||
, tag<my_tag> > auto_base_hook_type;
|
||||
typedef bs_set_member_hook
|
||||
< void_pointer<VoidPointer> > member_hook_type;
|
||||
typedef bs_set_member_hook
|
||||
< void_pointer<VoidPointer> > auto_member_hook_type;
|
||||
typedef nonhook_node_member< tree_node_traits< VoidPointer >,
|
||||
treap_algorithms
|
||||
> nonhook_node_member_type;
|
||||
typedef tree_rebinder_common<ValueTraits, DefaultHolder, Map> common_t;
|
||||
|
||||
template < class Option1 =void
|
||||
, class Option2 =void
|
||||
>
|
||||
struct container
|
||||
{
|
||||
typedef treap_set
|
||||
< typename common_t::value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<ConstantTimeSize>
|
||||
, typename common_t::holder_opt
|
||||
, typename common_t::key_of_value_opt
|
||||
, Option1
|
||||
, Option2
|
||||
> type;
|
||||
BOOST_STATIC_ASSERT((key_type_tester<typename common_t::key_of_value_opt, type>::value));
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with void node allocator
|
||||
template < bool Default_Holder >
|
||||
struct GetContainer_With_Holder
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
typedef boost::intrusive::treap_set
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
// container generator with standard (non-void) node allocator
|
||||
template <>
|
||||
struct GetContainer_With_Holder< false >
|
||||
{
|
||||
template< class ValueType
|
||||
, class Option1 =void
|
||||
, class Option2 =void
|
||||
, class Option3 =void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// extract node type through options->value_traits->node_traits->node
|
||||
typedef typename pack_options< treap_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename detail::get_value_traits< ValueType, typename packed_options::proto_value_traits>::type value_traits;
|
||||
typedef typename value_traits::node_traits::node node;
|
||||
|
||||
typedef boost::intrusive::treap_set
|
||||
< ValueType
|
||||
, Option1
|
||||
, Option2
|
||||
, Option3
|
||||
, header_holder_type< pointer_holder< node > >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool constant_time_size, bool Default_Holder>
|
||||
template<class VoidPointer, bool ConstantTimeSize, bool DefaultHolder, bool Map>
|
||||
class test_main_template
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
static void execute()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , constant_time_size> value_type;
|
||||
|
||||
test::test_generic_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
test::test_generic_set < nonhook_node_member_value_traits< value_type,
|
||||
typename hooks<VoidPointer>::nonhook_node_member_type,
|
||||
&value_type::nhn_member_,
|
||||
safe_link
|
||||
>,
|
||||
GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
return 0;
|
||||
typedef testvalue_traits< bs_hooks<VoidPointer> > testval_traits_t;
|
||||
//base
|
||||
typedef typename testval_traits_t::base_value_traits base_hook_t;
|
||||
test::test_generic_set
|
||||
< base_hook_t
|
||||
, rebinder<base_hook_t, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//member
|
||||
typedef typename testval_traits_t::member_value_traits member_hook_t;
|
||||
test::test_generic_set
|
||||
< member_hook_t
|
||||
, rebinder<member_hook_t, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
//nonmember
|
||||
test::test_generic_set
|
||||
< typename testval_traits_t::nonhook_value_traits
|
||||
, rebinder<typename testval_traits_t::nonhook_value_traits, ConstantTimeSize, DefaultHolder, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool Default_Holder>
|
||||
class test_main_template<VoidPointer, false, Default_Holder>
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
{
|
||||
using namespace boost::intrusive;
|
||||
typedef testvalue<hooks<VoidPointer> , false> value_type;
|
||||
|
||||
test::test_generic_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::auto_base_hook_type
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
test::test_generic_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::auto_member_hook_type
|
||||
, &value_type::auto_node_
|
||||
>
|
||||
>::type
|
||||
, GetContainer_With_Holder< Default_Holder >::template GetContainer
|
||||
>::test_all();
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
// container generator which ignores further parametrization, except for compare option
|
||||
template < typename Value_Traits, bool ConstantTimeSize, typename HeaderHolder >
|
||||
struct Get_Preset_Container
|
||||
{
|
||||
template < class
|
||||
, class Option1 = void
|
||||
, class Option2 = void
|
||||
, class Option3 = void
|
||||
>
|
||||
struct GetContainer
|
||||
{
|
||||
// ignore further paramatrization except for the compare option
|
||||
// notably ignore the size option (use preset)
|
||||
typedef typename pack_options< treap_defaults, Option1, Option2, Option3 >::type packed_options;
|
||||
typedef typename packed_options::compare compare_option;
|
||||
|
||||
typedef boost::intrusive::treap_set< typename Value_Traits::value_type,
|
||||
value_traits< Value_Traits >,
|
||||
constant_time_size< ConstantTimeSize >,
|
||||
compare< compare_option >,
|
||||
header_holder_type< HeaderHolder >
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template < bool ConstantTimeSize >
|
||||
template < bool ConstantTimeSize, bool Map >
|
||||
struct test_main_template_bptr
|
||||
{
|
||||
void operator () ()
|
||||
{
|
||||
typedef BPtr_Value value_type;
|
||||
typedef BPtr_Value_Traits< Tree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< value_type > allocator_type;
|
||||
static void execute()
|
||||
{
|
||||
typedef BPtr_Value_Traits< Tree_BPtr_Node_Traits > value_traits;
|
||||
typedef bounded_allocator< BPtr_Value > allocator_type;
|
||||
|
||||
allocator_type::init();
|
||||
test::test_generic_set< value_traits,
|
||||
Get_Preset_Container< value_traits, ConstantTimeSize,
|
||||
bounded_pointer_holder< value_type > >::template GetContainer
|
||||
>::test_all();
|
||||
assert(allocator_type::is_clear());
|
||||
allocator_type::destroy();
|
||||
}
|
||||
bounded_allocator_scope<allocator_type> bounded_scope; (void)bounded_scope;
|
||||
test::test_generic_set
|
||||
< value_traits
|
||||
, rebinder< value_traits, ConstantTimeSize, true, Map>
|
||||
>::test_all();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
// test (plain/smart pointers) x (nonconst/const size) x (void node allocator)
|
||||
test_main_template<void*, false, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, false, true>()();
|
||||
test_main_template<void*, true, true>()();
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, true, true>()();
|
||||
// test (bounded pointers) x (nonconst/const size) x (special node allocator)
|
||||
test_main_template_bptr< true >()();
|
||||
test_main_template_bptr< false >()();
|
||||
//Combinations: VoidPointer x ConstantTimeSize x DefaultHolder x Map
|
||||
//Minimize them selecting different combinations for raw and smart pointers
|
||||
//Start with ('false', 'false', 'false') in sets and 'false', 'false', 'true' in multisets
|
||||
|
||||
//void pointer
|
||||
test_main_template<void*, false, false, false>::execute();
|
||||
//test_main_template<void*, false, false, true>::execute();
|
||||
test_main_template<void*, false, true, false>::execute();
|
||||
//test_main_template<void*, false, true, true>::execute();
|
||||
test_main_template<void*, true, false, false>::execute();
|
||||
//test_main_template<void*, true, false, true>::execute();
|
||||
test_main_template<void*, true, true, false>::execute();
|
||||
//test_main_template<void*, true, true, true>::execute();
|
||||
|
||||
//smart_ptr
|
||||
//test_main_template<smart_ptr<void>, false, false, false>::execute();
|
||||
test_main_template<smart_ptr<void>, false, false, true>::execute();
|
||||
//test_main_template<smart_ptr<void>, false, true, false>::execute();
|
||||
test_main_template<smart_ptr<void>, false, true, true>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, false, false>::execute();
|
||||
test_main_template<smart_ptr<void>, true, false, true>::execute();
|
||||
//test_main_template<smart_ptr<void>, true, true, false>::execute();
|
||||
test_main_template<smart_ptr<void>, true, true, true>::execute();
|
||||
|
||||
//bounded_ptr (bool ConstantTimeSize, bool Map)
|
||||
test_main_template_bptr< false, false >::execute();
|
||||
//test_main_template_bptr< false, true >::execute();
|
||||
//test_main_template_bptr< true, false >::execute();
|
||||
test_main_template_bptr< true, true >::execute();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2015.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -23,861 +22,101 @@
|
||||
|
||||
#include "test_macros.hpp"
|
||||
#include "test_container.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct is_unordered<boost::intrusive::unordered_multiset<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
#include "unordered_test_common.hpp"
|
||||
#include "unordered_test.hpp"
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
template<class VoidPointer>
|
||||
struct hooks
|
||||
template < class ValueTraits, bool ConstantTimeSize, bool CacheBegin, bool CompareHash, bool Incremental, bool Map, bool DefaultHolder >
|
||||
struct rebinder
|
||||
{
|
||||
typedef unordered_set_base_hook<void_pointer<VoidPointer> > base_hook_type;
|
||||
typedef unordered_set_base_hook
|
||||
< link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer>
|
||||
, tag<my_tag>
|
||||
, store_hash<true>
|
||||
> auto_base_hook_type;
|
||||
typedef unordered_rebinder_common<ValueTraits, DefaultHolder, Map> common_t;
|
||||
|
||||
typedef unordered_set_member_hook
|
||||
< void_pointer<VoidPointer>
|
||||
, optimize_multikey<true>
|
||||
> member_hook_type;
|
||||
typedef unordered_set_member_hook
|
||||
< link_mode<auto_unlink>, void_pointer<VoidPointer>
|
||||
, store_hash<true>
|
||||
, optimize_multikey<true>
|
||||
> auto_member_hook_type;
|
||||
typedef nonhook_node_member< unordered_node_traits< VoidPointer, true, true >,
|
||||
unordered_algorithms
|
||||
> nonhook_node_member_type;
|
||||
template < class Option1 =void
|
||||
, class Option2 =void
|
||||
>
|
||||
struct container
|
||||
{
|
||||
typedef unordered_multiset
|
||||
< typename common_t::value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<ConstantTimeSize>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
, typename common_t::holder_opt
|
||||
, typename common_t::key_of_value_opt
|
||||
, Option1
|
||||
, Option2
|
||||
> type;
|
||||
BOOST_STATIC_ASSERT((key_type_tester<typename common_t::key_of_value_opt, type>::value));
|
||||
BOOST_STATIC_ASSERT((boost::intrusive::test::is_multikey_true<type>::value));
|
||||
};
|
||||
};
|
||||
|
||||
static const std::size_t BucketSize = 8;
|
||||
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
struct test_unordered_multiset
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
static void test_all (std::vector<value_type>& values);
|
||||
static void test_sort(std::vector<value_type>& values);
|
||||
static void test_insert(std::vector<value_type>& values);
|
||||
static void test_swap(std::vector<value_type>& values);
|
||||
static void test_rehash(std::vector<value_type>& values, detail::true_);
|
||||
static void test_rehash(std::vector<value_type>& values, detail::false_);
|
||||
static void test_find(std::vector<value_type>& values);
|
||||
static void test_impl();
|
||||
static void test_clone(std::vector<value_type>& values);
|
||||
};
|
||||
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>::
|
||||
test_all (std::vector<typename ValueTraits::value_type>& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_multiset
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_multiset_type;
|
||||
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
|
||||
{
|
||||
typename unordered_multiset_type::bucket_type buckets [BucketSize];
|
||||
unordered_multiset_type testset
|
||||
(bucket_traits(pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets[0]), BucketSize));
|
||||
testset.insert(values.begin(), values.end());
|
||||
test::test_container(testset);
|
||||
testset.clear();
|
||||
testset.insert(values.begin(), values.end());
|
||||
test::test_common_unordered_and_associative_container(testset, values);
|
||||
testset.clear();
|
||||
testset.insert(values.begin(), values.end());
|
||||
test::test_unordered_associative_container(testset, values);
|
||||
testset.clear();
|
||||
testset.insert(values.begin(), values.end());
|
||||
test::test_non_unique_container(testset, values);
|
||||
}
|
||||
{
|
||||
std::vector<typename ValueTraits::value_type> values(BucketSize);
|
||||
for (int i = 0; i < (int)BucketSize; ++i)
|
||||
(&values[i])->value_ = i;
|
||||
typename unordered_multiset_type::bucket_type buckets [BucketSize];
|
||||
unordered_multiset_type testset(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets[0]), BucketSize));
|
||||
testset.insert(values.begin(), values.end());
|
||||
test::test_iterator_forward(testset);
|
||||
}
|
||||
test_sort(values);
|
||||
test_insert(values);
|
||||
test_swap(values);
|
||||
test_rehash(values, detail::bool_<Incremental>());
|
||||
test_find(values);
|
||||
test_impl();
|
||||
test_clone(values);
|
||||
}
|
||||
|
||||
//test case due to an error in tree implementation:
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
|
||||
::test_impl()
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_multiset
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_multiset_type;
|
||||
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
|
||||
|
||||
std::vector<value_type> values (5);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
values[i].value_ = i;
|
||||
|
||||
typename unordered_multiset_type::bucket_type buckets [BucketSize];
|
||||
unordered_multiset_type testset(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets[0]), BucketSize));
|
||||
|
||||
for (int i = 0; i < 5; ++i)
|
||||
testset.insert (values[i]);
|
||||
|
||||
testset.erase (testset.iterator_to (values[0]));
|
||||
testset.erase (testset.iterator_to (values[1]));
|
||||
testset.insert (values[1]);
|
||||
|
||||
testset.erase (testset.iterator_to (values[2]));
|
||||
testset.erase (testset.iterator_to (values[3]));
|
||||
}
|
||||
|
||||
//test: constructor, iterator, clear, reverse_iterator, front, back, size:
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
|
||||
::test_sort(std::vector<typename ValueTraits::value_type>& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_multiset
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_multiset_type;
|
||||
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
|
||||
|
||||
typename unordered_multiset_type::bucket_type buckets [BucketSize];
|
||||
unordered_multiset_type testset1
|
||||
(values.begin(), values.end(), bucket_traits
|
||||
(pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets[0]), BucketSize));
|
||||
|
||||
if(Incremental){
|
||||
{ int init_values [] = { 4, 5, 1, 2, 2, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
}
|
||||
else{
|
||||
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
}
|
||||
testset1.clear();
|
||||
BOOST_TEST (testset1.empty());
|
||||
}
|
||||
|
||||
//test: insert, const_iterator, const_reverse_iterator, erase, iterator_to:
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
|
||||
::test_insert(std::vector<typename ValueTraits::value_type>& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_multiset
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_multiset_type;
|
||||
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
|
||||
typedef typename unordered_multiset_type::iterator iterator;
|
||||
{
|
||||
typename unordered_multiset_type::bucket_type buckets [BucketSize];
|
||||
unordered_multiset_type testset(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets[0]), BucketSize));
|
||||
|
||||
testset.insert(&values[0] + 2, &values[0] + 5);
|
||||
|
||||
const unordered_multiset_type& const_testset = testset;
|
||||
|
||||
if(Incremental){
|
||||
{
|
||||
{ int init_values [] = { 4, 5, 1 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
|
||||
|
||||
typename unordered_multiset_type::iterator i = testset.begin();
|
||||
BOOST_TEST (i->value_ == 4);
|
||||
|
||||
i = testset.insert (values[0]);
|
||||
BOOST_TEST (&*i == &values[0]);
|
||||
|
||||
i = testset.iterator_to (values[2]);
|
||||
BOOST_TEST (&*i == &values[2]);
|
||||
testset.erase(i);
|
||||
|
||||
{ int init_values [] = { 5, 1, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
|
||||
testset.clear();
|
||||
testset.insert(&values[0], &values[0] + values.size());
|
||||
|
||||
{ int init_values [] = { 4, 5, 1, 2, 2, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
|
||||
|
||||
BOOST_TEST (testset.erase(1) == 1);
|
||||
BOOST_TEST (testset.erase(2) == 2);
|
||||
BOOST_TEST (testset.erase(3) == 1);
|
||||
BOOST_TEST (testset.erase(4) == 1);
|
||||
BOOST_TEST (testset.erase(5) == 1);
|
||||
BOOST_TEST (testset.empty() == true);
|
||||
|
||||
//Now with a single bucket
|
||||
typename unordered_multiset_type::bucket_type single_bucket[1];
|
||||
unordered_multiset_type testset2(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(single_bucket[0]), 1));
|
||||
testset2.insert(&values[0], &values[0] + values.size());
|
||||
BOOST_TEST (testset2.erase(5) == 1);
|
||||
BOOST_TEST (testset2.erase(2) == 2);
|
||||
BOOST_TEST (testset2.erase(1) == 1);
|
||||
BOOST_TEST (testset2.erase(4) == 1);
|
||||
BOOST_TEST (testset2.erase(3) == 1);
|
||||
BOOST_TEST (testset2.empty() == true);
|
||||
}
|
||||
}
|
||||
else{
|
||||
{
|
||||
{ int init_values [] = { 1, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
|
||||
|
||||
typename unordered_multiset_type::iterator i = testset.begin();
|
||||
BOOST_TEST (i->value_ == 1);
|
||||
|
||||
i = testset.insert (values[0]);
|
||||
BOOST_TEST (&*i == &values[0]);
|
||||
|
||||
i = testset.iterator_to (values[2]);
|
||||
BOOST_TEST (&*i == &values[2]);
|
||||
testset.erase(i);
|
||||
|
||||
{ int init_values [] = { 1, 3, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
|
||||
testset.clear();
|
||||
testset.insert(&values[0], &values[0] + values.size());
|
||||
|
||||
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
|
||||
|
||||
BOOST_TEST (testset.erase(1) == 1);
|
||||
BOOST_TEST (testset.erase(2) == 2);
|
||||
BOOST_TEST (testset.erase(3) == 1);
|
||||
BOOST_TEST (testset.erase(4) == 1);
|
||||
BOOST_TEST (testset.erase(5) == 1);
|
||||
BOOST_TEST (testset.empty() == true);
|
||||
|
||||
//Now with a single bucket
|
||||
typename unordered_multiset_type::bucket_type single_bucket[1];
|
||||
unordered_multiset_type testset2(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(single_bucket[0]), 1));
|
||||
testset2.insert(&values[0], &values[0] + values.size());
|
||||
BOOST_TEST (testset2.erase(5) == 1);
|
||||
BOOST_TEST (testset2.erase(2) == 2);
|
||||
BOOST_TEST (testset2.erase(1) == 1);
|
||||
BOOST_TEST (testset2.erase(4) == 1);
|
||||
BOOST_TEST (testset2.erase(3) == 1);
|
||||
BOOST_TEST (testset2.empty() == true);
|
||||
}
|
||||
}
|
||||
{
|
||||
//Now erase just one per loop
|
||||
const int random_init[] = { 3, 2, 4, 1, 5, 2, 2 };
|
||||
const unsigned int random_size = sizeof(random_init)/sizeof(random_init[0]);
|
||||
typename unordered_multiset_type::bucket_type single_bucket[1];
|
||||
for(unsigned int i = 0, max = random_size; i != max; ++i){
|
||||
std::vector<typename ValueTraits::value_type> data (random_size);
|
||||
for (unsigned int j = 0; j < random_size; ++j)
|
||||
data[j].value_ = random_init[j];
|
||||
unordered_multiset_type testset_new(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(single_bucket[0]), 1));
|
||||
testset_new.insert(&data[0], &data[0]+max);
|
||||
testset_new.erase(testset_new.iterator_to(data[i]));
|
||||
BOOST_TEST (testset_new.size() == (max -1));
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
typename unordered_multiset_type::bucket_type buckets [BucketSize];
|
||||
const unsigned int NumBucketSize = BucketSize;
|
||||
const unsigned int LoadFactor = 3;
|
||||
const unsigned int NumIterations = NumBucketSize*LoadFactor;
|
||||
std::vector<value_type> random_init(NumIterations);//Preserve memory
|
||||
std::vector<value_type> set_tester;
|
||||
set_tester.reserve(NumIterations);
|
||||
|
||||
//Initialize values
|
||||
for (unsigned int i = 0; i < NumIterations; ++i){
|
||||
random_init[i].value_ = i*2;//(i/LoadFactor)*LoadFactor;
|
||||
}
|
||||
|
||||
for(unsigned int initial_pos = 0; initial_pos != (NumIterations+1); ++initial_pos){
|
||||
for(unsigned int final_pos = initial_pos; final_pos != (NumIterations+1); ++final_pos){
|
||||
|
||||
//Create intrusive container inserting values
|
||||
unordered_multiset_type testset
|
||||
( &random_init[0]
|
||||
, &random_init[0] + random_init.size()
|
||||
, bucket_traits(pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets[0]), NumBucketSize));
|
||||
|
||||
BOOST_TEST (testset.size() == random_init.size());
|
||||
|
||||
//Obtain the iterator range to erase
|
||||
iterator it_beg_pos = testset.begin();
|
||||
for(unsigned int it_beg_pos_num = 0; it_beg_pos_num != initial_pos; ++it_beg_pos_num){
|
||||
++it_beg_pos;
|
||||
}
|
||||
iterator it_end_pos(it_beg_pos);
|
||||
for(unsigned int it_end_pos_num = 0; it_end_pos_num != (final_pos - initial_pos); ++it_end_pos_num){
|
||||
++it_end_pos;
|
||||
}
|
||||
|
||||
//Erase the same values in both the intrusive and original vector
|
||||
std::size_t erased_cnt = boost::intrusive::iterator_distance(it_beg_pos, it_end_pos);
|
||||
|
||||
//Erase values from the intrusive container
|
||||
testset.erase(it_beg_pos, it_end_pos);
|
||||
|
||||
BOOST_TEST (testset.size() == (random_init.size()-(final_pos - initial_pos)));
|
||||
|
||||
//Now test...
|
||||
BOOST_TEST ((random_init.size() - erased_cnt) == testset.size());
|
||||
|
||||
//Create an ordered copy of the intrusive container
|
||||
set_tester.insert(set_tester.end(), testset.begin(), testset.end());
|
||||
std::sort(set_tester.begin(), set_tester.end());
|
||||
{
|
||||
typename std::vector<value_type>::iterator it = set_tester.begin(), itend = set_tester.end();
|
||||
typename std::vector<value_type>::iterator random_init_it(random_init.begin());
|
||||
for( ; it != itend; ++it){
|
||||
while(!random_init_it->is_linked())
|
||||
++random_init_it;
|
||||
BOOST_TEST(*it == *random_init_it);
|
||||
++random_init_it;
|
||||
}
|
||||
}
|
||||
set_tester.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//test: insert (seq-version), swap, erase (seq-version), size:
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>::
|
||||
test_swap(std::vector<typename ValueTraits::value_type>& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_multiset
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_multiset_type;
|
||||
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
|
||||
typename unordered_multiset_type::bucket_type buckets [BucketSize];
|
||||
|
||||
typename unordered_multiset_type::bucket_type buckets2 [BucketSize];
|
||||
unordered_multiset_type testset1(&values[0], &values[0] + 2,
|
||||
bucket_traits(pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets[0]), BucketSize));
|
||||
unordered_multiset_type testset2(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets2[0]), BucketSize));
|
||||
|
||||
testset2.insert (&values[0] + 2, &values[0] + 6);
|
||||
testset1.swap (testset2);
|
||||
|
||||
if(Incremental){
|
||||
{ int init_values [] = { 4, 5, 1, 2 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
{ int init_values [] = { 2, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset2.begin() ); }
|
||||
testset1.erase (testset1.iterator_to(values[4]), testset1.end());
|
||||
BOOST_TEST (testset1.size() == 1);
|
||||
// BOOST_TEST (&testset1.front() == &values[3]);
|
||||
BOOST_TEST (&*testset1.begin() == &values[2]);
|
||||
}
|
||||
else{
|
||||
{ int init_values [] = { 1, 2, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
{ int init_values [] = { 2, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset2.begin() ); }
|
||||
testset1.erase (testset1.iterator_to(values[5]), testset1.end());
|
||||
BOOST_TEST (testset1.size() == 1);
|
||||
// BOOST_TEST (&testset1.front() == &values[3]);
|
||||
BOOST_TEST (&*testset1.begin() == &values[3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//test: rehash:
|
||||
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
|
||||
::test_rehash(std::vector<typename ValueTraits::value_type>& values, detail::true_)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_multiset
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_multiset_type;
|
||||
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
|
||||
//Build a uset
|
||||
typename unordered_multiset_type::bucket_type buckets1 [BucketSize];
|
||||
typename unordered_multiset_type::bucket_type buckets2 [BucketSize*2];
|
||||
unordered_multiset_type testset1(&values[0], &values[0] + values.size(),
|
||||
bucket_traits(pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize));
|
||||
//Test current state
|
||||
BOOST_TEST(testset1.split_count() == BucketSize/2);
|
||||
{ int init_values [] = { 4, 5, 1, 2, 2, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
//Incremental rehash step
|
||||
BOOST_TEST (testset1.incremental_rehash() == true);
|
||||
BOOST_TEST(testset1.split_count() == (BucketSize/2+1));
|
||||
{ int init_values [] = { 5, 1, 2, 2, 3, 4 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
//Rest of incremental rehashes should lead to the same sequence
|
||||
for(std::size_t split_bucket = testset1.split_count(); split_bucket != BucketSize; ++split_bucket){
|
||||
BOOST_TEST (testset1.incremental_rehash() == true);
|
||||
BOOST_TEST(testset1.split_count() == (split_bucket+1));
|
||||
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
}
|
||||
//This incremental rehash should fail because we've reached the end of the bucket array
|
||||
BOOST_TEST (testset1.incremental_rehash() == false);
|
||||
BOOST_TEST(testset1.split_count() == BucketSize);
|
||||
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
//
|
||||
//Try incremental hashing specifying a new bucket traits pointing to the same array
|
||||
//
|
||||
//This incremental rehash should fail because the new size is not twice the original
|
||||
BOOST_TEST(testset1.incremental_rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize)) == false);
|
||||
BOOST_TEST(testset1.split_count() == BucketSize);
|
||||
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
//
|
||||
//Try incremental hashing specifying a new bucket traits pointing to the same array
|
||||
//
|
||||
//This incremental rehash should fail because the new size is not twice the original
|
||||
BOOST_TEST(testset1.incremental_rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets2[0]), BucketSize)) == false);
|
||||
BOOST_TEST(testset1.split_count() == BucketSize);
|
||||
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
//This incremental rehash should success because the new size is twice the original
|
||||
//and split_count is the same as the old bucket count
|
||||
BOOST_TEST(testset1.incremental_rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets2[0]), BucketSize*2)) == true);
|
||||
BOOST_TEST(testset1.split_count() == BucketSize);
|
||||
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
//This incremental rehash should also success because the new size is half the original
|
||||
//and split_count is the same as the new bucket count
|
||||
BOOST_TEST(testset1.incremental_rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize)) == true);
|
||||
BOOST_TEST(testset1.split_count() == BucketSize);
|
||||
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
//Full shrink rehash
|
||||
testset1.rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), 4));
|
||||
BOOST_TEST (testset1.size() == values.size());
|
||||
BOOST_TEST (testset1.incremental_rehash() == false);
|
||||
{ int init_values [] = { 4, 5, 1, 2, 2, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
//Full shrink rehash again
|
||||
testset1.rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), 2));
|
||||
BOOST_TEST (testset1.size() == values.size());
|
||||
BOOST_TEST (testset1.incremental_rehash() == false);
|
||||
{ int init_values [] = { 2, 2, 4, 3, 5, 1 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
//Full growing rehash
|
||||
testset1.rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize));
|
||||
BOOST_TEST (testset1.size() == values.size());
|
||||
BOOST_TEST (testset1.incremental_rehash() == false);
|
||||
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
//Incremental rehash shrinking
|
||||
//First incremental rehashes should lead to the same sequence
|
||||
for(std::size_t split_bucket = testset1.split_count(); split_bucket > 6; --split_bucket){
|
||||
BOOST_TEST (testset1.incremental_rehash(false) == true);
|
||||
BOOST_TEST(testset1.split_count() == (split_bucket-1));
|
||||
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
}
|
||||
//Incremental rehash step
|
||||
BOOST_TEST (testset1.incremental_rehash(false) == true);
|
||||
BOOST_TEST(testset1.split_count() == (BucketSize/2+1));
|
||||
{ int init_values [] = { 5, 1, 2, 2, 3, 4 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
//Incremental rehash step 2
|
||||
BOOST_TEST (testset1.incremental_rehash(false) == true);
|
||||
BOOST_TEST(testset1.split_count() == (BucketSize/2));
|
||||
{ int init_values [] = { 4, 5, 1, 2, 2, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
//This incremental rehash should fail because we've reached the half of the bucket array
|
||||
BOOST_TEST(testset1.incremental_rehash(false) == false);
|
||||
BOOST_TEST(testset1.split_count() == BucketSize/2);
|
||||
{ int init_values [] = { 4, 5, 1, 2, 2, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
}
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
|
||||
::test_rehash(std::vector<typename ValueTraits::value_type>& values, detail::false_)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_multiset
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_multiset_type;
|
||||
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
|
||||
|
||||
typename unordered_multiset_type::bucket_type buckets1 [BucketSize];
|
||||
typename unordered_multiset_type::bucket_type buckets2 [2];
|
||||
typename unordered_multiset_type::bucket_type buckets3 [BucketSize*2];
|
||||
|
||||
unordered_multiset_type testset1(&values[0], &values[0] + 6, bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize));
|
||||
BOOST_TEST (testset1.size() == values.size());
|
||||
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
testset1.rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets2[0]), 2));
|
||||
BOOST_TEST (testset1.size() == values.size());
|
||||
{ int init_values [] = { 4, 2, 2, 5, 3, 1 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
testset1.rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets3[0]), BucketSize*2));
|
||||
BOOST_TEST (testset1.size() == values.size());
|
||||
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
//Now rehash reducing the buckets
|
||||
testset1.rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets3[0]), 2));
|
||||
BOOST_TEST (testset1.size() == values.size());
|
||||
{ int init_values [] = { 4, 2, 2, 5, 3, 1 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
//Now rehash increasing the buckets
|
||||
testset1.rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets3[0]), BucketSize*2));
|
||||
BOOST_TEST (testset1.size() == values.size());
|
||||
{ int init_values [] = { 1, 2, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
}
|
||||
|
||||
//test: find, equal_range (lower_bound, upper_bound):
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>::
|
||||
test_find(std::vector<typename ValueTraits::value_type>& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_multiset
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_multiset_type;
|
||||
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
|
||||
|
||||
typename unordered_multiset_type::bucket_type buckets[BucketSize];
|
||||
unordered_multiset_type testset(values.begin(), values.end(), bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets[0]), BucketSize));
|
||||
|
||||
typedef typename unordered_multiset_type::iterator iterator;
|
||||
|
||||
value_type cmp_val;
|
||||
cmp_val.value_ = 2;
|
||||
iterator i = testset.find (cmp_val);
|
||||
BOOST_TEST (i->value_ == 2);
|
||||
BOOST_TEST ((++i)->value_ == 2);
|
||||
std::pair<iterator,iterator> range = testset.equal_range (cmp_val);
|
||||
|
||||
BOOST_TEST (range.first->value_ == 2);
|
||||
BOOST_TEST (range.second->value_ == 3);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 2);
|
||||
|
||||
cmp_val.value_ = 7;
|
||||
BOOST_TEST (testset.find (cmp_val) == testset.end());
|
||||
}
|
||||
|
||||
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
|
||||
::test_clone(std::vector<typename ValueTraits::value_type>& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_multiset
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_multiset_type;
|
||||
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
|
||||
{
|
||||
//Test with equal bucket arrays
|
||||
typename unordered_multiset_type::bucket_type buckets1 [BucketSize];
|
||||
typename unordered_multiset_type::bucket_type buckets2 [BucketSize];
|
||||
unordered_multiset_type testset1 (values.begin(), values.end(), bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize));
|
||||
unordered_multiset_type testset2 (bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets2[0]), BucketSize));
|
||||
|
||||
testset2.clone_from(testset1, test::new_cloner<value_type>(), test::delete_disposer<value_type>());
|
||||
//Ordering is not guarantee in the cloning so insert data in a set and test
|
||||
std::multiset<typename ValueTraits::value_type>
|
||||
src(testset1.begin(), testset1.end());
|
||||
std::multiset<typename ValueTraits::value_type>
|
||||
dst(testset2.begin(), testset2.end());
|
||||
BOOST_TEST (src.size() == dst.size() && std::equal(src.begin(), src.end(), dst.begin()));
|
||||
testset2.clear_and_dispose(test::delete_disposer<value_type>());
|
||||
BOOST_TEST (testset2.empty());
|
||||
}
|
||||
{
|
||||
//Test with bigger source bucket arrays
|
||||
typename unordered_multiset_type::bucket_type buckets1 [BucketSize*2];
|
||||
typename unordered_multiset_type::bucket_type buckets2 [BucketSize];
|
||||
unordered_multiset_type testset1 (values.begin(), values.end(), bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize*2));
|
||||
unordered_multiset_type testset2 (bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets2[0]), BucketSize));
|
||||
|
||||
testset2.clone_from(testset1, test::new_cloner<value_type>(), test::delete_disposer<value_type>());
|
||||
//Ordering is not guarantee in the cloning so insert data in a set and test
|
||||
std::multiset<typename ValueTraits::value_type>
|
||||
src(testset1.begin(), testset1.end());
|
||||
std::multiset<typename ValueTraits::value_type>
|
||||
dst(testset2.begin(), testset2.end());
|
||||
BOOST_TEST (src.size() == dst.size() && std::equal(src.begin(), src.end(), dst.begin()));
|
||||
testset2.clear_and_dispose(test::delete_disposer<value_type>());
|
||||
BOOST_TEST (testset2.empty());
|
||||
}
|
||||
{
|
||||
//Test with smaller source bucket arrays
|
||||
typename unordered_multiset_type::bucket_type buckets1 [BucketSize];
|
||||
typename unordered_multiset_type::bucket_type buckets2 [BucketSize*2];
|
||||
unordered_multiset_type testset1 (values.begin(), values.end(), bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize));
|
||||
unordered_multiset_type testset2 (bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
pointer_to(buckets2[0]), BucketSize*2));
|
||||
|
||||
testset2.clone_from(testset1, test::new_cloner<value_type>(), test::delete_disposer<value_type>());
|
||||
//Ordering is not guaranteed in the cloning so insert data in a set and test
|
||||
std::multiset<typename ValueTraits::value_type>
|
||||
src(testset1.begin(), testset1.end());
|
||||
std::multiset<typename ValueTraits::value_type>
|
||||
dst(testset2.begin(), testset2.end());
|
||||
BOOST_TEST (src.size() == dst.size() && std::equal(src.begin(), src.end(), dst.begin()));
|
||||
testset2.clear_and_dispose(test::delete_disposer<value_type>());
|
||||
BOOST_TEST (testset2.empty());
|
||||
}
|
||||
}
|
||||
|
||||
template<class VoidPointer, bool constant_time_size, bool Incremental>
|
||||
template<class VoidPointer, bool ConstantTimeSize, bool Map, bool DefaultHolder>
|
||||
class test_main_template
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
static void execute()
|
||||
{
|
||||
typedef testvalue<hooks<VoidPointer> , constant_time_size> value_type;
|
||||
typedef testvalue<unordered_hooks<VoidPointer> > value_type;
|
||||
static const int random_init[6] = { 3, 2, 4, 1, 5, 2 };
|
||||
std::vector<testvalue<hooks<VoidPointer> , constant_time_size> > data (6);
|
||||
typedef typename ValueContainer< value_type >::type value_cont_type;
|
||||
value_cont_type data (6);
|
||||
for (int i = 0; i < 6; ++i)
|
||||
data[i].value_ = random_init[i];
|
||||
|
||||
test_unordered_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, true
|
||||
, false
|
||||
, Incremental
|
||||
>::test_all(data);
|
||||
|
||||
test_unordered_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, false
|
||||
, false
|
||||
, Incremental
|
||||
>::test_all(data);
|
||||
test_unordered_multiset < nonhook_node_member_value_traits< value_type,
|
||||
typename hooks<VoidPointer>::nonhook_node_member_type,
|
||||
&value_type::nhn_member_,
|
||||
safe_link
|
||||
>,
|
||||
false,
|
||||
false,
|
||||
Incremental
|
||||
>::test_all(data);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool Incremental>
|
||||
class test_main_template<VoidPointer, false, Incremental>
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
{
|
||||
typedef testvalue<hooks<VoidPointer> , false> value_type;
|
||||
static const int random_init[6] = { 3, 2, 4, 1, 5, 2 };
|
||||
std::vector<testvalue<hooks<VoidPointer> , false> > data (6);
|
||||
for (int i = 0; i < 6; ++i)
|
||||
data[i].value_ = random_init[i];
|
||||
|
||||
test_unordered_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, false
|
||||
, false
|
||||
, Incremental
|
||||
>::test_all(data);
|
||||
|
||||
test_unordered_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, true
|
||||
, false
|
||||
, Incremental
|
||||
>::test_all(data);
|
||||
|
||||
test_unordered_multiset < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::auto_base_hook_type
|
||||
>::type
|
||||
, false
|
||||
, false
|
||||
, Incremental
|
||||
>::test_all(data);
|
||||
|
||||
test_unordered_multiset < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::auto_member_hook_type
|
||||
, &value_type::auto_node_
|
||||
>
|
||||
>::type
|
||||
, false
|
||||
, true
|
||||
, Incremental
|
||||
>::test_all(data);
|
||||
return 0;
|
||||
typedef testvalue_traits< unordered_hooks<VoidPointer> > testval_traits_t;
|
||||
//base
|
||||
typedef typename detail::if_c
|
||||
< ConstantTimeSize
|
||||
, typename testval_traits_t::base_value_traits
|
||||
, typename testval_traits_t::auto_base_value_traits //store_hash<true>
|
||||
>::type base_hook_t;
|
||||
test::test_unordered
|
||||
< base_hook_t //cache_begin, compare_hash, incremental
|
||||
, rebinder<base_hook_t, ConstantTimeSize, ConstantTimeSize, !ConstantTimeSize, !!ConstantTimeSize, Map, DefaultHolder>
|
||||
>::test_all(data);
|
||||
//member
|
||||
typedef typename detail::if_c
|
||||
< ConstantTimeSize
|
||||
, typename testval_traits_t::member_value_traits //optimize_multikey<true>
|
||||
, typename testval_traits_t::auto_member_value_traits //store_hash<true>, optimize_multikey<true>
|
||||
>::type member_hook_t;
|
||||
test::test_unordered
|
||||
< member_hook_t //cache_begin, compare_hash, incremental
|
||||
, rebinder<member_hook_t, ConstantTimeSize, false, !ConstantTimeSize, false, !ConstantTimeSize, DefaultHolder>
|
||||
>::test_all(data);
|
||||
//nonmember
|
||||
test::test_unordered
|
||||
< typename testval_traits_t::nonhook_value_traits //cache_begin, compare_hash, incremental
|
||||
, rebinder<typename testval_traits_t::nonhook_value_traits, ConstantTimeSize, false, false, false, Map, DefaultHolder>
|
||||
>::test_all(data);
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
test_main_template<void*, false, true>()();
|
||||
test_main_template<smart_ptr<void>, false, true>()();
|
||||
test_main_template<void*, true, true>()();
|
||||
test_main_template<smart_ptr<void>, true, true>()();
|
||||
test_main_template<void*, false, false>()();
|
||||
test_main_template<smart_ptr<void>, false, false>()();
|
||||
test_main_template<void*, true, true>()();
|
||||
test_main_template<smart_ptr<void>, true, false>()();
|
||||
//VoidPointer x ConstantTimeSize x Map x DefaultHolder
|
||||
|
||||
//void pointer
|
||||
test_main_template<void*, false, false, false>::execute();
|
||||
test_main_template<void*, false, true, false>::execute();
|
||||
test_main_template<void*, true, false, false>::execute();
|
||||
test_main_template<void*, true, true, false>::execute();
|
||||
|
||||
//smart_ptr
|
||||
test_main_template<smart_ptr<void>, false, false, false>::execute();
|
||||
test_main_template<smart_ptr<void>, false, true, false>::execute();
|
||||
test_main_template<smart_ptr<void>, true, false, false>::execute();
|
||||
test_main_template<smart_ptr<void>, true, true, false>::execute();
|
||||
/*
|
||||
//bounded_ptr (bool ConstantTimeSize, bool Map)
|
||||
test_main_template_bptr< false, false >::execute();
|
||||
//test_main_template_bptr< false, true >::execute();
|
||||
//test_main_template_bptr< true, false >::execute();
|
||||
test_main_template_bptr< true, true >::execute();
|
||||
*/
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
+77
-692
@@ -1,7 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2015.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -21,715 +20,101 @@
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_macros.hpp"
|
||||
#include "test_container.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct is_unordered<boost::intrusive::unordered_set<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
#include "unordered_test_common.hpp"
|
||||
#include "unordered_test.hpp"
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
template<class VoidPointer>
|
||||
struct hooks
|
||||
template < class ValueTraits, bool ConstantTimeSize, bool CacheBegin, bool CompareHash, bool Incremental, bool Map, bool DefaultHolder >
|
||||
struct rebinder
|
||||
{
|
||||
typedef unordered_set_base_hook<void_pointer<VoidPointer> > base_hook_type;
|
||||
typedef unordered_set_base_hook
|
||||
< link_mode<auto_unlink>
|
||||
, void_pointer<VoidPointer>
|
||||
, tag<my_tag>
|
||||
, store_hash<true>
|
||||
> auto_base_hook_type;
|
||||
typedef unordered_rebinder_common<ValueTraits, DefaultHolder, Map> common_t;
|
||||
|
||||
typedef unordered_set_member_hook
|
||||
< void_pointer<VoidPointer>
|
||||
, optimize_multikey<true>
|
||||
> member_hook_type;
|
||||
typedef unordered_set_member_hook
|
||||
< link_mode<auto_unlink>, void_pointer<VoidPointer>
|
||||
, store_hash<true>
|
||||
, optimize_multikey<true>
|
||||
> auto_member_hook_type;
|
||||
typedef nonhook_node_member< unordered_node_traits< VoidPointer, true, true >,
|
||||
unordered_algorithms
|
||||
> nonhook_node_member_type;
|
||||
template < class Option1 =void
|
||||
, class Option2 =void
|
||||
>
|
||||
struct container
|
||||
{
|
||||
typedef unordered_set
|
||||
< typename common_t::value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<ConstantTimeSize>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
, typename common_t::holder_opt
|
||||
, typename common_t::key_of_value_opt
|
||||
, Option1
|
||||
, Option2
|
||||
> type;
|
||||
BOOST_STATIC_ASSERT((key_type_tester<typename common_t::key_of_value_opt, type>::value));
|
||||
BOOST_STATIC_ASSERT((!boost::intrusive::test::is_multikey_true<type>::value));
|
||||
};
|
||||
};
|
||||
|
||||
static const std::size_t BucketSize = 8;
|
||||
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
struct test_unordered_set
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
static void test_all(std::vector<value_type>& values);
|
||||
static void test_sort(std::vector<value_type>& values);
|
||||
static void test_insert(std::vector<value_type>& values);
|
||||
static void test_swap(std::vector<value_type>& values);
|
||||
static void test_rehash(std::vector<value_type>& values, detail::true_);
|
||||
static void test_rehash(std::vector<value_type>& values, detail::false_);
|
||||
static void test_find(std::vector<value_type>& values);
|
||||
static void test_impl();
|
||||
static void test_clone(std::vector<value_type>& values);
|
||||
};
|
||||
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
|
||||
test_all(std::vector<typename ValueTraits::value_type>& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_set
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_set_type;
|
||||
typedef typename unordered_set_type::bucket_traits bucket_traits;
|
||||
{
|
||||
typename unordered_set_type::bucket_type buckets [BucketSize];
|
||||
unordered_set_type testset(bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets[0]), BucketSize));
|
||||
testset.insert(values.begin(), values.end());
|
||||
test::test_container(testset);
|
||||
testset.clear();
|
||||
testset.insert(values.begin(), values.end());
|
||||
test::test_common_unordered_and_associative_container(testset, values);
|
||||
testset.clear();
|
||||
testset.insert(values.begin(), values.end());
|
||||
test::test_unordered_associative_container(testset, values);
|
||||
testset.clear();
|
||||
testset.insert(values.begin(), values.end());
|
||||
test::test_unique_container(testset, values);
|
||||
}
|
||||
{
|
||||
std::vector<typename ValueTraits::value_type> values(BucketSize);
|
||||
for (int i = 0; i < (int)BucketSize; ++i)
|
||||
(&values[i])->value_ = i;
|
||||
typename unordered_set_type::bucket_type buckets [BucketSize];
|
||||
unordered_set_type testset(bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets[0]), BucketSize));
|
||||
testset.insert(values.begin(), values.end());
|
||||
test::test_iterator_forward(testset);
|
||||
}
|
||||
test_sort(values);
|
||||
test_insert(values);
|
||||
test_swap(values);
|
||||
test_rehash(values, detail::bool_<Incremental>());
|
||||
test_find(values);
|
||||
test_impl();
|
||||
test_clone(values);
|
||||
}
|
||||
|
||||
//test case due to an error in tree implementation:
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::test_impl()
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_set
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_set_type;
|
||||
typedef typename unordered_set_type::bucket_traits bucket_traits;
|
||||
|
||||
std::vector<value_type> values (5);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
values[i].value_ = i;
|
||||
|
||||
typename unordered_set_type::bucket_type buckets [BucketSize];
|
||||
unordered_set_type testset(bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets[0]), BucketSize));
|
||||
for (int i = 0; i < 5; ++i)
|
||||
testset.insert (values[i]);
|
||||
|
||||
testset.erase (testset.iterator_to (values[0]));
|
||||
testset.erase (testset.iterator_to (values[1]));
|
||||
testset.insert (values[1]);
|
||||
testset.erase (testset.iterator_to (values[2]));
|
||||
testset.erase (testset.iterator_to (values[3]));
|
||||
}
|
||||
|
||||
//test: constructor, iterator, clear, reverse_iterator, front, back, size:
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
|
||||
test_sort(std::vector<typename ValueTraits::value_type>& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_set
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_set_type;
|
||||
typedef typename unordered_set_type::bucket_traits bucket_traits;
|
||||
|
||||
typename unordered_set_type::bucket_type buckets [BucketSize];
|
||||
unordered_set_type testset1(values.begin(), values.end(), bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets[0]), BucketSize));
|
||||
BOOST_TEST (5 == boost::intrusive::iterator_distance(testset1.begin(), testset1.end()));
|
||||
|
||||
if(Incremental){
|
||||
{ int init_values [] = { 4, 5, 1, 2, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
}
|
||||
else{
|
||||
{ int init_values [] = { 1, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
}
|
||||
|
||||
testset1.clear();
|
||||
BOOST_TEST (testset1.empty());
|
||||
}
|
||||
|
||||
//test: insert, const_iterator, const_reverse_iterator, erase, iterator_to:
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
|
||||
test_insert(std::vector<typename ValueTraits::value_type>& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_set
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_set_type;
|
||||
typedef typename unordered_set_type::bucket_traits bucket_traits;
|
||||
|
||||
typename unordered_set_type::bucket_type buckets [BucketSize];
|
||||
unordered_set_type testset(bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets[0]), BucketSize));
|
||||
testset.insert(&values[0] + 2, &values[0] + 5);
|
||||
|
||||
const unordered_set_type& const_testset = testset;
|
||||
if(Incremental)
|
||||
{
|
||||
{ int init_values [] = { 4, 5, 1 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
|
||||
typename unordered_set_type::iterator i = testset.begin();
|
||||
BOOST_TEST (i->value_ == 4);
|
||||
|
||||
i = testset.insert(values[0]).first;
|
||||
BOOST_TEST (&*i == &values[0]);
|
||||
|
||||
i = testset.iterator_to (values[2]);
|
||||
BOOST_TEST (&*i == &values[2]);
|
||||
|
||||
testset.erase (i);
|
||||
|
||||
{ int init_values [] = { 5, 1, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
|
||||
}
|
||||
else{
|
||||
{ int init_values [] = { 1, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
|
||||
typename unordered_set_type::iterator i = testset.begin();
|
||||
BOOST_TEST (i->value_ == 1);
|
||||
|
||||
i = testset.insert(values[0]).first;
|
||||
BOOST_TEST (&*i == &values[0]);
|
||||
|
||||
i = testset.iterator_to (values[2]);
|
||||
BOOST_TEST (&*i == &values[2]);
|
||||
|
||||
testset.erase (i);
|
||||
|
||||
{ int init_values [] = { 1, 3, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
|
||||
}
|
||||
}
|
||||
|
||||
//test: insert (seq-version), swap, erase (seq-version), size:
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
|
||||
test_swap(std::vector<typename ValueTraits::value_type>& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_set
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_set_type;
|
||||
typedef typename unordered_set_type::bucket_traits bucket_traits;
|
||||
|
||||
typename unordered_set_type::bucket_type buckets1 [BucketSize];
|
||||
typename unordered_set_type::bucket_type buckets2 [BucketSize];
|
||||
unordered_set_type testset1(&values[0], &values[0] + 2, bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize));
|
||||
unordered_set_type testset2(bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets2[0]), BucketSize));
|
||||
|
||||
testset2.insert (&values[0] + 2, &values[0] + 6);
|
||||
testset1.swap (testset2);
|
||||
|
||||
if(Incremental){
|
||||
{ int init_values [] = { 4, 5, 1, 2 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
{ int init_values [] = { 2, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset2.begin() ); }
|
||||
testset1.erase (testset1.iterator_to(values[4]), testset1.end());
|
||||
BOOST_TEST (testset1.size() == 1);
|
||||
BOOST_TEST (&*testset1.begin() == &values[2]);
|
||||
}
|
||||
else{
|
||||
{ int init_values [] = { 1, 2, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
{ int init_values [] = { 2, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset2.begin() ); }
|
||||
testset1.erase (testset1.iterator_to(values[5]), testset1.end());
|
||||
BOOST_TEST (testset1.size() == 1);
|
||||
BOOST_TEST (&*testset1.begin() == &values[3]);
|
||||
}
|
||||
}
|
||||
|
||||
//test: rehash:
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
|
||||
test_rehash(std::vector<typename ValueTraits::value_type>& values, detail::true_)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_set
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_set_type;
|
||||
typedef typename unordered_set_type::bucket_traits bucket_traits;
|
||||
//Build a uset
|
||||
typename unordered_set_type::bucket_type buckets1 [BucketSize];
|
||||
typename unordered_set_type::bucket_type buckets2 [BucketSize*2];
|
||||
unordered_set_type testset1(&values[0], &values[0] + 6, bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize));
|
||||
//Test current state
|
||||
BOOST_TEST(testset1.split_count() == BucketSize/2);
|
||||
{ int init_values [] = { 4, 5, 1, 2, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
//Incremental rehash step
|
||||
BOOST_TEST (testset1.incremental_rehash() == true);
|
||||
BOOST_TEST(testset1.split_count() == (BucketSize/2+1));
|
||||
{ int init_values [] = { 5, 1, 2, 3, 4 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
//Rest of incremental rehashes should lead to the same sequence
|
||||
for(std::size_t split_bucket = testset1.split_count(); split_bucket != BucketSize; ++split_bucket){
|
||||
BOOST_TEST (testset1.incremental_rehash() == true);
|
||||
BOOST_TEST(testset1.split_count() == (split_bucket+1));
|
||||
{ int init_values [] = { 1, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
}
|
||||
//This incremental rehash should fail because we've reached the end of the bucket array
|
||||
BOOST_TEST(testset1.incremental_rehash() == false);
|
||||
BOOST_TEST(testset1.split_count() == BucketSize);
|
||||
{ int init_values [] = { 1, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
//
|
||||
//Try incremental hashing specifying a new bucket traits pointing to the same array
|
||||
//
|
||||
//This incremental rehash should fail because the new size is not twice the original
|
||||
BOOST_TEST(testset1.incremental_rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize)) == false);
|
||||
BOOST_TEST(testset1.split_count() == BucketSize);
|
||||
{ int init_values [] = { 1, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
//
|
||||
//Try incremental hashing specifying a new bucket traits pointing to the same array
|
||||
//
|
||||
//This incremental rehash should fail because the new size is not twice the original
|
||||
BOOST_TEST(testset1.incremental_rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets2[0]), BucketSize)) == false);
|
||||
BOOST_TEST(testset1.split_count() == BucketSize);
|
||||
{ int init_values [] = { 1, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
//This incremental rehash should success because the new size is twice the original
|
||||
//and split_count is the same as the old bucket count
|
||||
BOOST_TEST(testset1.incremental_rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets2[0]), BucketSize*2)) == true);
|
||||
BOOST_TEST(testset1.split_count() == BucketSize);
|
||||
{ int init_values [] = { 1, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
//This incremental rehash should also success because the new size is half the original
|
||||
//and split_count is the same as the new bucket count
|
||||
BOOST_TEST(testset1.incremental_rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize)) == true);
|
||||
BOOST_TEST(testset1.split_count() == BucketSize);
|
||||
{ int init_values [] = { 1, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
//Full shrink rehash
|
||||
testset1.rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), 4));
|
||||
BOOST_TEST (testset1.size() == values.size()-1);
|
||||
BOOST_TEST (testset1.incremental_rehash() == false);
|
||||
{ int init_values [] = { 4, 5, 1, 2, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
//Full shrink rehash again
|
||||
testset1.rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), 2));
|
||||
BOOST_TEST (testset1.size() == values.size()-1);
|
||||
BOOST_TEST (testset1.incremental_rehash() == false);
|
||||
{ int init_values [] = { 2, 4, 3, 5, 1 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
//Full growing rehash
|
||||
testset1.rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize));
|
||||
BOOST_TEST (testset1.size() == values.size()-1);
|
||||
BOOST_TEST (testset1.incremental_rehash() == false);
|
||||
{ int init_values [] = { 1, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
//Incremental rehash shrinking
|
||||
//First incremental rehashes should lead to the same sequence
|
||||
for(std::size_t split_bucket = testset1.split_count(); split_bucket > 6; --split_bucket){
|
||||
BOOST_TEST (testset1.incremental_rehash(false) == true);
|
||||
BOOST_TEST(testset1.split_count() == (split_bucket-1));
|
||||
{ int init_values [] = { 1, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
}
|
||||
//Incremental rehash step
|
||||
BOOST_TEST (testset1.incremental_rehash(false) == true);
|
||||
BOOST_TEST(testset1.split_count() == (BucketSize/2+1));
|
||||
{ int init_values [] = { 5, 1, 2, 3, 4 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
//Incremental rehash step 2
|
||||
BOOST_TEST (testset1.incremental_rehash(false) == true);
|
||||
BOOST_TEST(testset1.split_count() == (BucketSize/2));
|
||||
{ int init_values [] = { 4, 5, 1, 2, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
//This incremental rehash should fail because we've reached the half of the bucket array
|
||||
BOOST_TEST(testset1.incremental_rehash(false) == false);
|
||||
BOOST_TEST(testset1.split_count() == BucketSize/2);
|
||||
{ int init_values [] = { 4, 5, 1, 2, 3 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
}
|
||||
|
||||
//test: rehash:
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
|
||||
test_rehash(std::vector<typename ValueTraits::value_type>& values, detail::false_)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_set
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_set_type;
|
||||
typedef typename unordered_set_type::bucket_traits bucket_traits;
|
||||
|
||||
typename unordered_set_type::bucket_type buckets1 [BucketSize];
|
||||
typename unordered_set_type::bucket_type buckets2 [2];
|
||||
typename unordered_set_type::bucket_type buckets3 [BucketSize*2];
|
||||
|
||||
unordered_set_type testset1(&values[0], &values[0] + 6, bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize));
|
||||
BOOST_TEST (testset1.size() == values.size()-1);
|
||||
{ int init_values [] = { 1, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
testset1.rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets2[0]), 2));
|
||||
BOOST_TEST (testset1.size() == values.size()-1);
|
||||
{ int init_values [] = { 4, 2, 5, 3, 1 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
testset1.rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets3[0]), BucketSize*2));
|
||||
BOOST_TEST (testset1.size() == values.size()-1);
|
||||
{ int init_values [] = { 1, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
//Now rehash reducing the buckets
|
||||
testset1.rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets3[0]), 2));
|
||||
BOOST_TEST (testset1.size() == values.size()-1);
|
||||
{ int init_values [] = { 4, 2, 5, 3, 1 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
|
||||
//Now rehash increasing the buckets
|
||||
testset1.rehash(bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets3[0]), BucketSize*2));
|
||||
BOOST_TEST (testset1.size() == values.size()-1);
|
||||
{ int init_values [] = { 1, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
|
||||
}
|
||||
|
||||
|
||||
//test: find, equal_range (lower_bound, upper_bound):
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
|
||||
test_find(std::vector<typename ValueTraits::value_type>& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_set
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_set_type;
|
||||
typedef typename unordered_set_type::bucket_traits bucket_traits;
|
||||
|
||||
typename unordered_set_type::bucket_type buckets [BucketSize];
|
||||
unordered_set_type testset (values.begin(), values.end(), bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets[0]), BucketSize));
|
||||
typedef typename unordered_set_type::iterator iterator;
|
||||
|
||||
value_type cmp_val;
|
||||
cmp_val.value_ = 2;
|
||||
iterator i = testset.find (cmp_val);
|
||||
BOOST_TEST (i->value_ == 2);
|
||||
BOOST_TEST ((++i)->value_ != 2);
|
||||
std::pair<iterator,iterator> range = testset.equal_range (cmp_val);
|
||||
|
||||
BOOST_TEST (range.first->value_ == 2);
|
||||
BOOST_TEST (range.second->value_ == 3);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 1);
|
||||
|
||||
cmp_val.value_ = 7;
|
||||
BOOST_TEST (testset.find (cmp_val) == testset.end());
|
||||
}
|
||||
|
||||
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
|
||||
void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>
|
||||
::test_clone(std::vector<typename ValueTraits::value_type>& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef unordered_set
|
||||
<value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
, cache_begin<CacheBegin>
|
||||
, compare_hash<CompareHash>
|
||||
, incremental<Incremental>
|
||||
> unordered_set_type;
|
||||
typedef typename unordered_set_type::bucket_traits bucket_traits;
|
||||
{
|
||||
//Test with equal bucket arrays
|
||||
typename unordered_set_type::bucket_type buckets1 [BucketSize];
|
||||
typename unordered_set_type::bucket_type buckets2 [BucketSize];
|
||||
unordered_set_type testset1 (values.begin(), values.end(), bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize));
|
||||
unordered_set_type testset2 (bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets2[0]), BucketSize));
|
||||
|
||||
testset2.clone_from(testset1, test::new_cloner<value_type>(), test::delete_disposer<value_type>());
|
||||
//Ordering is not guarantee in the cloning so insert data in a set and test
|
||||
std::set<typename ValueTraits::value_type>
|
||||
src(testset1.begin(), testset1.end());
|
||||
std::set<typename ValueTraits::value_type>
|
||||
dst(testset2.begin(), testset2.end());
|
||||
BOOST_TEST (src.size() == dst.size() && std::equal(src.begin(), src.end(), dst.begin()));
|
||||
testset2.clear_and_dispose(test::delete_disposer<value_type>());
|
||||
BOOST_TEST (testset2.empty());
|
||||
}
|
||||
{
|
||||
//Test with bigger source bucket arrays
|
||||
typename unordered_set_type::bucket_type buckets1 [BucketSize*2];
|
||||
typename unordered_set_type::bucket_type buckets2 [BucketSize];
|
||||
unordered_set_type testset1 (values.begin(), values.end(), bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize*2));
|
||||
unordered_set_type testset2 (bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets2[0]), BucketSize));
|
||||
|
||||
testset2.clone_from(testset1, test::new_cloner<value_type>(), test::delete_disposer<value_type>());
|
||||
//Ordering is not guaranteed in the cloning so insert data in a set and test
|
||||
std::set<typename ValueTraits::value_type>
|
||||
src(testset1.begin(), testset1.end());
|
||||
std::set<typename ValueTraits::value_type>
|
||||
dst(testset2.begin(), testset2.end());
|
||||
BOOST_TEST (src.size() == dst.size() && std::equal(src.begin(), src.end(), dst.begin()));
|
||||
testset2.clear_and_dispose(test::delete_disposer<value_type>());
|
||||
BOOST_TEST (testset2.empty());
|
||||
}
|
||||
{
|
||||
//Test with smaller source bucket arrays
|
||||
typename unordered_set_type::bucket_type buckets1 [BucketSize];
|
||||
typename unordered_set_type::bucket_type buckets2 [BucketSize*2];
|
||||
unordered_set_type testset1 (values.begin(), values.end(), bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets1[0]), BucketSize));
|
||||
unordered_set_type testset2 (bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets2[0]), BucketSize*2));
|
||||
|
||||
testset2.clone_from(testset1, test::new_cloner<value_type>(), test::delete_disposer<value_type>());
|
||||
//Ordering is not guarantee in the cloning so insert data in a set and test
|
||||
std::set<typename ValueTraits::value_type>
|
||||
src(testset1.begin(), testset1.end());
|
||||
std::set<typename ValueTraits::value_type>
|
||||
dst(testset2.begin(), testset2.end());
|
||||
BOOST_TEST (src.size() == dst.size() && std::equal(src.begin(), src.end(), dst.begin()));
|
||||
testset2.clear_and_dispose(test::delete_disposer<value_type>());
|
||||
BOOST_TEST (testset2.empty());
|
||||
}
|
||||
}
|
||||
|
||||
template<class VoidPointer, bool constant_time_size, bool incremental>
|
||||
template<class VoidPointer, bool ConstantTimeSize, bool Map, bool DefaultHolder>
|
||||
class test_main_template
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
static void execute()
|
||||
{
|
||||
typedef testvalue<hooks<VoidPointer> , constant_time_size> value_type;
|
||||
typedef testvalue<unordered_hooks<VoidPointer> > value_type;
|
||||
static const int random_init[6] = { 3, 2, 4, 1, 5, 2 };
|
||||
std::vector<testvalue<hooks<VoidPointer> , constant_time_size> > data (6);
|
||||
typedef typename ValueContainer< value_type >::type value_cont_type;
|
||||
value_cont_type data (6);
|
||||
for (int i = 0; i < 6; ++i)
|
||||
data[i].value_ = random_init[i];
|
||||
|
||||
test_unordered_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, true
|
||||
, false
|
||||
, incremental
|
||||
>::test_all(data);
|
||||
test_unordered_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, false
|
||||
, false
|
||||
, incremental
|
||||
>::test_all(data);
|
||||
test_unordered_set < nonhook_node_member_value_traits< value_type,
|
||||
typename hooks<VoidPointer>::nonhook_node_member_type,
|
||||
&value_type::nhn_member_,
|
||||
safe_link
|
||||
>,
|
||||
false,
|
||||
false,
|
||||
incremental
|
||||
>::test_all(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool incremental>
|
||||
class test_main_template<VoidPointer, false, incremental>
|
||||
{
|
||||
public:
|
||||
int operator()()
|
||||
{
|
||||
typedef testvalue<hooks<VoidPointer> , false> value_type;
|
||||
static const int random_init[6] = { 3, 2, 4, 1, 5, 2 };
|
||||
std::vector<testvalue<hooks<VoidPointer> , false> > data (6);
|
||||
for (int i = 0; i < 6; ++i)
|
||||
data[i].value_ = random_init[i];
|
||||
|
||||
test_unordered_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::base_hook_type
|
||||
>::type
|
||||
, true
|
||||
, false
|
||||
, incremental
|
||||
>::test_all(data);
|
||||
|
||||
test_unordered_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::member_hook_type
|
||||
, &value_type::node_
|
||||
>
|
||||
>::type
|
||||
, false
|
||||
, false
|
||||
, incremental
|
||||
>::test_all(data);
|
||||
|
||||
test_unordered_set < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename hooks<VoidPointer>::auto_base_hook_type
|
||||
>::type
|
||||
, false
|
||||
, true
|
||||
, incremental
|
||||
>::test_all(data);
|
||||
|
||||
test_unordered_set < typename detail::get_member_value_traits
|
||||
< member_hook< value_type
|
||||
, typename hooks<VoidPointer>::auto_member_hook_type
|
||||
, &value_type::auto_node_
|
||||
>
|
||||
>::type
|
||||
, false
|
||||
, true
|
||||
, incremental
|
||||
>::test_all(data);
|
||||
return 0;
|
||||
typedef testvalue_traits< unordered_hooks<VoidPointer> > testval_traits_t;
|
||||
//base
|
||||
typedef typename detail::if_c
|
||||
< ConstantTimeSize
|
||||
, typename testval_traits_t::base_value_traits
|
||||
, typename testval_traits_t::auto_base_value_traits //store_hash<true>
|
||||
>::type base_hook_t;
|
||||
test::test_unordered
|
||||
< base_hook_t //cache_begin, compare_hash, incremental
|
||||
, rebinder<base_hook_t, ConstantTimeSize, ConstantTimeSize, !ConstantTimeSize, !!ConstantTimeSize, Map, DefaultHolder>
|
||||
>::test_all(data);
|
||||
//member
|
||||
typedef typename detail::if_c
|
||||
< ConstantTimeSize
|
||||
, typename testval_traits_t::member_value_traits //optimize_multikey<true>
|
||||
, typename testval_traits_t::auto_member_value_traits //store_hash<true>, optimize_multikey<true>
|
||||
>::type member_hook_t;
|
||||
test::test_unordered
|
||||
< member_hook_t //cache_begin, compare_hash, incremental
|
||||
, rebinder<member_hook_t, ConstantTimeSize, false, !ConstantTimeSize, false, !ConstantTimeSize, DefaultHolder>
|
||||
>::test_all(data);
|
||||
//nonmember
|
||||
test::test_unordered
|
||||
< typename testval_traits_t::nonhook_value_traits //cache_begin, compare_hash, incremental
|
||||
, rebinder<typename testval_traits_t::nonhook_value_traits, ConstantTimeSize, false, false, false, Map, DefaultHolder>
|
||||
>::test_all(data);
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
test_main_template<void*, false, true>()();
|
||||
test_main_template<smart_ptr<void>, false, true>()();
|
||||
test_main_template<void*, true, true>()();
|
||||
test_main_template<smart_ptr<void>, true, true>()();
|
||||
test_main_template<void*, false, false>()();
|
||||
test_main_template<smart_ptr<void>, false, false>()();
|
||||
test_main_template<void*, true, true>()();
|
||||
test_main_template<smart_ptr<void>, true, false>()();
|
||||
//VoidPointer x ConstantTimeSize x Map x DefaultHolder
|
||||
|
||||
//void pointer
|
||||
test_main_template<void*, false, false, false>::execute();
|
||||
test_main_template<void*, false, true, false>::execute();
|
||||
test_main_template<void*, true, false, false>::execute();
|
||||
test_main_template<void*, true, true, false>::execute();
|
||||
|
||||
//smart_ptr
|
||||
test_main_template<smart_ptr<void>, false, false, false>::execute();
|
||||
test_main_template<smart_ptr<void>, false, true, false>::execute();
|
||||
test_main_template<smart_ptr<void>, true, false, false>::execute();
|
||||
test_main_template<smart_ptr<void>, true, true, false>::execute();
|
||||
|
||||
////bounded_ptr (bool ConstantTimeSize, bool Map)
|
||||
//test_main_template_bptr< false, false >::execute();
|
||||
//test_main_template_bptr< false, true >::execute();
|
||||
//test_main_template_bptr< true, false >::execute();
|
||||
//test_main_template_bptr< true, true >::execute();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user