mirror of
https://github.com/boostorg/intrusive.git
synced 2025-07-30 20:47:36 +02:00
* Big refactoring in order to reduce template and debug symbol bloat.
* Fixes #8698 * Implemented SCARY iterators [SVN r85165]
This commit is contained in:
@ -13,6 +13,8 @@ import doxygen ;
|
|||||||
import quickbook ;
|
import quickbook ;
|
||||||
path-constant here : . ;
|
path-constant here : . ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
doxygen autodoc
|
doxygen autodoc
|
||||||
:
|
:
|
||||||
[ glob ../../../boost/intrusive/*.hpp ]
|
[ glob ../../../boost/intrusive/*.hpp ]
|
||||||
@ -23,27 +25,33 @@ doxygen autodoc
|
|||||||
<doxygen:param>EXTRACT_PRIVATE=NO
|
<doxygen:param>EXTRACT_PRIVATE=NO
|
||||||
<doxygen:param>ENABLE_PREPROCESSING=YES
|
<doxygen:param>ENABLE_PREPROCESSING=YES
|
||||||
<doxygen:param>MACRO_EXPANSION=YES
|
<doxygen:param>MACRO_EXPANSION=YES
|
||||||
<doxygen:param>"PREDEFINED=BOOST_INTRUSIVE_DOXYGEN_INVOKED \\
|
<doxygen:param>"PREDEFINED=\"BOOST_INTRUSIVE_DOXYGEN_INVOKED\" \\
|
||||||
"list_impl=list" \\
|
\"BOOST_INTRUSIVE_IMPDEF(T)=implementation_defined\" \\
|
||||||
"slist_impl=slist" \\
|
\"BOOST_INTRUSIVE_SEEDOC(T)=see_documentation\" \\
|
||||||
"set_impl=set" \\
|
\"BOOST_RV_REF(T)=T &&\" \\
|
||||||
"multiset_impl=multiset" \\
|
\"BOOST_RV_REF_BEG=\" \\
|
||||||
"rbtree_impl=rbtree" \\
|
\"BOOST_RV_REF_END=&&\" \\
|
||||||
"unordered_set_impl=unordered_set" \\
|
\"list_impl=list\" \\
|
||||||
"unordered_multiset_impl=unordered_multiset" \\
|
\"slist_impl=slist\" \\
|
||||||
"hashtable_impl=hashtable" \\
|
\"set_impl=set\" \\
|
||||||
"splay_set_impl=splay_set" \\
|
\"multiset_impl=multiset\" \\
|
||||||
"splay_multiset_impl=splay_multiset" \\
|
\"bstree_impl=bstree\" \\
|
||||||
"splaytree_impl=splaytree" \\
|
\"rbtree_impl=rbtree\" \\
|
||||||
"sg_set_impl=sg_set" \\
|
\"unordered_set_impl=unordered_set\" \\
|
||||||
"sg_multiset_impl=sg_multiset" \\
|
\"unordered_multiset_impl=unordered_multiset\" \\
|
||||||
"sgtree_impl=sgtree" \\
|
\"hashtable_impl=hashtable\" \\
|
||||||
"avl_set_impl=avl_set" \\
|
\"splay_set_impl=splay_set\" \\
|
||||||
"avl_multiset_impl=avl_multiset" \\
|
\"splay_multiset_impl=splay_multiset\" \\
|
||||||
"avltree_impl=avltree" \\
|
\"splaytree_impl=splaytree\" \\
|
||||||
"treap_set_impl=treap_set" \\
|
\"sg_set_impl=sg_set\" \\
|
||||||
"treap_multiset_impl=treap_multiset" \\
|
\"sg_multiset_impl=sg_multiset\" \\
|
||||||
"treap_impl=treap""
|
\"sgtree_impl=sgtree\" \\
|
||||||
|
\"avl_set_impl=avl_set\" \\
|
||||||
|
\"avl_multiset_impl=avl_multiset\" \\
|
||||||
|
\"avltree_impl=avltree\" \\
|
||||||
|
\"treap_set_impl=treap_set\" \\
|
||||||
|
\"treap_multiset_impl=treap_multiset\" \\
|
||||||
|
\"treap_impl=treap\""
|
||||||
;
|
;
|
||||||
|
|
||||||
xml intrusive : intrusive.qbk
|
xml intrusive : intrusive.qbk
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[/
|
[/
|
||||||
/ Copyright (c) 2006-2012 Ion Gaztanaga
|
/ Copyright (c) 2006-2013 Ion Gaztanaga
|
||||||
/
|
/
|
||||||
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
|
/ 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)
|
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
@ -8,7 +8,7 @@
|
|||||||
[library Boost.Intrusive
|
[library Boost.Intrusive
|
||||||
[quickbook 1.5]
|
[quickbook 1.5]
|
||||||
[authors [Krzikalla, Olaf], [Gaztanaga, Ion]]
|
[authors [Krzikalla, Olaf], [Gaztanaga, Ion]]
|
||||||
[copyright 2005 Olaf Krzikalla, 2006-2012 Ion Gaztanaga]
|
[copyright 2005 Olaf Krzikalla, 2006-2013 Ion Gaztanaga]
|
||||||
[id intrusive]
|
[id intrusive]
|
||||||
[dirname intrusive]
|
[dirname intrusive]
|
||||||
[purpose Intrusive containers]
|
[purpose Intrusive containers]
|
||||||
@ -434,6 +434,14 @@ Now we can use the container:
|
|||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
|
However, member hooks have some implementation limitations: If there is a virtual inheritance
|
||||||
|
relationship between the parent and the member hook, then the distance between the parent
|
||||||
|
and the hook is not a compile-time fixed value so obtaining the address of
|
||||||
|
the parent from the member hook is not possible without reverse engineering compiler
|
||||||
|
produced RTTI. Apart from this, the non-standard pointer to member implementation for classes
|
||||||
|
with complex inheritance relationships in MSVC ABI compatible-compilers is not supported
|
||||||
|
by member hooks since it also depends on compiler-produced RTTI information.
|
||||||
|
|
||||||
[section:usage_both_hooks Using both hooks]
|
[section:usage_both_hooks Using both hooks]
|
||||||
|
|
||||||
You can insert the same object in several intrusive containers at the same time,
|
You can insert the same object in several intrusive containers at the same time,
|
||||||
@ -3357,6 +3365,36 @@ To analyze the thread safety, consider the following points:
|
|||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
|
[section:scary_iterators Scary Iterators]
|
||||||
|
|
||||||
|
The paper N2913, titled [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2913.pdf,
|
||||||
|
SCARY Iterator Assignment and Initialization], proposed a requirement that a standard container’s
|
||||||
|
iterator types have no dependency on any type argument apart from the container’s `value_type`,
|
||||||
|
`difference_type`, `pointer type`, and `const_pointer` type. In particular, according to the proposal,
|
||||||
|
the types of a standard container’s iterators should not depend on the container’s `key_compare`,
|
||||||
|
`hasher`, `key_equal`, or `allocator` types.
|
||||||
|
|
||||||
|
That paper demonstrated that SCARY operations were crucial to the performant implementation of common
|
||||||
|
design patterns using STL components. It showed that implementations that support SCARY operations reduce
|
||||||
|
object code bloat by eliminating redundant specializations of iterator and algorithm templates.
|
||||||
|
|
||||||
|
[*Boost.Intrusive] containers are a bit different from standard containers. In particular, they have no
|
||||||
|
allocator parameter and they can be configured with additional options not present in STL-like containers.
|
||||||
|
Thus [*Boost.Intrusive] offers its own `SCARY iterator` implementation, where iterator types don't
|
||||||
|
change when the container is configured with an option that does not alter the value <-> node transformation.
|
||||||
|
More concretely, the following options and conditions guarantee that iterator types are unchanged:
|
||||||
|
|
||||||
|
* [*All containers]: `size_type<>`, `constant_time_size<>`,
|
||||||
|
* [*`slist`]: `cache_last<>`, `linear<>`,
|
||||||
|
* [*`unordered_[multi]set`]: `hash<>`, `equal<>`, `power_2_buckets<>`, `cache_begin<>`.
|
||||||
|
* [*All tree-like containers] (`[multi]set`, `avl_[multi]set`, `sg_[multi]set`, `bs_[multi]set`,
|
||||||
|
`splay_[multi]set`, `treap_[multi]set`): `compare<>`.
|
||||||
|
* [*`treap_[multi]set`]: `priority<>`
|
||||||
|
* [*`bs_[multi]set`, `sg_[multi]set`, `treap_[multi]set`, `splay_[multi]set`]:
|
||||||
|
They share the same iterator type when configured with the same options.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
[section:equal_range_stability Stability and insertion with hint in ordered associative containers with equivalent keys]
|
[section:equal_range_stability Stability and insertion with hint in ordered associative containers with equivalent keys]
|
||||||
|
|
||||||
[*Boost.Intrusive] ordered associative containers with equivalent keys offer stability guarantees, following
|
[*Boost.Intrusive] ordered associative containers with equivalent keys offer stability guarantees, following
|
||||||
@ -3846,6 +3884,24 @@ to be inserted in intrusive containers are allocated using `std::vector` or `std
|
|||||||
|
|
||||||
[section:release_notes Release Notes]
|
[section:release_notes Release Notes]
|
||||||
|
|
||||||
|
[section:release_notes_boost_1_55_00 Boost 1.55 Release]
|
||||||
|
|
||||||
|
* [*Source breaking]: Deprecated `xxx_dont_splay` functions from splay containers.
|
||||||
|
Deprecated `splay_set_hook` from splay containers, use `bs_set_hook` instead.
|
||||||
|
Both will be removed in Boost 1.56.
|
||||||
|
|
||||||
|
* [*ABI breaking]: Hash containers' end iterator was implemented pointing to one-past the end of the bucket array
|
||||||
|
(see [@https://svn.boost.org/trac/boost/ticket/8698 #8698]) causing severe bugs when values to be inserted
|
||||||
|
where allocated next to the bucket array. End iterator implementation was changed to point to the beginning
|
||||||
|
of the bucket array.
|
||||||
|
|
||||||
|
* Big refactoring in order to reduce template and debug symbol bloat. Test object files have been slashed
|
||||||
|
to half in MSVC compilers in Debug mode. Toolchains without Identical COMDAT Folding (ICF) should notice size improvements.
|
||||||
|
|
||||||
|
* Implemented [link intrusive.scary_iterators SCARY iterators].
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
[section:release_notes_boost_1_54_00 Boost 1.54 Release]
|
[section:release_notes_boost_1_54_00 Boost 1.54 Release]
|
||||||
|
|
||||||
* Added `BOOST_NO_EXCEPTIONS` support (bug [@https://svn.boost.org/trac/boost/ticket/7849 #7849]).
|
* Added `BOOST_NO_EXCEPTIONS` support (bug [@https://svn.boost.org/trac/boost/ticket/7849 #7849]).
|
||||||
@ -3932,7 +3988,7 @@ to be inserted in intrusive containers are allocated using `std::vector` or `std
|
|||||||
|
|
||||||
[section:release_notes_boost_1_40_00 Boost 1.40 Release]
|
[section:release_notes_boost_1_40_00 Boost 1.40 Release]
|
||||||
|
|
||||||
* Code cleanup in tree_algorithms.hpp and avl_tree_algorithms.hpp
|
* Code cleanup in bstree_algorithms.hpp and avl_tree_algorithms.hpp
|
||||||
* Fixed bug
|
* Fixed bug
|
||||||
[@https://svn.boost.org/trac/boost/ticket/3164 #3164].
|
[@https://svn.boost.org/trac/boost/ticket/3164 #3164].
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Boost Intrusive Library Example Jamfile
|
# Boost Intrusive Library Example Jamfile
|
||||||
|
|
||||||
# (C) Copyright Ion Gaztanaga 2006-2012.
|
# (C) Copyright Ion Gaztanaga 2006-2013.
|
||||||
# Use, modification and distribution are subject to the
|
# Use, modification and distribution are subject to the
|
||||||
# Boost Software License, Version 1.0. (See accompanying file
|
# Boost Software License, Version 1.0. (See accompanying file
|
||||||
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2008-2012
|
// (C) Copyright Ion Gaztanaga 2008-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2010-2012
|
// (C) Copyright Ion Gaztanaga 2010-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2009-2012
|
// (C) Copyright Ion Gaztanaga 2009-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2010-2012
|
// (C) Copyright Ion Gaztanaga 2010-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -17,10 +17,11 @@
|
|||||||
|
|
||||||
using namespace boost::intrusive;
|
using namespace boost::intrusive;
|
||||||
|
|
||||||
class MyClass
|
class mytag;
|
||||||
: public splay_set_base_hook<> //This is an splay tree base hook
|
|
||||||
, public bs_set_base_hook<> //This is a binary search tree base hook
|
|
||||||
|
|
||||||
|
class MyClass
|
||||||
|
: public splay_set_base_hook<> //This is an splay tree base hook
|
||||||
|
, public bs_set_base_hook< tag<mytag> > //This is a binary search tree base hook
|
||||||
{
|
{
|
||||||
int int_;
|
int int_;
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ class MyClass
|
|||||||
typedef splay_set< MyClass, compare<std::greater<MyClass> > > BaseSplaySet;
|
typedef splay_set< MyClass, compare<std::greater<MyClass> > > BaseSplaySet;
|
||||||
|
|
||||||
//Define a set using the binary search tree hook
|
//Define a set using the binary search tree hook
|
||||||
typedef splay_set< MyClass, base_hook<bs_set_base_hook<> > > BaseBsSplaySet;
|
typedef splay_set< MyClass, base_hook<bs_set_base_hook< tag<mytag> > > > BaseBsSplaySet;
|
||||||
|
|
||||||
//Define an multiset using the member hook
|
//Define an multiset using the member hook
|
||||||
typedef member_hook<MyClass, splay_set_member_hook<>, &MyClass::member_hook_> MemberOption;
|
typedef member_hook<MyClass, splay_set_member_hook<>, &MyClass::member_hook_> MemberOption;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -37,7 +37,7 @@ struct get_any_node_algo
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class O1 = none, class O2 = none, class O3 = none>
|
template<class O1 = void, class O2 = void, class O3 = void>
|
||||||
#endif
|
#endif
|
||||||
struct make_any_base_hook
|
struct make_any_base_hook
|
||||||
{
|
{
|
||||||
@ -51,11 +51,11 @@ struct make_any_base_hook
|
|||||||
#endif
|
#endif
|
||||||
>::type packed_options;
|
>::type packed_options;
|
||||||
|
|
||||||
typedef detail::generic_hook
|
typedef generic_hook
|
||||||
< get_any_node_algo<typename packed_options::void_pointer>
|
< get_any_node_algo<typename packed_options::void_pointer>
|
||||||
, typename packed_options::tag
|
, typename packed_options::tag
|
||||||
, packed_options::link_mode
|
, packed_options::link_mode
|
||||||
, detail::AnyBaseHook
|
, AnyBaseHookId
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
@ -142,7 +142,7 @@ class any_base_hook
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class O1 = none, class O2 = none, class O3 = none>
|
template<class O1 = void, class O2 = void, class O3 = void>
|
||||||
#endif
|
#endif
|
||||||
struct make_any_member_hook
|
struct make_any_member_hook
|
||||||
{
|
{
|
||||||
@ -156,11 +156,11 @@ struct make_any_member_hook
|
|||||||
#endif
|
#endif
|
||||||
>::type packed_options;
|
>::type packed_options;
|
||||||
|
|
||||||
typedef detail::generic_hook
|
typedef generic_hook
|
||||||
< get_any_node_algo<typename packed_options::void_pointer>
|
< get_any_node_algo<typename packed_options::void_pointer>
|
||||||
, member_tag
|
, member_tag
|
||||||
, packed_options::link_mode
|
, packed_options::link_mode
|
||||||
, detail::NoBaseHook
|
, NoBaseHookId
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
@ -244,7 +244,7 @@ namespace detail{
|
|||||||
template<class ValueTraits>
|
template<class ValueTraits>
|
||||||
struct any_to_get_base_pointer_type
|
struct any_to_get_base_pointer_type
|
||||||
{
|
{
|
||||||
typedef typename pointer_traits<typename ValueTraits::boost_intrusive_tags::node_traits::node_ptr>::template
|
typedef typename pointer_traits<typename ValueTraits::hooktags::node_traits::node_ptr>::template
|
||||||
rebind_pointer<void>::type type;
|
rebind_pointer<void>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -260,17 +260,18 @@ struct any_to_get_member_pointer_type
|
|||||||
template<class BaseHook, template <class> class NodeTraits>
|
template<class BaseHook, template <class> class NodeTraits>
|
||||||
struct any_to_some_hook
|
struct any_to_some_hook
|
||||||
{
|
{
|
||||||
typedef typename BaseHook::template pack<none>::value_traits old_value_traits;
|
typedef typename BaseHook::template pack<empty>::proto_value_traits old_proto_value_traits;
|
||||||
|
|
||||||
template<class Base>
|
template<class Base>
|
||||||
struct pack : public Base
|
struct pack : public Base
|
||||||
{
|
{
|
||||||
struct value_traits : public old_value_traits
|
struct proto_value_traits : public old_proto_value_traits
|
||||||
{
|
{
|
||||||
static const bool is_any_hook = true;
|
static const bool is_any_hook = true;
|
||||||
typedef typename detail::eval_if_c
|
typedef typename detail::eval_if_c
|
||||||
< detail::internal_base_hook_bool_is_true<old_value_traits>::value
|
< detail::internal_base_hook_bool_is_true<old_proto_value_traits>::value
|
||||||
, any_to_get_base_pointer_type<old_value_traits>
|
, any_to_get_base_pointer_type<old_proto_value_traits>
|
||||||
, any_to_get_member_pointer_type<old_value_traits>
|
, any_to_get_member_pointer_type<old_proto_value_traits>
|
||||||
>::type void_pointer;
|
>::type void_pointer;
|
||||||
typedef NodeTraits<void_pointer> node_traits;
|
typedef NodeTraits<void_pointer> node_traits;
|
||||||
};
|
};
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -37,7 +37,7 @@ struct get_avl_set_node_algo
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
|
template<class O1 = void, class O2 = void, class O3 = void, class O4 = void>
|
||||||
#endif
|
#endif
|
||||||
struct make_avl_set_base_hook
|
struct make_avl_set_base_hook
|
||||||
{
|
{
|
||||||
@ -50,12 +50,12 @@ struct make_avl_set_base_hook
|
|||||||
#endif
|
#endif
|
||||||
::type packed_options;
|
::type packed_options;
|
||||||
|
|
||||||
typedef detail::generic_hook
|
typedef generic_hook
|
||||||
< get_avl_set_node_algo<typename packed_options::void_pointer
|
< get_avl_set_node_algo<typename packed_options::void_pointer
|
||||||
,packed_options::optimize_size>
|
,packed_options::optimize_size>
|
||||||
, typename packed_options::tag
|
, typename packed_options::tag
|
||||||
, packed_options::link_mode
|
, packed_options::link_mode
|
||||||
, detail::AvlSetBaseHook
|
, AvlTreeBaseHookId
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
@ -168,7 +168,7 @@ class avl_set_base_hook
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
|
template<class O1 = void, class O2 = void, class O3 = void, class O4 = void>
|
||||||
#endif
|
#endif
|
||||||
struct make_avl_set_member_hook
|
struct make_avl_set_member_hook
|
||||||
{
|
{
|
||||||
@ -181,12 +181,12 @@ struct make_avl_set_member_hook
|
|||||||
#endif
|
#endif
|
||||||
::type packed_options;
|
::type packed_options;
|
||||||
|
|
||||||
typedef detail::generic_hook
|
typedef generic_hook
|
||||||
< get_avl_set_node_algo<typename packed_options::void_pointer
|
< get_avl_set_node_algo<typename packed_options::void_pointer
|
||||||
,packed_options::optimize_size>
|
,packed_options::optimize_size>
|
||||||
, member_tag
|
, member_tag
|
||||||
, packed_options::link_mode
|
, packed_options::link_mode
|
||||||
, detail::NoBaseHook
|
, NoBaseHookId
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Daniel K. O. 2005.
|
// (C) Copyright Daniel K. O. 2005.
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -21,20 +21,52 @@
|
|||||||
|
|
||||||
#include <boost/intrusive/detail/assert.hpp>
|
#include <boost/intrusive/detail/assert.hpp>
|
||||||
#include <boost/intrusive/detail/utilities.hpp>
|
#include <boost/intrusive/detail/utilities.hpp>
|
||||||
#include <boost/intrusive/detail/tree_algorithms.hpp>
|
#include <boost/intrusive/bstree_algorithms.hpp>
|
||||||
#include <boost/intrusive/pointer_traits.hpp>
|
#include <boost/intrusive/pointer_traits.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace intrusive {
|
namespace intrusive {
|
||||||
|
|
||||||
|
/// @cond
|
||||||
|
|
||||||
|
template<class NodeTraits, class F>
|
||||||
|
struct avltree_node_cloner
|
||||||
|
: private detail::ebo_functor_holder<F>
|
||||||
|
{
|
||||||
|
typedef typename NodeTraits::node_ptr node_ptr;
|
||||||
|
typedef detail::ebo_functor_holder<F> base_t;
|
||||||
|
|
||||||
|
avltree_node_cloner(F f)
|
||||||
|
: base_t(f)
|
||||||
|
{}
|
||||||
|
|
||||||
|
node_ptr operator()(const node_ptr & p)
|
||||||
|
{
|
||||||
|
node_ptr n = base_t::get()(p);
|
||||||
|
NodeTraits::set_balance(n, NodeTraits::get_balance(p));
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class NodeTraits>
|
||||||
|
struct avltree_erase_fixup
|
||||||
|
{
|
||||||
|
typedef typename NodeTraits::node_ptr node_ptr;
|
||||||
|
|
||||||
|
void operator()(const node_ptr & to_erase, const node_ptr & successor)
|
||||||
|
{ NodeTraits::set_balance(successor, NodeTraits::get_balance(to_erase)); }
|
||||||
|
};
|
||||||
|
|
||||||
|
/// @endcond
|
||||||
|
|
||||||
//! avltree_algorithms is configured with a NodeTraits class, which encapsulates the
|
//! avltree_algorithms is configured with a NodeTraits class, which encapsulates the
|
||||||
//! information about the node to be manipulated. NodeTraits must support the
|
//! information about the node to be manipulated. NodeTraits must support the
|
||||||
//! following interface:
|
//! following interface:
|
||||||
//!
|
//!
|
||||||
//! <b>Typedefs</b>:
|
//! <b>Typedefs</b>:
|
||||||
//!
|
//!
|
||||||
//! <tt>node</tt>: The type of the node that forms the circular list
|
//! <tt>node</tt>: The type of the node that forms the binary search tree
|
||||||
//!
|
//!
|
||||||
//! <tt>node_ptr</tt>: A pointer to a node
|
//! <tt>node_ptr</tt>: A pointer to a node
|
||||||
//!
|
//!
|
||||||
@ -67,6 +99,9 @@ namespace intrusive {
|
|||||||
//! <tt>static balance positive();</tt>
|
//! <tt>static balance positive();</tt>
|
||||||
template<class NodeTraits>
|
template<class NodeTraits>
|
||||||
class avltree_algorithms
|
class avltree_algorithms
|
||||||
|
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
: public bstree_algorithms<NodeTraits>
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename NodeTraits::node node;
|
typedef typename NodeTraits::node node;
|
||||||
@ -77,161 +112,69 @@ class avltree_algorithms
|
|||||||
|
|
||||||
/// @cond
|
/// @cond
|
||||||
private:
|
private:
|
||||||
typedef detail::tree_algorithms<NodeTraits> tree_algorithms;
|
typedef bstree_algorithms<NodeTraits> bstree_algorithms;
|
||||||
|
|
||||||
template<class F>
|
|
||||||
struct avltree_node_cloner
|
|
||||||
: private detail::ebo_functor_holder<F>
|
|
||||||
{
|
|
||||||
typedef detail::ebo_functor_holder<F> base_t;
|
|
||||||
|
|
||||||
avltree_node_cloner(F f)
|
|
||||||
: base_t(f)
|
|
||||||
{}
|
|
||||||
|
|
||||||
node_ptr operator()(const node_ptr &p)
|
|
||||||
{
|
|
||||||
node_ptr n = base_t::get()(p);
|
|
||||||
NodeTraits::set_balance(n, NodeTraits::get_balance(p));
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct avltree_erase_fixup
|
|
||||||
{
|
|
||||||
void operator()(const node_ptr &to_erase, const node_ptr &successor)
|
|
||||||
{ NodeTraits::set_balance(successor, NodeTraits::get_balance(to_erase)); }
|
|
||||||
};
|
|
||||||
|
|
||||||
static node_ptr uncast(const const_node_ptr & ptr)
|
|
||||||
{ return pointer_traits<node_ptr>::const_cast_from(ptr); }
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static node_ptr begin_node(const const_node_ptr & header)
|
|
||||||
{ return tree_algorithms::begin_node(header); }
|
|
||||||
|
|
||||||
static node_ptr end_node(const const_node_ptr & header)
|
|
||||||
{ return tree_algorithms::end_node(header); }
|
|
||||||
|
|
||||||
//! This type is the information that will be
|
//! This type is the information that will be
|
||||||
//! filled by insert_unique_check
|
//! filled by insert_unique_check
|
||||||
typedef typename tree_algorithms::insert_commit_data insert_commit_data;
|
typedef typename bstree_algorithms::insert_commit_data insert_commit_data;
|
||||||
|
|
||||||
//! <b>Requires</b>: header1 and header2 must be the header nodes
|
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//! of two trees.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Swaps two trees. After the function header1 will contain
|
|
||||||
//! links to the second tree and header2 will have links to the first tree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
|
|
||||||
{ return tree_algorithms::swap_tree(header1, header2); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! @copydoc ::boost::intrusive::bstree_algorithms::get_header(const const_node_ptr&)
|
||||||
//! of two trees.
|
static node_ptr get_header(const const_node_ptr & n);
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
//! @copydoc ::boost::intrusive::bstree_algorithms::begin_node
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
static node_ptr begin_node(const const_node_ptr & header);
|
||||||
//! position node1 had before the function.
|
|
||||||
//!
|
//! @copydoc ::boost::intrusive::bstree_algorithms::end_node
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
static node_ptr end_node(const const_node_ptr & header);
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::swap_tree
|
||||||
//!
|
static void swap_tree(const node_ptr & header1, const node_ptr & header2);
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//!
|
|
||||||
//!Experimental function
|
//! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&)
|
||||||
static void swap_nodes(const node_ptr & node1, const node_ptr & node2)
|
static void swap_nodes(const node_ptr & node1, const node_ptr & node2)
|
||||||
{
|
{
|
||||||
if(node1 == node2)
|
if(node1 == node2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
|
node_ptr header1(bstree_algorithms::get_header(node1)), header2(bstree_algorithms::get_header(node2));
|
||||||
swap_nodes(node1, header1, node2, header2);
|
swap_nodes(node1, header1, node2, header2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&,const node_ptr&,const node_ptr&)
|
||||||
//! of two trees with header header1 and header2.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
|
||||||
//! position node1 had before the function.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
|
||||||
//!
|
|
||||||
//!Experimental function
|
|
||||||
static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2)
|
static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2)
|
||||||
{
|
{
|
||||||
if(node1 == node2) return;
|
if(node1 == node2) return;
|
||||||
|
|
||||||
tree_algorithms::swap_nodes(node1, header1, node2, header2);
|
bstree_algorithms::swap_nodes(node1, header1, node2, header2);
|
||||||
//Swap balance
|
//Swap balance
|
||||||
balance c = NodeTraits::get_balance(node1);
|
balance c = NodeTraits::get_balance(node1);
|
||||||
NodeTraits::set_balance(node1, NodeTraits::get_balance(node2));
|
NodeTraits::set_balance(node1, NodeTraits::get_balance(node2));
|
||||||
NodeTraits::set_balance(node2, c);
|
NodeTraits::set_balance(node2, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&)
|
||||||
//! and new_node must not be inserted in a tree.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
|
||||||
//! the node, since no rebalancing and comparison is needed.
|
|
||||||
//!
|
|
||||||
//!Experimental function
|
|
||||||
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node)
|
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node)
|
||||||
{
|
{
|
||||||
if(node_to_be_replaced == new_node)
|
if(node_to_be_replaced == new_node)
|
||||||
return;
|
return;
|
||||||
replace_node(node_to_be_replaced, tree_algorithms::get_header(node_to_be_replaced), new_node);
|
replace_node(node_to_be_replaced, bstree_algorithms::get_header(node_to_be_replaced), new_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&,const node_ptr&)
|
||||||
//! with header "header" and new_node must not be inserted in a tree.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
|
||||||
//! the node, since no rebalancing or comparison is needed.
|
|
||||||
//!
|
|
||||||
//!Experimental function
|
|
||||||
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node)
|
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node)
|
||||||
{
|
{
|
||||||
tree_algorithms::replace_node(node_to_be_replaced, header, new_node);
|
bstree_algorithms::replace_node(node_to_be_replaced, header, new_node);
|
||||||
NodeTraits::set_balance(new_node, NodeTraits::get_balance(node_to_be_replaced));
|
NodeTraits::set_balance(new_node, NodeTraits::get_balance(node_to_be_replaced));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a tree node but not the header.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::unlink(const node_ptr&)
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Unlinks the node and rebalances the tree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity is constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static void unlink(const node_ptr & node)
|
static void unlink(const node_ptr & node)
|
||||||
{
|
{
|
||||||
node_ptr x = NodeTraits::get_parent(node);
|
node_ptr x = NodeTraits::get_parent(node);
|
||||||
@ -242,84 +185,25 @@ class avltree_algorithms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: header is the header of a tree.
|
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//!
|
//! @copydoc ::boost::intrusive::bstree_algorithms::unlink_leftmost_without_rebalance
|
||||||
//! <b>Effects</b>: Unlinks the leftmost node from the tree, and
|
static node_ptr unlink_leftmost_without_rebalance(const node_ptr & header);
|
||||||
//! updates the header link to the new leftmost node.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity is constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Notes</b>: This function breaks the tree and the tree can
|
|
||||||
//! only be used for more unlink_leftmost_without_rebalance calls.
|
|
||||||
//! This function is normally used to achieve a step by step
|
|
||||||
//! controlled destruction of the tree.
|
|
||||||
static node_ptr unlink_leftmost_without_rebalance(const node_ptr & header)
|
|
||||||
{ return tree_algorithms::unlink_leftmost_without_rebalance(header); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree or an node initialized
|
//! @copydoc ::boost::intrusive::bstree_algorithms::unique(const const_node_ptr&)
|
||||||
//! by init(...).
|
static bool unique(const const_node_ptr & node);
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns true if the node is initialized by init().
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static bool unique(const const_node_ptr & node)
|
|
||||||
{ return tree_algorithms::unique(node); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::size(const const_node_ptr&)
|
||||||
//!
|
static std::size_t size(const const_node_ptr & header);
|
||||||
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Linear time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static std::size_t count(const const_node_ptr & node)
|
|
||||||
{ return tree_algorithms::count(node); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: header is the header node of the tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::next_node(const node_ptr&)
|
||||||
//!
|
static node_ptr next_node(const node_ptr & node);
|
||||||
//! <b>Effects</b>: Returns the number of nodes above the header.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Linear time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static std::size_t size(const const_node_ptr & header)
|
|
||||||
{ return tree_algorithms::size(header); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node from the tree except the header.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::prev_node(const node_ptr&)
|
||||||
//!
|
static node_ptr prev_node(const node_ptr & node);
|
||||||
//! <b>Effects</b>: Returns the next node of the tree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static node_ptr next_node(const node_ptr & p)
|
|
||||||
{ return tree_algorithms::next_node(p); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node from the tree except the leftmost node.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::init(const node_ptr&)
|
||||||
//!
|
static void init(const node_ptr & node);
|
||||||
//! <b>Effects</b>: Returns the previous node of the tree.
|
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static node_ptr prev_node(const node_ptr & p)
|
|
||||||
{ return tree_algorithms::prev_node(p); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node must not be part of any tree.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: After the function unique(node) == true.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
|
||||||
static void init(const node_ptr & node)
|
|
||||||
{ tree_algorithms::init(node); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node must not be part of any tree.
|
//! <b>Requires</b>: node must not be part of any tree.
|
||||||
//!
|
//!
|
||||||
@ -333,419 +217,148 @@ class avltree_algorithms
|
|||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
||||||
static void init_header(const node_ptr & header)
|
static void init_header(const node_ptr & header)
|
||||||
{
|
{
|
||||||
tree_algorithms::init_header(header);
|
bstree_algorithms::init_header(header);
|
||||||
NodeTraits::set_balance(header, NodeTraits::zero());
|
NodeTraits::set_balance(header, NodeTraits::zero());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: header must be the header of a tree, z a node
|
//! @copydoc ::boost::intrusive::bstree_algorithms::erase(const node_ptr&,const node_ptr&)
|
||||||
//! of that tree and z != header.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Erases node "z" from the tree with header "header".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Amortized constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static node_ptr erase(const node_ptr & header, const node_ptr & z)
|
static node_ptr erase(const node_ptr & header, const node_ptr & z)
|
||||||
{
|
{
|
||||||
typename tree_algorithms::data_for_rebalance info;
|
typename bstree_algorithms::data_for_rebalance info;
|
||||||
tree_algorithms::erase(header, z, avltree_erase_fixup(), info);
|
bstree_algorithms::erase(header, z, avltree_erase_fixup<NodeTraits>(), info);
|
||||||
node_ptr x = info.x;
|
|
||||||
node_ptr x_parent = info.x_parent;
|
|
||||||
|
|
||||||
//Rebalance avltree
|
//Rebalance avltree
|
||||||
rebalance_after_erasure(header, x, x_parent);
|
rebalance_after_erasure(header, info.x, info.x_parent);
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "cloner" must be a function
|
//! @copydoc ::boost::intrusive::bstree_algorithms::clone(const const_node_ptr&,const node_ptr&,Cloner,Disposer)
|
||||||
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
|
|
||||||
//! take a node_ptr and shouldn't throw.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: First empties target tree calling
|
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
|
||||||
//! except the header.
|
|
||||||
//!
|
|
||||||
//! Then, duplicates the entire tree pointed by "source_header" cloning each
|
|
||||||
//! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
|
|
||||||
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
|
|
||||||
//! are disposed using <tt>void disposer(const node_ptr &)</tt>.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
|
||||||
//! number of elements of tree target tree when calling this function.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
|
||||||
template <class Cloner, class Disposer>
|
template <class Cloner, class Disposer>
|
||||||
static void clone
|
static void clone
|
||||||
(const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer)
|
(const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer)
|
||||||
{
|
{
|
||||||
avltree_node_cloner<Cloner> new_cloner(cloner);
|
avltree_node_cloner<NodeTraits, Cloner> new_cloner(cloner);
|
||||||
tree_algorithms::clone(source_header, target_header, new_cloner, disposer);
|
bstree_algorithms::clone(source_header, target_header, new_cloner, disposer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "disposer" must be an object function
|
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//! taking a node_ptr parameter and shouldn't throw.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::clear_and_dispose(const node_ptr&,Disposer)
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Empties the target tree calling
|
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
|
||||||
//! except the header.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
|
||||||
//! number of elements of tree target tree when calling this function.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
|
||||||
template<class Disposer>
|
template<class Disposer>
|
||||||
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
|
static void clear_and_dispose(const node_ptr & header, Disposer disposer);
|
||||||
{ tree_algorithms::clear_and_dispose(header, disposer); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::lower_bound(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns an node_ptr to the first element that is
|
|
||||||
//! not less than "key" according to "comp" or "header" if that element does
|
|
||||||
//! not exist.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr lower_bound
|
static node_ptr lower_bound
|
||||||
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
|
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp);
|
||||||
{ return tree_algorithms::lower_bound(header, key, comp); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::upper_bound(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns an node_ptr to the first element that is greater
|
|
||||||
//! than "key" according to "comp" or "header" if that element does not exist.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr upper_bound
|
static node_ptr upper_bound
|
||||||
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
|
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp);
|
||||||
{ return tree_algorithms::upper_bound(header, key, comp); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::find(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns an node_ptr to the element that is equivalent to
|
|
||||||
//! "key" according to "comp" or "header" if that element does not exist.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr find
|
static node_ptr find
|
||||||
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
|
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp);
|
||||||
{ return tree_algorithms::find(header, key, comp); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::equal_range(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns an a pair of node_ptr delimiting a range containing
|
|
||||||
//! all elements that are equivalent to "key" according to "comp" or an
|
|
||||||
//! empty range that indicates the position where those elements would be
|
|
||||||
//! if they there are no equivalent elements.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, node_ptr> equal_range
|
static std::pair<node_ptr, node_ptr> equal_range
|
||||||
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
|
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp);
|
||||||
{ return tree_algorithms::equal_range(header, key, comp); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::bounded_range(const const_node_ptr&,const KeyType&,const KeyType&,KeyNodePtrCompare,bool,bool)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
|
|
||||||
//! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
|
|
||||||
//! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns an a pair with the following criteria:
|
|
||||||
//!
|
|
||||||
//! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
|
|
||||||
//!
|
|
||||||
//! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: This function can be more efficient than calling upper_bound
|
|
||||||
//! and lower_bound for lower_key and upper_key.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, node_ptr> bounded_range
|
static std::pair<node_ptr, node_ptr> bounded_range
|
||||||
(const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp
|
(const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp
|
||||||
, bool left_closed, bool right_closed)
|
, bool left_closed, bool right_closed);
|
||||||
{ return tree_algorithms::bounded_range(header, lower_key, upper_key, comp, left_closed, right_closed); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "h" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::count(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
|
||||||
//! NodePtrCompare is a function object that induces a strict weak
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
static std::size_t count(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp);
|
||||||
//! the tree. NodePtrCompare compares two node_ptrs.
|
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_upper_bound(const node_ptr&,const node_ptr&,NodePtrCompare)
|
||||||
//! according to "comp".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
|
||||||
//! most logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class NodePtrCompare>
|
template<class NodePtrCompare>
|
||||||
static node_ptr insert_equal_upper_bound
|
static node_ptr insert_equal_upper_bound
|
||||||
(const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp)
|
(const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp)
|
||||||
{
|
{
|
||||||
tree_algorithms::insert_equal_upper_bound(h, new_node, comp);
|
bstree_algorithms::insert_equal_upper_bound(h, new_node, comp);
|
||||||
rebalance_after_insertion(h, new_node);
|
rebalance_after_insertion(h, new_node);
|
||||||
return new_node;
|
return new_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "h" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_lower_bound(const node_ptr&,const node_ptr&,NodePtrCompare)
|
||||||
//! NodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. NodePtrCompare compares two node_ptrs.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before the lower bound
|
|
||||||
//! according to "comp".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
|
||||||
//! most logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class NodePtrCompare>
|
template<class NodePtrCompare>
|
||||||
static node_ptr insert_equal_lower_bound
|
static node_ptr insert_equal_lower_bound
|
||||||
(const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp)
|
(const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp)
|
||||||
{
|
{
|
||||||
tree_algorithms::insert_equal_lower_bound(h, new_node, comp);
|
bstree_algorithms::insert_equal_lower_bound(h, new_node, comp);
|
||||||
rebalance_after_insertion(h, new_node);
|
rebalance_after_insertion(h, new_node);
|
||||||
return new_node;
|
return new_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal(const node_ptr&,const node_ptr&,const node_ptr&,NodePtrCompare)
|
||||||
//! NodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from
|
|
||||||
//! the "header"'s tree.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree, using "hint" as a hint to
|
|
||||||
//! where it will be inserted. If "hint" is the upper_bound
|
|
||||||
//! the insertion takes constant time (two comparisons in the worst case).
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
|
|
||||||
//! constant time if new_node is inserted immediately before "hint".
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class NodePtrCompare>
|
template<class NodePtrCompare>
|
||||||
static node_ptr insert_equal
|
static node_ptr insert_equal
|
||||||
(const node_ptr & header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp)
|
(const node_ptr & header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp)
|
||||||
{
|
{
|
||||||
tree_algorithms::insert_equal(header, hint, new_node, comp);
|
bstree_algorithms::insert_equal(header, hint, new_node, comp);
|
||||||
rebalance_after_insertion(header, new_node);
|
rebalance_after_insertion(header, new_node);
|
||||||
return new_node;
|
return new_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_before(const node_ptr&,const node_ptr&,const node_ptr&)
|
||||||
//! "pos" must be a valid iterator or header (end) node.
|
|
||||||
//! "pos" must be an iterator pointing to the successor to "new_node"
|
|
||||||
//! once inserted according to the order of already inserted nodes. This function does not
|
|
||||||
//! check "pos" and this precondition must be guaranteed by the caller.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant-time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
|
|
||||||
//! tree invariants might be broken.
|
|
||||||
static node_ptr insert_before
|
static node_ptr insert_before
|
||||||
(const node_ptr & header, const node_ptr & pos, const node_ptr & new_node)
|
(const node_ptr & header, const node_ptr & pos, const node_ptr & new_node)
|
||||||
{
|
{
|
||||||
tree_algorithms::insert_before(header, pos, new_node);
|
bstree_algorithms::insert_before(header, pos, new_node);
|
||||||
rebalance_after_insertion(header, new_node);
|
rebalance_after_insertion(header, new_node);
|
||||||
return new_node;
|
return new_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::push_back(const node_ptr&,const node_ptr&)
|
||||||
//! "new_node" must be, according to the used ordering no less than the
|
|
||||||
//! greatest inserted key.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant-time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
|
|
||||||
//! tree invariants are broken. This function is slightly faster than
|
|
||||||
//! using "insert_before".
|
|
||||||
static void push_back(const node_ptr & header, const node_ptr & new_node)
|
static void push_back(const node_ptr & header, const node_ptr & new_node)
|
||||||
{
|
{
|
||||||
tree_algorithms::push_back(header, new_node);
|
bstree_algorithms::push_back(header, new_node);
|
||||||
rebalance_after_insertion(header, new_node);
|
rebalance_after_insertion(header, new_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::push_front(const node_ptr&,const node_ptr&)
|
||||||
//! "new_node" must be, according to the used ordering, no greater than the
|
|
||||||
//! lowest inserted key.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant-time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
|
|
||||||
//! tree invariants are broken. This function is slightly faster than
|
|
||||||
//! using "insert_before".
|
|
||||||
static void push_front(const node_ptr & header, const node_ptr & new_node)
|
static void push_front(const node_ptr & header, const node_ptr & new_node)
|
||||||
{
|
{
|
||||||
tree_algorithms::push_front(header, new_node);
|
bstree_algorithms::push_front(header, new_node);
|
||||||
rebalance_after_insertion(header, new_node);
|
rebalance_after_insertion(header, new_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_check(const const_node_ptr&,const KeyType&,KeyNodePtrCompare,insert_commit_data&)
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
|
||||||
//! tree according to "comp" and obtains the needed information to realize
|
|
||||||
//! a constant-time node insertion if there is no equivalent node.
|
|
||||||
//!
|
|
||||||
//! <b>Returns</b>: If there is an equivalent value
|
|
||||||
//! returns a pair containing a node_ptr to the already present node
|
|
||||||
//! and false. If there is not equivalent key can be inserted returns true
|
|
||||||
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
|
||||||
//! be used with the "insert_commit" function to achieve a constant-time
|
|
||||||
//! insertion function.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity is at most logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
//!
|
|
||||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
|
||||||
//! a node is expensive and the user does not want to have two equivalent nodes
|
|
||||||
//! in the tree: if there is an equivalent value
|
|
||||||
//! the constructed object must be discarded. Many times, the part of the
|
|
||||||
//! node that is used to impose the order is much cheaper to construct
|
|
||||||
//! than the node and this function offers the possibility to use that part
|
|
||||||
//! to check if the insertion will be successful.
|
|
||||||
//!
|
|
||||||
//! If the check is successful, the user can construct the node and use
|
|
||||||
//! "insert_commit" to insert the node in constant-time. This gives a total
|
|
||||||
//! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).
|
|
||||||
//!
|
|
||||||
//! "commit_data" remains valid for a subsequent "insert_unique_commit" only
|
|
||||||
//! if no more objects are inserted or erased from the set.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, bool> insert_unique_check
|
static std::pair<node_ptr, bool> insert_unique_check
|
||||||
(const const_node_ptr & header, const KeyType &key
|
(const const_node_ptr & header, const KeyType &key
|
||||||
,KeyNodePtrCompare comp, insert_commit_data &commit_data)
|
,KeyNodePtrCompare comp, insert_commit_data &commit_data);
|
||||||
{ return tree_algorithms::insert_unique_check(header, key, comp, commit_data); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_check(const const_node_ptr&,const node_ptr&,const KeyType&,KeyNodePtrCompare,insert_commit_data&)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
|
||||||
//! "hint" is node from the "header"'s tree.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
|
||||||
//! tree according to "comp" using "hint" as a hint to where it should be
|
|
||||||
//! inserted and obtains the needed information to realize
|
|
||||||
//! a constant-time node insertion if there is no equivalent node.
|
|
||||||
//! If "hint" is the upper_bound the function has constant time
|
|
||||||
//! complexity (two comparisons in the worst case).
|
|
||||||
//!
|
|
||||||
//! <b>Returns</b>: If there is an equivalent value
|
|
||||||
//! returns a pair containing a node_ptr to the already present node
|
|
||||||
//! and false. If there is not equivalent key can be inserted returns true
|
|
||||||
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
|
||||||
//! be used with the "insert_commit" function to achieve a constant-time
|
|
||||||
//! insertion function.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity is at most logarithmic, but it is
|
|
||||||
//! amortized constant time if new_node should be inserted immediately before "hint".
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
//!
|
|
||||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
|
||||||
//! a node is expensive and the user does not want to have two equivalent nodes
|
|
||||||
//! in the tree: if there is an equivalent value
|
|
||||||
//! the constructed object must be discarded. Many times, the part of the
|
|
||||||
//! node that is used to impose the order is much cheaper to construct
|
|
||||||
//! than the node and this function offers the possibility to use that part
|
|
||||||
//! to check if the insertion will be successful.
|
|
||||||
//!
|
|
||||||
//! If the check is successful, the user can construct the node and use
|
|
||||||
//! "insert_commit" to insert the node in constant-time. This gives a total
|
|
||||||
//! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).
|
|
||||||
//!
|
|
||||||
//! "commit_data" remains valid for a subsequent "insert_unique_commit" only
|
|
||||||
//! if no more objects are inserted or erased from the set.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, bool> insert_unique_check
|
static std::pair<node_ptr, bool> insert_unique_check
|
||||||
(const const_node_ptr & header, const node_ptr &hint, const KeyType &key
|
(const const_node_ptr & header, const node_ptr &hint, const KeyType &key
|
||||||
,KeyNodePtrCompare comp, insert_commit_data &commit_data)
|
,KeyNodePtrCompare comp, insert_commit_data &commit_data);
|
||||||
{ return tree_algorithms::insert_unique_check(header, hint, key, comp, commit_data); }
|
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_commit(const node_ptr&,const node_ptr&,const insert_commit_data &)
|
||||||
//! "commit_data" must have been obtained from a previous call to
|
|
||||||
//! "insert_unique_check". No objects should have been inserted or erased
|
|
||||||
//! from the set between the "insert_unique_check" that filled "commit_data"
|
|
||||||
//! and the call to "insert_commit".
|
|
||||||
//!
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node in the set using the information obtained
|
|
||||||
//! from the "commit_data" that a previous "insert_check" filled.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Notes</b>: This function has only sense if a "insert_unique_check" has been
|
|
||||||
//! previously executed to fill "commit_data". No value should be inserted or
|
|
||||||
//! erased between the "insert_check" and "insert_commit" calls.
|
|
||||||
static void insert_unique_commit
|
static void insert_unique_commit
|
||||||
(const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data)
|
(const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data)
|
||||||
{
|
{
|
||||||
tree_algorithms::insert_unique_commit(header, new_value, commit_data);
|
bstree_algorithms::insert_unique_commit(header, new_value, commit_data);
|
||||||
rebalance_after_insertion(header, new_value);
|
rebalance_after_insertion(header, new_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "n" must be a node inserted in a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::is_header
|
||||||
//!
|
static bool is_header(const const_node_ptr & p)
|
||||||
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
|
{ return NodeTraits::get_balance(p) == NodeTraits::zero() && bstree_algorithms::is_header(p); }
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static node_ptr get_header(const node_ptr & n)
|
|
||||||
{ return tree_algorithms::get_header(n); }
|
|
||||||
|
|
||||||
/// @cond
|
/// @cond
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node of a tree.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns true if p is the header of the tree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static bool is_header(const const_node_ptr & p)
|
|
||||||
{ return NodeTraits::get_balance(p) == NodeTraits::zero() && tree_algorithms::is_header(p); }
|
|
||||||
|
|
||||||
static void rebalance_after_erasure(const node_ptr & header, const node_ptr & xnode, const node_ptr & xnode_parent)
|
static void rebalance_after_erasure(const node_ptr & header, const node_ptr & xnode, const node_ptr & xnode_parent)
|
||||||
{
|
{
|
||||||
node_ptr x(xnode), x_parent(xnode_parent);
|
node_ptr x(xnode), x_parent(xnode_parent);
|
||||||
@ -903,8 +516,8 @@ class avltree_algorithms
|
|||||||
// / \ //
|
// / \ //
|
||||||
// e f //
|
// e f //
|
||||||
node_ptr b = NodeTraits::get_left(a), c = NodeTraits::get_right(b);
|
node_ptr b = NodeTraits::get_left(a), c = NodeTraits::get_right(b);
|
||||||
tree_algorithms::rotate_left(b, hdr);
|
bstree_algorithms::rotate_left(b, hdr);
|
||||||
tree_algorithms::rotate_right(a, hdr);
|
bstree_algorithms::rotate_right(a, hdr);
|
||||||
left_right_balancing(a, b, c);
|
left_right_balancing(a, b, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -920,15 +533,15 @@ class avltree_algorithms
|
|||||||
// / \ //
|
// / \ //
|
||||||
// e f //
|
// e f //
|
||||||
node_ptr b = NodeTraits::get_right(a), c = NodeTraits::get_left(b);
|
node_ptr b = NodeTraits::get_right(a), c = NodeTraits::get_left(b);
|
||||||
tree_algorithms::rotate_right(b, hdr);
|
bstree_algorithms::rotate_right(b, hdr);
|
||||||
tree_algorithms::rotate_left(a, hdr);
|
bstree_algorithms::rotate_left(a, hdr);
|
||||||
left_right_balancing(b, a, c);
|
left_right_balancing(b, a, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rotate_left(const node_ptr x, const node_ptr & hdr)
|
static void rotate_left(const node_ptr x, const node_ptr & hdr)
|
||||||
{
|
{
|
||||||
const node_ptr y = NodeTraits::get_right(x);
|
const node_ptr y = NodeTraits::get_right(x);
|
||||||
tree_algorithms::rotate_left(x, hdr);
|
bstree_algorithms::rotate_left(x, hdr);
|
||||||
|
|
||||||
// reset the balancing factor
|
// reset the balancing factor
|
||||||
if (NodeTraits::get_balance(y) == NodeTraits::positive()) {
|
if (NodeTraits::get_balance(y) == NodeTraits::positive()) {
|
||||||
@ -944,7 +557,7 @@ class avltree_algorithms
|
|||||||
static void rotate_right(const node_ptr x, const node_ptr & hdr)
|
static void rotate_right(const node_ptr x, const node_ptr & hdr)
|
||||||
{
|
{
|
||||||
const node_ptr y = NodeTraits::get_left(x);
|
const node_ptr y = NodeTraits::get_left(x);
|
||||||
tree_algorithms::rotate_right(x, hdr);
|
bstree_algorithms::rotate_right(x, hdr);
|
||||||
|
|
||||||
// reset the balancing factor
|
// reset the balancing factor
|
||||||
if (NodeTraits::get_balance(y) == NodeTraits::negative()) {
|
if (NodeTraits::get_balance(y) == NodeTraits::negative()) {
|
||||||
@ -960,6 +573,16 @@ class avltree_algorithms
|
|||||||
/// @endcond
|
/// @endcond
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// @cond
|
||||||
|
|
||||||
|
template<class NodeTraits>
|
||||||
|
struct get_algo<AvlTreeAlgorithms, NodeTraits>
|
||||||
|
{
|
||||||
|
typedef avltree_algorithms<NodeTraits> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// @endcond
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
|
922
include/boost/intrusive/bs_set.hpp
Normal file
922
include/boost/intrusive/bs_set.hpp
Normal file
@ -0,0 +1,922 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// (C) Copyright Ion Gaztanaga 2013-2013
|
||||||
|
//
|
||||||
|
// 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/intrusive for documentation.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#ifndef BOOST_INTRUSIVE_BS_SET_HPP
|
||||||
|
#define BOOST_INTRUSIVE_BS_SET_HPP
|
||||||
|
|
||||||
|
#include <boost/intrusive/detail/config_begin.hpp>
|
||||||
|
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||||
|
#include <boost/intrusive/detail/mpl.hpp>
|
||||||
|
#include <boost/intrusive/bstree.hpp>
|
||||||
|
#include <iterator>
|
||||||
|
#include <boost/move/move.hpp>
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
namespace intrusive {
|
||||||
|
|
||||||
|
//! The class template bs_set is an intrusive container, that mimics most of
|
||||||
|
//! the interface of std::set as described in the C++ standard.
|
||||||
|
//!
|
||||||
|
//! The template parameter \c T is the type to be managed by the container.
|
||||||
|
//! The user can specify additional options and if no options are provided
|
||||||
|
//! default options are used.
|
||||||
|
//!
|
||||||
|
//! The container supports the following options:
|
||||||
|
//! \c base_hook<>/member_hook<>/value_traits<>,
|
||||||
|
//! \c constant_time_size<>, \c size_type<> and
|
||||||
|
//! \c compare<>.
|
||||||
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
|
template<class T, class ...Options>
|
||||||
|
#else
|
||||||
|
template<class ValueTraits, class Compare, class SizeType, bool ConstantTimeSize>
|
||||||
|
#endif
|
||||||
|
class bs_set_impl
|
||||||
|
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
: public bstree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, BsTreeAlgorithms>
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
/// @cond
|
||||||
|
typedef bstree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, BsTreeAlgorithms> tree_type;
|
||||||
|
BOOST_MOVABLE_BUT_NOT_COPYABLE(bs_set_impl)
|
||||||
|
|
||||||
|
typedef tree_type implementation_defined;
|
||||||
|
/// @endcond
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef typename implementation_defined::value_type value_type;
|
||||||
|
typedef typename implementation_defined::value_traits value_traits;
|
||||||
|
typedef typename implementation_defined::pointer pointer;
|
||||||
|
typedef typename implementation_defined::const_pointer const_pointer;
|
||||||
|
typedef typename implementation_defined::reference reference;
|
||||||
|
typedef typename implementation_defined::const_reference const_reference;
|
||||||
|
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::key_compare key_compare;
|
||||||
|
typedef typename implementation_defined::iterator iterator;
|
||||||
|
typedef typename implementation_defined::const_iterator const_iterator;
|
||||||
|
typedef typename implementation_defined::reverse_iterator reverse_iterator;
|
||||||
|
typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator;
|
||||||
|
typedef typename implementation_defined::insert_commit_data insert_commit_data;
|
||||||
|
typedef typename implementation_defined::node_traits node_traits;
|
||||||
|
typedef typename implementation_defined::node node;
|
||||||
|
typedef typename implementation_defined::node_ptr node_ptr;
|
||||||
|
typedef typename implementation_defined::const_node_ptr const_node_ptr;
|
||||||
|
typedef typename implementation_defined::node_algorithms node_algorithms;
|
||||||
|
|
||||||
|
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()
|
||||||
|
, 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 &)
|
||||||
|
template<class Iterator>
|
||||||
|
bs_set_impl( Iterator b, Iterator e
|
||||||
|
, const value_compare &cmp = value_compare()
|
||||||
|
, const value_traits &v_traits = value_traits())
|
||||||
|
: tree_type(true, b, e, cmp, v_traits)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::bstree(bstree &&)
|
||||||
|
bs_set_impl(BOOST_RV_REF(bs_set_impl) x)
|
||||||
|
: tree_type(::boost::move(static_cast<tree_type&>(x)))
|
||||||
|
{}
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::operator=(bstree &&)
|
||||||
|
bs_set_impl& operator=(BOOST_RV_REF(bs_set_impl) x)
|
||||||
|
{ return static_cast<bs_set_impl&>(tree_type::operator=(::boost::move(static_cast<tree_type&>(x)))); }
|
||||||
|
|
||||||
|
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::~bstree()
|
||||||
|
~bs_set_impl();
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::begin()
|
||||||
|
iterator begin();
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::begin()const
|
||||||
|
const_iterator begin() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::cbegin()const
|
||||||
|
const_iterator cbegin() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::end()
|
||||||
|
iterator end();
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::end()const
|
||||||
|
const_iterator end() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::cend()const
|
||||||
|
const_iterator cend() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::rbegin()
|
||||||
|
reverse_iterator rbegin();
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::rbegin()const
|
||||||
|
const_reverse_iterator rbegin() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::crbegin()const
|
||||||
|
const_reverse_iterator crbegin() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::rend()
|
||||||
|
reverse_iterator rend();
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::rend()const
|
||||||
|
const_reverse_iterator rend() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::crend()const
|
||||||
|
const_reverse_iterator crend() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::container_from_end_iterator(iterator)
|
||||||
|
static bs_set_impl &container_from_end_iterator(iterator end_iterator);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::container_from_end_iterator(const_iterator)
|
||||||
|
static const bs_set_impl &container_from_end_iterator(const_iterator end_iterator);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::container_from_iterator(iterator)
|
||||||
|
static bs_set_impl &container_from_iterator(iterator it);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::container_from_iterator(const_iterator)
|
||||||
|
static const bs_set_impl &container_from_iterator(const_iterator it);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::key_comp()const
|
||||||
|
key_compare key_comp() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::value_comp()const
|
||||||
|
value_compare value_comp() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::empty()const
|
||||||
|
bool empty() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::size()const
|
||||||
|
size_type size() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::swap
|
||||||
|
void swap(bs_set_impl& other);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::clone_from
|
||||||
|
template <class Cloner, class Disposer>
|
||||||
|
void clone_from(const bs_set_impl &src, Cloner cloner, Disposer disposer);
|
||||||
|
|
||||||
|
#endif //#ifdef BOOST_iNTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::insert_unique(reference)
|
||||||
|
std::pair<iterator, bool> insert(reference value)
|
||||||
|
{ return tree_type::insert_unique(value); }
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::insert_unique(const_iterator,reference)
|
||||||
|
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>
|
||||||
|
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); }
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const_iterator,const KeyType&,KeyValueCompare,insert_commit_data&)
|
||||||
|
template<class KeyType, class KeyValueCompare>
|
||||||
|
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); }
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::insert_unique(Iterator,Iterator)
|
||||||
|
template<class Iterator>
|
||||||
|
void insert(Iterator b, Iterator e)
|
||||||
|
{ tree_type::insert_unique(b, e); }
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::insert_unique_commit
|
||||||
|
iterator insert_commit(reference value, const insert_commit_data &commit_data)
|
||||||
|
{ return tree_type::insert_unique_commit(value, commit_data); }
|
||||||
|
|
||||||
|
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::insert_before
|
||||||
|
iterator insert_before(const_iterator pos, reference value);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::push_back
|
||||||
|
void push_back(reference value);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::push_front
|
||||||
|
void push_front(reference value);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::erase(const_iterator)
|
||||||
|
iterator erase(const_iterator i);
|
||||||
|
|
||||||
|
//! @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 KeyType&,KeyValueCompare)
|
||||||
|
template<class KeyType, class KeyValueCompare>
|
||||||
|
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_iterator,Disposer)
|
||||||
|
template<class Disposer>
|
||||||
|
iterator erase_and_dispose(const_iterator i, Disposer disposer);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_iterator,const_iterator,Disposer)
|
||||||
|
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)
|
||||||
|
template<class Disposer>
|
||||||
|
size_type erase_and_dispose(const_reference value, 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::clear
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::clear_and_dispose
|
||||||
|
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 KeyType&,KeyValueCompare)const
|
||||||
|
template<class KeyType, class KeyValueCompare>
|
||||||
|
size_type count(const KeyType& key, KeyValueCompare comp) const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)
|
||||||
|
iterator lower_bound(const_reference value);
|
||||||
|
|
||||||
|
//! @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_reference)const
|
||||||
|
const_iterator lower_bound(const_reference value) 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::upper_bound(const_reference)
|
||||||
|
iterator upper_bound(const_reference value);
|
||||||
|
|
||||||
|
//! @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_reference)const
|
||||||
|
const_iterator upper_bound(const_reference value) 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::find(const_reference)
|
||||||
|
iterator find(const_reference value);
|
||||||
|
|
||||||
|
//! @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_reference)const
|
||||||
|
const_iterator find(const_reference value) 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::equal_range(const_reference)
|
||||||
|
std::pair<iterator,iterator> equal_range(const_reference value);
|
||||||
|
|
||||||
|
//! @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_reference)const
|
||||||
|
std::pair<const_iterator, const_iterator>
|
||||||
|
equal_range(const_reference value) const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyValueCompare)const
|
||||||
|
template<class KeyType, class KeyValueCompare>
|
||||||
|
std::pair<const_iterator, const_iterator>
|
||||||
|
equal_range(const KeyType& key, KeyValueCompare comp) const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,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::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||||
|
template<class KeyType, class KeyValueCompare>
|
||||||
|
std::pair<iterator,iterator> bounded_range
|
||||||
|
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,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::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||||
|
template<class KeyType, class KeyValueCompare>
|
||||||
|
std::pair<const_iterator, const_iterator> bounded_range
|
||||||
|
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::s_iterator_to(reference)
|
||||||
|
static iterator s_iterator_to(reference value);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::s_iterator_to(const_reference)
|
||||||
|
static const_iterator s_iterator_to(const_reference value);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::iterator_to(reference)
|
||||||
|
iterator iterator_to(reference value);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::iterator_to(const_reference)const
|
||||||
|
const_iterator iterator_to(const_reference value) const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::init_node(reference)
|
||||||
|
static void init_node(reference value);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::unlink_leftmost_without_rebalance
|
||||||
|
pointer unlink_leftmost_without_rebalance();
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::replace_node
|
||||||
|
void replace_node(iterator replace_this, reference with_this);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::remove_node
|
||||||
|
void remove_node(reference value);
|
||||||
|
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
};
|
||||||
|
|
||||||
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
|
|
||||||
|
template<class T, class ...Options>
|
||||||
|
bool operator!= (const bs_set_impl<T, Options...> &x, const bs_set_impl<T, Options...> &y);
|
||||||
|
|
||||||
|
template<class T, class ...Options>
|
||||||
|
bool operator>(const bs_set_impl<T, Options...> &x, const bs_set_impl<T, Options...> &y);
|
||||||
|
|
||||||
|
template<class T, class ...Options>
|
||||||
|
bool operator<=(const bs_set_impl<T, Options...> &x, const bs_set_impl<T, Options...> &y);
|
||||||
|
|
||||||
|
template<class T, class ...Options>
|
||||||
|
bool operator>=(const bs_set_impl<T, Options...> &x, const bs_set_impl<T, Options...> &y);
|
||||||
|
|
||||||
|
template<class T, class ...Options>
|
||||||
|
void swap(bs_set_impl<T, Options...> &x, bs_set_impl<T, Options...> &y);
|
||||||
|
|
||||||
|
#endif //#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
|
|
||||||
|
//! Helper metafunction to define a \c bs_set that yields to the same type when the
|
||||||
|
//! same options (either explicitly or implicitly) are used.
|
||||||
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
|
template<class T, class ...Options>
|
||||||
|
#else
|
||||||
|
template<class T, class O1 = void, class O2 = void
|
||||||
|
, class O3 = void, class O4 = void>
|
||||||
|
#endif
|
||||||
|
struct make_bs_set
|
||||||
|
{
|
||||||
|
/// @cond
|
||||||
|
typedef typename pack_options
|
||||||
|
< bstree_defaults,
|
||||||
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
|
O1, O2, O3, O4
|
||||||
|
#else
|
||||||
|
Options...
|
||||||
|
#endif
|
||||||
|
>::type packed_options;
|
||||||
|
|
||||||
|
typedef typename detail::get_value_traits
|
||||||
|
<T, typename packed_options::proto_value_traits>::type value_traits;
|
||||||
|
|
||||||
|
typedef bs_set_impl
|
||||||
|
< value_traits
|
||||||
|
, typename packed_options::compare
|
||||||
|
, typename packed_options::size_type
|
||||||
|
, packed_options::constant_time_size
|
||||||
|
> implementation_defined;
|
||||||
|
/// @endcond
|
||||||
|
typedef implementation_defined type;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
|
template<class T, class O1, class O2, class O3, class O4>
|
||||||
|
#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
|
||||||
|
#else
|
||||||
|
Options...
|
||||||
|
#endif
|
||||||
|
>::type
|
||||||
|
{
|
||||||
|
typedef typename make_bs_set
|
||||||
|
<T,
|
||||||
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
|
O1, O2, O3, O4
|
||||||
|
#else
|
||||||
|
Options...
|
||||||
|
#endif
|
||||||
|
>::type Base;
|
||||||
|
|
||||||
|
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::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));
|
||||||
|
|
||||||
|
bs_set( const value_compare &cmp = value_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 value_traits &v_traits = value_traits())
|
||||||
|
: Base(b, e, cmp, v_traits)
|
||||||
|
{}
|
||||||
|
|
||||||
|
bs_set(BOOST_RV_REF(bs_set) x)
|
||||||
|
: Base(::boost::move(static_cast<Base&>(x)))
|
||||||
|
{}
|
||||||
|
|
||||||
|
bs_set& operator=(BOOST_RV_REF(bs_set) x)
|
||||||
|
{ return static_cast<bs_set &>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); }
|
||||||
|
|
||||||
|
static bs_set &container_from_end_iterator(iterator end_iterator)
|
||||||
|
{ return static_cast<bs_set &>(Base::container_from_end_iterator(end_iterator)); }
|
||||||
|
|
||||||
|
static const bs_set &container_from_end_iterator(const_iterator end_iterator)
|
||||||
|
{ return static_cast<const bs_set &>(Base::container_from_end_iterator(end_iterator)); }
|
||||||
|
|
||||||
|
static bs_set &container_from_iterator(iterator it)
|
||||||
|
{ return static_cast<bs_set &>(Base::container_from_iterator(it)); }
|
||||||
|
|
||||||
|
static const bs_set &container_from_iterator(const_iterator it)
|
||||||
|
{ return static_cast<const bs_set &>(Base::container_from_iterator(it)); }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//! The class template bs_multiset is an intrusive container, that mimics most of
|
||||||
|
//! the interface of std::multiset as described in the C++ standard.
|
||||||
|
//!
|
||||||
|
//! The template parameter \c T is the type to be managed by the container.
|
||||||
|
//! The user can specify additional options and if no options are provided
|
||||||
|
//! default options are used.
|
||||||
|
//!
|
||||||
|
//! The container supports the following options:
|
||||||
|
//! \c base_hook<>/member_hook<>/value_traits<>,
|
||||||
|
//! \c constant_time_size<>, \c size_type<> and
|
||||||
|
//! \c compare<>.
|
||||||
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
|
template<class T, class ...Options>
|
||||||
|
#else
|
||||||
|
template<class ValueTraits, class Compare, class SizeType, bool ConstantTimeSize>
|
||||||
|
#endif
|
||||||
|
class bs_multiset_impl
|
||||||
|
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
: public bstree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, RbTreeAlgorithms>
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
/// @cond
|
||||||
|
typedef bstree_impl<ValueTraits, Compare, SizeType, ConstantTimeSize, RbTreeAlgorithms> tree_type;
|
||||||
|
|
||||||
|
BOOST_MOVABLE_BUT_NOT_COPYABLE(bs_multiset_impl)
|
||||||
|
typedef tree_type implementation_defined;
|
||||||
|
/// @endcond
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef typename implementation_defined::value_type value_type;
|
||||||
|
typedef typename implementation_defined::value_traits value_traits;
|
||||||
|
typedef typename implementation_defined::pointer pointer;
|
||||||
|
typedef typename implementation_defined::const_pointer const_pointer;
|
||||||
|
typedef typename implementation_defined::reference reference;
|
||||||
|
typedef typename implementation_defined::const_reference const_reference;
|
||||||
|
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::key_compare key_compare;
|
||||||
|
typedef typename implementation_defined::iterator iterator;
|
||||||
|
typedef typename implementation_defined::const_iterator const_iterator;
|
||||||
|
typedef typename implementation_defined::reverse_iterator reverse_iterator;
|
||||||
|
typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator;
|
||||||
|
typedef typename implementation_defined::insert_commit_data insert_commit_data;
|
||||||
|
typedef typename implementation_defined::node_traits node_traits;
|
||||||
|
typedef typename implementation_defined::node node;
|
||||||
|
typedef typename implementation_defined::node_ptr node_ptr;
|
||||||
|
typedef typename implementation_defined::const_node_ptr const_node_ptr;
|
||||||
|
typedef typename implementation_defined::node_algorithms node_algorithms;
|
||||||
|
|
||||||
|
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()
|
||||||
|
, 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 &)
|
||||||
|
template<class Iterator>
|
||||||
|
bs_multiset_impl( Iterator b, Iterator e
|
||||||
|
, const value_compare &cmp = value_compare()
|
||||||
|
, const value_traits &v_traits = value_traits())
|
||||||
|
: tree_type(false, b, e, cmp, v_traits)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::bstree(bstree &&)
|
||||||
|
bs_multiset_impl(BOOST_RV_REF(bs_multiset_impl) x)
|
||||||
|
: tree_type(::boost::move(static_cast<tree_type&>(x)))
|
||||||
|
{}
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::operator=(bstree &&)
|
||||||
|
bs_multiset_impl& operator=(BOOST_RV_REF(bs_multiset_impl) x)
|
||||||
|
{ return static_cast<bs_multiset_impl&>(tree_type::operator=(::boost::move(static_cast<tree_type&>(x)))); }
|
||||||
|
|
||||||
|
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::~bstree()
|
||||||
|
~bs_multiset_impl();
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::begin()
|
||||||
|
iterator begin();
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::begin()const
|
||||||
|
const_iterator begin() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::cbegin()const
|
||||||
|
const_iterator cbegin() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::end()
|
||||||
|
iterator end();
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::end()const
|
||||||
|
const_iterator end() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::cend()const
|
||||||
|
const_iterator cend() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::rbegin()
|
||||||
|
reverse_iterator rbegin();
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::rbegin()const
|
||||||
|
const_reverse_iterator rbegin() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::crbegin()const
|
||||||
|
const_reverse_iterator crbegin() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::rend()
|
||||||
|
reverse_iterator rend();
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::rend()const
|
||||||
|
const_reverse_iterator rend() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::crend()const
|
||||||
|
const_reverse_iterator crend() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::container_from_end_iterator(iterator)
|
||||||
|
static bs_multiset_impl &container_from_end_iterator(iterator end_iterator);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::container_from_end_iterator(const_iterator)
|
||||||
|
static const bs_multiset_impl &container_from_end_iterator(const_iterator end_iterator);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::container_from_iterator(iterator)
|
||||||
|
static bs_multiset_impl &container_from_iterator(iterator it);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::container_from_iterator(const_iterator)
|
||||||
|
static const bs_multiset_impl &container_from_iterator(const_iterator it);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::key_comp()const
|
||||||
|
key_compare key_comp() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::value_comp()const
|
||||||
|
value_compare value_comp() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::empty()const
|
||||||
|
bool empty() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::size()const
|
||||||
|
size_type size() const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::swap
|
||||||
|
void swap(bs_multiset_impl& other);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::clone_from
|
||||||
|
template <class Cloner, class Disposer>
|
||||||
|
void clone_from(const bs_multiset_impl &src, Cloner cloner, Disposer disposer);
|
||||||
|
|
||||||
|
#endif //#ifdef BOOST_iNTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::insert_equal(reference)
|
||||||
|
iterator insert(reference value)
|
||||||
|
{ return tree_type::insert_equal(value); }
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::insert_equal(const_iterator,reference)
|
||||||
|
iterator insert(const_iterator hint, reference value)
|
||||||
|
{ return tree_type::insert_equal(hint, value); }
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::insert_equal(Iterator,Iterator)
|
||||||
|
template<class Iterator>
|
||||||
|
void insert(Iterator b, Iterator e)
|
||||||
|
{ tree_type::insert_equal(b, e); }
|
||||||
|
|
||||||
|
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::insert_before
|
||||||
|
iterator insert_before(const_iterator pos, reference value);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::push_back
|
||||||
|
void push_back(reference value);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::push_front
|
||||||
|
void push_front(reference value);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::erase(const_iterator)
|
||||||
|
iterator erase(const_iterator i);
|
||||||
|
|
||||||
|
//! @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 KeyType&,KeyValueCompare)
|
||||||
|
template<class KeyType, class KeyValueCompare>
|
||||||
|
size_type erase(const KeyType& key, KeyValueCompare comp);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_iterator,Disposer)
|
||||||
|
template<class Disposer>
|
||||||
|
iterator erase_and_dispose(const_iterator i, Disposer disposer);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_iterator,const_iterator,Disposer)
|
||||||
|
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)
|
||||||
|
template<class Disposer>
|
||||||
|
size_type erase_and_dispose(const_reference value, 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::clear
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::clear_and_dispose
|
||||||
|
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 KeyType&,KeyValueCompare)const
|
||||||
|
template<class KeyType, class KeyValueCompare>
|
||||||
|
size_type count(const KeyType& key, KeyValueCompare comp) const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)
|
||||||
|
iterator lower_bound(const_reference value);
|
||||||
|
|
||||||
|
//! @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_reference)const
|
||||||
|
const_iterator lower_bound(const_reference value) 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::upper_bound(const_reference)
|
||||||
|
iterator upper_bound(const_reference value);
|
||||||
|
|
||||||
|
//! @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_reference)const
|
||||||
|
const_iterator upper_bound(const_reference value) 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::find(const_reference)
|
||||||
|
iterator find(const_reference value);
|
||||||
|
|
||||||
|
//! @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_reference)const
|
||||||
|
const_iterator find(const_reference value) 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::equal_range(const_reference)
|
||||||
|
std::pair<iterator,iterator> equal_range(const_reference value);
|
||||||
|
|
||||||
|
//! @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_reference)const
|
||||||
|
std::pair<const_iterator, const_iterator>
|
||||||
|
equal_range(const_reference value) const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyValueCompare)const
|
||||||
|
template<class KeyType, class KeyValueCompare>
|
||||||
|
std::pair<const_iterator, const_iterator>
|
||||||
|
equal_range(const KeyType& key, KeyValueCompare comp) const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,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::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)
|
||||||
|
template<class KeyType, class KeyValueCompare>
|
||||||
|
std::pair<iterator,iterator> bounded_range
|
||||||
|
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,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::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const
|
||||||
|
template<class KeyType, class KeyValueCompare>
|
||||||
|
std::pair<const_iterator, const_iterator> bounded_range
|
||||||
|
(const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::s_iterator_to(reference)
|
||||||
|
static iterator s_iterator_to(reference value);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::s_iterator_to(const_reference)
|
||||||
|
static const_iterator s_iterator_to(const_reference value);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::iterator_to(reference)
|
||||||
|
iterator iterator_to(reference value);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::iterator_to(const_reference)const
|
||||||
|
const_iterator iterator_to(const_reference value) const;
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::init_node(reference)
|
||||||
|
static void init_node(reference value);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::unlink_leftmost_without_rebalance
|
||||||
|
pointer unlink_leftmost_without_rebalance();
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::replace_node
|
||||||
|
void replace_node(iterator replace_this, reference with_this);
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree::remove_node
|
||||||
|
void remove_node(reference value);
|
||||||
|
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
};
|
||||||
|
|
||||||
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
|
|
||||||
|
template<class T, class ...Options>
|
||||||
|
bool operator!= (const bs_multiset_impl<T, Options...> &x, const bs_multiset_impl<T, Options...> &y);
|
||||||
|
|
||||||
|
template<class T, class ...Options>
|
||||||
|
bool operator>(const bs_multiset_impl<T, Options...> &x, const bs_multiset_impl<T, Options...> &y);
|
||||||
|
|
||||||
|
template<class T, class ...Options>
|
||||||
|
bool operator<=(const bs_multiset_impl<T, Options...> &x, const bs_multiset_impl<T, Options...> &y);
|
||||||
|
|
||||||
|
template<class T, class ...Options>
|
||||||
|
bool operator>=(const bs_multiset_impl<T, Options...> &x, const bs_multiset_impl<T, Options...> &y);
|
||||||
|
|
||||||
|
template<class T, class ...Options>
|
||||||
|
void swap(bs_multiset_impl<T, Options...> &x, bs_multiset_impl<T, Options...> &y);
|
||||||
|
|
||||||
|
#endif //#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
|
|
||||||
|
//! Helper metafunction to define a \c bs_multiset that yields to the same type when the
|
||||||
|
//! same options (either explicitly or implicitly) are used.
|
||||||
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
|
template<class T, class ...Options>
|
||||||
|
#else
|
||||||
|
template<class T, class O1 = void, class O2 = void
|
||||||
|
, class O3 = void, class O4 = void>
|
||||||
|
#endif
|
||||||
|
struct make_bs_multiset
|
||||||
|
{
|
||||||
|
/// @cond
|
||||||
|
typedef typename pack_options
|
||||||
|
< bstree_defaults,
|
||||||
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
|
O1, O2, O3, O4
|
||||||
|
#else
|
||||||
|
Options...
|
||||||
|
#endif
|
||||||
|
>::type packed_options;
|
||||||
|
|
||||||
|
typedef typename detail::get_value_traits
|
||||||
|
<T, typename packed_options::proto_value_traits>::type value_traits;
|
||||||
|
|
||||||
|
typedef bs_multiset_impl
|
||||||
|
< value_traits
|
||||||
|
, typename packed_options::compare
|
||||||
|
, typename packed_options::size_type
|
||||||
|
, packed_options::constant_time_size
|
||||||
|
> implementation_defined;
|
||||||
|
/// @endcond
|
||||||
|
typedef implementation_defined type;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
|
||||||
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
|
template<class T, class O1, class O2, class O3, class O4>
|
||||||
|
#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
|
||||||
|
#else
|
||||||
|
Options...
|
||||||
|
#endif
|
||||||
|
>::type
|
||||||
|
{
|
||||||
|
typedef typename make_bs_multiset<T,
|
||||||
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
|
O1, O2, O3, O4
|
||||||
|
#else
|
||||||
|
Options...
|
||||||
|
#endif
|
||||||
|
>::type Base;
|
||||||
|
|
||||||
|
BOOST_MOVABLE_BUT_NOT_COPYABLE(bs_multiset)
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef typename Base::value_compare value_compare;
|
||||||
|
typedef typename Base::value_traits value_traits;
|
||||||
|
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));
|
||||||
|
|
||||||
|
bs_multiset( const value_compare &cmp = value_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 value_traits &v_traits = value_traits())
|
||||||
|
: Base(b, e, cmp, v_traits)
|
||||||
|
{}
|
||||||
|
|
||||||
|
bs_multiset(BOOST_RV_REF(bs_multiset) x)
|
||||||
|
: Base(::boost::move(static_cast<Base&>(x)))
|
||||||
|
{}
|
||||||
|
|
||||||
|
bs_multiset& operator=(BOOST_RV_REF(bs_multiset) x)
|
||||||
|
{ return static_cast<bs_multiset &>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); }
|
||||||
|
|
||||||
|
static bs_multiset &container_from_end_iterator(iterator end_iterator)
|
||||||
|
{ return static_cast<bs_multiset &>(Base::container_from_end_iterator(end_iterator)); }
|
||||||
|
|
||||||
|
static const bs_multiset &container_from_end_iterator(const_iterator end_iterator)
|
||||||
|
{ return static_cast<const bs_multiset &>(Base::container_from_end_iterator(end_iterator)); }
|
||||||
|
|
||||||
|
static bs_multiset &container_from_iterator(iterator it)
|
||||||
|
{ return static_cast<bs_multiset &>(Base::container_from_iterator(it)); }
|
||||||
|
|
||||||
|
static const bs_multiset &container_from_iterator(const_iterator it)
|
||||||
|
{ return static_cast<const bs_multiset &>(Base::container_from_iterator(it)); }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} //namespace intrusive
|
||||||
|
} //namespace boost
|
||||||
|
|
||||||
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
|
#endif //BOOST_INTRUSIVE_BS_SET_HPP
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -17,7 +17,7 @@
|
|||||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||||
#include <boost/intrusive/detail/utilities.hpp>
|
#include <boost/intrusive/detail/utilities.hpp>
|
||||||
#include <boost/intrusive/detail/tree_node.hpp>
|
#include <boost/intrusive/detail/tree_node.hpp>
|
||||||
#include <boost/intrusive/detail/tree_algorithms.hpp>
|
#include <boost/intrusive/bstree_algorithms.hpp>
|
||||||
#include <boost/intrusive/options.hpp>
|
#include <boost/intrusive/options.hpp>
|
||||||
#include <boost/intrusive/detail/generic_hook.hpp>
|
#include <boost/intrusive/detail/generic_hook.hpp>
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ namespace intrusive {
|
|||||||
template<class VoidPointer>
|
template<class VoidPointer>
|
||||||
struct get_bs_set_node_algo
|
struct get_bs_set_node_algo
|
||||||
{
|
{
|
||||||
typedef detail::tree_algorithms<tree_node_traits<VoidPointer> > type;
|
typedef bstree_algorithms<tree_node_traits<VoidPointer> > type;
|
||||||
};
|
};
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ struct get_bs_set_node_algo
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class O1 = none, class O2 = none, class O3 = none>
|
template<class O1 = void, class O2 = void, class O3 = void>
|
||||||
#endif
|
#endif
|
||||||
struct make_bs_set_base_hook
|
struct make_bs_set_base_hook
|
||||||
{
|
{
|
||||||
@ -50,14 +50,11 @@ struct make_bs_set_base_hook
|
|||||||
#endif
|
#endif
|
||||||
::type packed_options;
|
::type packed_options;
|
||||||
|
|
||||||
//Scapegoat trees can't be auto unlink trees
|
typedef generic_hook
|
||||||
BOOST_STATIC_ASSERT(((int)packed_options::link_mode != (int)auto_unlink));
|
|
||||||
|
|
||||||
typedef detail::generic_hook
|
|
||||||
< get_bs_set_node_algo<typename packed_options::void_pointer>
|
< get_bs_set_node_algo<typename packed_options::void_pointer>
|
||||||
, typename packed_options::tag
|
, typename packed_options::tag
|
||||||
, packed_options::link_mode
|
, packed_options::link_mode
|
||||||
, detail::BsSetBaseHook
|
, BsTreeBaseHookId
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
@ -168,7 +165,7 @@ class bs_set_base_hook
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class O1 = none, class O2 = none, class O3 = none>
|
template<class O1 = void, class O2 = void, class O3 = void>
|
||||||
#endif
|
#endif
|
||||||
struct make_bs_set_member_hook
|
struct make_bs_set_member_hook
|
||||||
{
|
{
|
||||||
@ -182,14 +179,11 @@ struct make_bs_set_member_hook
|
|||||||
|
|
||||||
::type packed_options;
|
::type packed_options;
|
||||||
|
|
||||||
//Scapegoat trees can't be auto unlink trees
|
typedef generic_hook
|
||||||
BOOST_STATIC_ASSERT(((int)packed_options::link_mode != (int)auto_unlink));
|
|
||||||
|
|
||||||
typedef detail::generic_hook
|
|
||||||
< get_bs_set_node_algo<typename packed_options::void_pointer>
|
< get_bs_set_node_algo<typename packed_options::void_pointer>
|
||||||
, member_tag
|
, member_tag
|
||||||
, packed_options::link_mode
|
, packed_options::link_mode
|
||||||
, detail::NoBaseHook
|
, NoBaseHookId
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
|
2012
include/boost/intrusive/bstree.hpp
Normal file
2012
include/boost/intrusive/bstree.hpp
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <boost/intrusive/detail/config_begin.hpp>
|
#include <boost/intrusive/detail/config_begin.hpp>
|
||||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||||
|
#include <boost/intrusive/detail/utilities.hpp>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
@ -405,6 +406,16 @@ class circular_list_algorithms
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// @cond
|
||||||
|
|
||||||
|
template<class NodeTraits>
|
||||||
|
struct get_algo<CircularListAlgorithms, NodeTraits>
|
||||||
|
{
|
||||||
|
typedef circular_list_algorithms<NodeTraits> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// @endcond
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -18,6 +18,7 @@
|
|||||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||||
#include <boost/intrusive/detail/common_slist_algorithms.hpp>
|
#include <boost/intrusive/detail/common_slist_algorithms.hpp>
|
||||||
#include <boost/intrusive/detail/assert.hpp>
|
#include <boost/intrusive/detail/assert.hpp>
|
||||||
|
#include <boost/intrusive/detail/utilities.hpp>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
@ -396,6 +397,16 @@ class circular_slist_algorithms
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// @cond
|
||||||
|
|
||||||
|
template<class NodeTraits>
|
||||||
|
struct get_algo<CircularSListAlgorithms, NodeTraits>
|
||||||
|
{
|
||||||
|
typedef circular_slist_algorithms<NodeTraits> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// @endcond
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//////} // ///////////////////////////////////////////////////////////////////////
|
//////} // ///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost
|
// (C) Copyright Ion Gaztanaga 2008-2013. Distributed under the Boost
|
||||||
// Software License, Version 1.0. (See accompanying file
|
// Software License, Version 1.0. (See accompanying file
|
||||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Joaquin M Lopez Munoz 2006-2012
|
// (C) Copyright Joaquin M Lopez Munoz 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2009-2012.
|
// (C) Copyright Ion Gaztanaga 2009-2013.
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -24,85 +24,71 @@
|
|||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace intrusive {
|
namespace intrusive {
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
/// @cond
|
/// @cond
|
||||||
|
|
||||||
enum
|
enum base_hook_type
|
||||||
{ NoBaseHook
|
{ NoBaseHookId
|
||||||
, ListBaseHook
|
, ListBaseHookId
|
||||||
, SlistBaseHook
|
, SlistBaseHookId
|
||||||
, SetBaseHook
|
, RbTreeBaseHookId
|
||||||
, UsetBaseHook
|
, HashBaseHookId
|
||||||
, SplaySetBaseHook
|
, SplayTreeBaseHookId
|
||||||
, AvlSetBaseHook
|
, AvlTreeBaseHookId
|
||||||
, BsSetBaseHook
|
, BsTreeBaseHookId
|
||||||
, AnyBaseHook
|
, AnyBaseHookId
|
||||||
};
|
};
|
||||||
|
|
||||||
struct no_default_definer{};
|
|
||||||
|
|
||||||
template <class Hook, unsigned int>
|
template <class HookTags, unsigned int>
|
||||||
struct default_definer;
|
struct hook_tags_definer{};
|
||||||
|
|
||||||
template <class Hook>
|
template <class HookTags>
|
||||||
struct default_definer<Hook, ListBaseHook>
|
struct hook_tags_definer<HookTags, ListBaseHookId>
|
||||||
{ typedef Hook default_list_hook; };
|
{ typedef HookTags default_list_hook; };
|
||||||
|
|
||||||
template <class Hook>
|
template <class HookTags>
|
||||||
struct default_definer<Hook, SlistBaseHook>
|
struct hook_tags_definer<HookTags, SlistBaseHookId>
|
||||||
{ typedef Hook default_slist_hook; };
|
{ typedef HookTags default_slist_hook; };
|
||||||
|
|
||||||
template <class Hook>
|
template <class HookTags>
|
||||||
struct default_definer<Hook, SetBaseHook>
|
struct hook_tags_definer<HookTags, RbTreeBaseHookId>
|
||||||
{ typedef Hook default_set_hook; };
|
{ typedef HookTags default_rbtree_hook; };
|
||||||
|
|
||||||
template <class Hook>
|
template <class HookTags>
|
||||||
struct default_definer<Hook, UsetBaseHook>
|
struct hook_tags_definer<HookTags, HashBaseHookId>
|
||||||
{ typedef Hook default_uset_hook; };
|
{ typedef HookTags default_hashtable_hook; };
|
||||||
|
|
||||||
template <class Hook>
|
template <class HookTags>
|
||||||
struct default_definer<Hook, SplaySetBaseHook>
|
struct hook_tags_definer<HookTags, SplayTreeBaseHookId>
|
||||||
{ typedef Hook default_splay_set_hook; };
|
{ typedef HookTags default_splaytree_hook; };
|
||||||
|
|
||||||
template <class Hook>
|
template <class HookTags>
|
||||||
struct default_definer<Hook, AvlSetBaseHook>
|
struct hook_tags_definer<HookTags, AvlTreeBaseHookId>
|
||||||
{ typedef Hook default_avl_set_hook; };
|
{ typedef HookTags default_avltree_hook; };
|
||||||
|
|
||||||
template <class Hook>
|
template <class HookTags>
|
||||||
struct default_definer<Hook, BsSetBaseHook>
|
struct hook_tags_definer<HookTags, BsTreeBaseHookId>
|
||||||
{ typedef Hook default_bs_set_hook; };
|
{ typedef HookTags default_bstree_hook; };
|
||||||
|
|
||||||
template <class Hook>
|
template <class HookTags>
|
||||||
struct default_definer<Hook, AnyBaseHook>
|
struct hook_tags_definer<HookTags, AnyBaseHookId>
|
||||||
{ typedef Hook default_any_hook; };
|
{ typedef HookTags default_any_hook; };
|
||||||
|
|
||||||
template <class Hook, unsigned int BaseHookType>
|
|
||||||
struct make_default_definer
|
|
||||||
{
|
|
||||||
typedef typename detail::if_c
|
|
||||||
< BaseHookType != 0
|
|
||||||
, default_definer<Hook, BaseHookType>
|
|
||||||
, no_default_definer>::type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template
|
template
|
||||||
< class GetNodeAlgorithms
|
< class NodeTraits
|
||||||
, class Tag
|
, class Tag
|
||||||
, link_mode_type LinkMode
|
, link_mode_type LinkMode
|
||||||
, int HookType
|
, base_hook_type BaseHookType
|
||||||
>
|
>
|
||||||
struct make_node_holder
|
struct hooktags
|
||||||
{
|
{
|
||||||
typedef typename detail::if_c
|
static const link_mode_type link_mode = LinkMode;
|
||||||
<!detail::is_same<Tag, member_tag>::value
|
typedef Tag tag;
|
||||||
, detail::node_holder
|
typedef NodeTraits node_traits;
|
||||||
< typename GetNodeAlgorithms::type::node
|
static const bool is_base_hook = !detail::is_same<Tag, member_tag>::value;
|
||||||
, Tag
|
static const bool safemode_or_autounlink = is_safe_autounlink<link_mode>::value;
|
||||||
, LinkMode
|
static const unsigned int type = BaseHookType;
|
||||||
, HookType>
|
|
||||||
, typename GetNodeAlgorithms::type::node
|
|
||||||
>::type type;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
@ -111,22 +97,28 @@ template
|
|||||||
< class GetNodeAlgorithms
|
< class GetNodeAlgorithms
|
||||||
, class Tag
|
, class Tag
|
||||||
, link_mode_type LinkMode
|
, link_mode_type LinkMode
|
||||||
, int HookType
|
, base_hook_type BaseHookType
|
||||||
>
|
>
|
||||||
class generic_hook
|
class generic_hook
|
||||||
/// @cond
|
/// @cond
|
||||||
|
//If the hook is a base hook, derive generic hook from node_holder
|
||||||
//If the hook is a base hook, derive generic hook from detail::node_holder
|
|
||||||
//so that a unique base class is created to convert from the node
|
//so that a unique base class is created to convert from the node
|
||||||
//to the type. This mechanism will be used by base_hook_traits.
|
//to the type. This mechanism will be used by bhtraits.
|
||||||
//
|
//
|
||||||
//If the hook is a member hook, generic hook will directly derive
|
//If the hook is a member hook, generic hook will directly derive
|
||||||
//from the hook.
|
//from the hook.
|
||||||
: public make_default_definer
|
: public detail::if_c
|
||||||
< generic_hook<GetNodeAlgorithms, Tag, LinkMode, HookType>
|
< detail::is_same<Tag, member_tag>::value
|
||||||
, detail::is_same<Tag, default_tag>::value*HookType
|
, typename GetNodeAlgorithms::type::node
|
||||||
|
, node_holder<typename GetNodeAlgorithms::type::node, Tag, BaseHookType>
|
||||||
>::type
|
>::type
|
||||||
, public make_node_holder<GetNodeAlgorithms, Tag, LinkMode, HookType>::type
|
//If this is the a default-tagged base hook derive from a class that
|
||||||
|
//will define an special internal typedef. Containers will be able to detect this
|
||||||
|
//special typedef and obtain generic_hook's internal types in order to deduce
|
||||||
|
//value_traits for this hook.
|
||||||
|
, public hook_tags_definer
|
||||||
|
< generic_hook<GetNodeAlgorithms, Tag, LinkMode, BaseHookType>
|
||||||
|
, detail::is_same<Tag, default_tag>::value*BaseHookType>
|
||||||
/// @endcond
|
/// @endcond
|
||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
@ -136,16 +128,10 @@ class generic_hook
|
|||||||
typedef typename node_algorithms::const_node_ptr const_node_ptr;
|
typedef typename node_algorithms::const_node_ptr const_node_ptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct boost_intrusive_tags
|
|
||||||
{
|
typedef hooktags
|
||||||
static const int hook_type = HookType;
|
< typename GetNodeAlgorithms::type::node_traits
|
||||||
static const link_mode_type link_mode = LinkMode;
|
, Tag, LinkMode, BaseHookType> hooktags;
|
||||||
typedef Tag tag;
|
|
||||||
typedef typename GetNodeAlgorithms::type::node_traits node_traits;
|
|
||||||
static const bool is_base_hook = !detail::is_same<Tag, member_tag>::value;
|
|
||||||
static const bool safemode_or_autounlink =
|
|
||||||
(int)link_mode == (int)auto_unlink || (int)link_mode == (int)safe_link;
|
|
||||||
};
|
|
||||||
|
|
||||||
node_ptr this_ptr()
|
node_ptr this_ptr()
|
||||||
{ return pointer_traits<node_ptr>::pointer_to(static_cast<node&>(*this)); }
|
{ return pointer_traits<node_ptr>::pointer_to(static_cast<node&>(*this)); }
|
||||||
@ -158,14 +144,14 @@ class generic_hook
|
|||||||
|
|
||||||
generic_hook()
|
generic_hook()
|
||||||
{
|
{
|
||||||
if(boost_intrusive_tags::safemode_or_autounlink){
|
if(hooktags::safemode_or_autounlink){
|
||||||
node_algorithms::init(this->this_ptr());
|
node_algorithms::init(this->this_ptr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
generic_hook(const generic_hook& )
|
generic_hook(const generic_hook& )
|
||||||
{
|
{
|
||||||
if(boost_intrusive_tags::safemode_or_autounlink){
|
if(hooktags::safemode_or_autounlink){
|
||||||
node_algorithms::init(this->this_ptr());
|
node_algorithms::init(this->this_ptr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,7 +162,7 @@ class generic_hook
|
|||||||
~generic_hook()
|
~generic_hook()
|
||||||
{
|
{
|
||||||
destructor_impl
|
destructor_impl
|
||||||
(*this, detail::link_dispatch<boost_intrusive_tags::link_mode>());
|
(*this, detail::link_dispatch<hooktags::link_mode>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void swap_nodes(generic_hook &other)
|
void swap_nodes(generic_hook &other)
|
||||||
@ -188,19 +174,18 @@ class generic_hook
|
|||||||
bool is_linked() const
|
bool is_linked() const
|
||||||
{
|
{
|
||||||
//is_linked() can be only used in safe-mode or auto-unlink
|
//is_linked() can be only used in safe-mode or auto-unlink
|
||||||
BOOST_STATIC_ASSERT(( boost_intrusive_tags::safemode_or_autounlink ));
|
BOOST_STATIC_ASSERT(( hooktags::safemode_or_autounlink ));
|
||||||
return !node_algorithms::unique(this->this_ptr());
|
return !node_algorithms::unique(this->this_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
void unlink()
|
void unlink()
|
||||||
{
|
{
|
||||||
BOOST_STATIC_ASSERT(( (int)boost_intrusive_tags::link_mode == (int)auto_unlink ));
|
BOOST_STATIC_ASSERT(( (int)hooktags::link_mode == (int)auto_unlink ));
|
||||||
node_algorithms::unlink(this->this_ptr());
|
node_algorithms::unlink(this->this_ptr());
|
||||||
node_algorithms::init(this->this_ptr());
|
node_algorithms::init(this->this_ptr());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace detail
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
|
// (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost
|
||||||
// Software License, Version 1.0. (See accompanying file
|
// Software License, Version 1.0. (See accompanying file
|
||||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -20,11 +20,13 @@
|
|||||||
#include <boost/intrusive/circular_list_algorithms.hpp>
|
#include <boost/intrusive/circular_list_algorithms.hpp>
|
||||||
#include <boost/intrusive/detail/mpl.hpp>
|
#include <boost/intrusive/detail/mpl.hpp>
|
||||||
#include <boost/intrusive/detail/utilities.hpp>
|
#include <boost/intrusive/detail/utilities.hpp>
|
||||||
//#include <boost/intrusive/detail/slist_node.hpp> //remove-me
|
#include <boost/intrusive/slist.hpp> //remove-me
|
||||||
#include <boost/intrusive/pointer_traits.hpp>
|
#include <boost/intrusive/pointer_traits.hpp>
|
||||||
|
#include <boost/intrusive/trivial_value_traits.hpp>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <boost/type_traits/make_unsigned.hpp>
|
||||||
#include <boost/pointer_cast.hpp>
|
#include <boost/pointer_cast.hpp>
|
||||||
#include <boost/move/move.hpp>
|
#include <boost/move/core.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
@ -89,6 +91,7 @@ struct bucket_traits_impl
|
|||||||
typedef typename pointer_traits
|
typedef typename pointer_traits
|
||||||
<typename Slist::pointer>::template rebind_pointer
|
<typename Slist::pointer>::template rebind_pointer
|
||||||
< bucket_impl<Slist> >::type bucket_ptr;
|
< bucket_impl<Slist> >::type bucket_ptr;
|
||||||
|
typedef Slist slist;
|
||||||
typedef typename Slist::size_type size_type;
|
typedef typename Slist::size_type size_type;
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
@ -100,7 +103,6 @@ struct bucket_traits_impl
|
|||||||
: buckets_(x.buckets_), buckets_len_(x.buckets_len_)
|
: buckets_(x.buckets_), buckets_len_(x.buckets_len_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
bucket_traits_impl(BOOST_RV_REF(bucket_traits_impl) x)
|
bucket_traits_impl(BOOST_RV_REF(bucket_traits_impl) x)
|
||||||
: buckets_(x.buckets_), buckets_len_(x.buckets_len_)
|
: buckets_(x.buckets_), buckets_len_(x.buckets_len_)
|
||||||
{ x.buckets_ = bucket_ptr(); x.buckets_len_ = 0; }
|
{ x.buckets_ = bucket_ptr(); x.buckets_len_ = 0; }
|
||||||
@ -127,57 +129,104 @@ struct bucket_traits_impl
|
|||||||
size_type buckets_len_;
|
size_type buckets_len_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class Container, bool IsConst>
|
template <class NodeTraits>
|
||||||
|
struct hash_reduced_slist_node_traits
|
||||||
|
{
|
||||||
|
template <class U> static detail::one test(...);
|
||||||
|
template <class U> static detail::two test(typename U::reduced_slist_node_traits* = 0);
|
||||||
|
static const bool value = sizeof(test<NodeTraits>(0)) == sizeof(detail::two);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class NodeTraits>
|
||||||
|
struct apply_reduced_slist_node_traits
|
||||||
|
{
|
||||||
|
typedef typename NodeTraits::reduced_slist_node_traits type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class NodeTraits>
|
||||||
|
struct reduced_slist_node_traits
|
||||||
|
{
|
||||||
|
typedef typename detail::eval_if_c
|
||||||
|
< hash_reduced_slist_node_traits<NodeTraits>::value
|
||||||
|
, apply_reduced_slist_node_traits<NodeTraits>
|
||||||
|
, detail::identity<NodeTraits>
|
||||||
|
>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class NodeTraits>
|
||||||
|
struct get_slist_impl
|
||||||
|
{
|
||||||
|
typedef trivial_value_traits<NodeTraits, normal_link> trivial_traits;
|
||||||
|
|
||||||
|
//Reducing symbol length
|
||||||
|
struct type : make_slist
|
||||||
|
< typename NodeTraits::node
|
||||||
|
, boost::intrusive::value_traits<trivial_traits>
|
||||||
|
, boost::intrusive::constant_time_size<false>
|
||||||
|
, boost::intrusive::size_type<typename boost::make_unsigned
|
||||||
|
<typename pointer_traits<typename NodeTraits::node_ptr>::difference_type>::type >
|
||||||
|
>::type
|
||||||
|
{};
|
||||||
|
};
|
||||||
|
|
||||||
|
} //namespace detail {
|
||||||
|
|
||||||
|
template<class BucketValueTraits, bool IsConst>
|
||||||
class hashtable_iterator
|
class hashtable_iterator
|
||||||
: public std::iterator
|
: public std::iterator
|
||||||
< std::forward_iterator_tag
|
< std::forward_iterator_tag
|
||||||
, typename Container::value_type
|
, typename BucketValueTraits::real_value_traits::value_type
|
||||||
, typename pointer_traits<typename Container::value_type*>::difference_type
|
, typename pointer_traits<typename BucketValueTraits::real_value_traits::value_type*>::difference_type
|
||||||
, typename detail::add_const_if_c
|
, typename detail::add_const_if_c
|
||||||
<typename Container::value_type, IsConst>::type *
|
<typename BucketValueTraits::real_value_traits::value_type, IsConst>::type *
|
||||||
, typename detail::add_const_if_c
|
, typename detail::add_const_if_c
|
||||||
<typename Container::value_type, IsConst>::type &
|
<typename BucketValueTraits::real_value_traits::value_type, IsConst>::type &
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
typedef typename Container::real_value_traits real_value_traits;
|
typedef typename BucketValueTraits::real_value_traits real_value_traits;
|
||||||
typedef typename Container::siterator siterator;
|
typedef typename BucketValueTraits::real_bucket_traits real_bucket_traits;
|
||||||
typedef typename Container::const_siterator const_siterator;
|
typedef typename real_value_traits::node_traits node_traits;
|
||||||
typedef typename Container::bucket_type bucket_type;
|
typedef typename detail::get_slist_impl
|
||||||
|
<typename detail::reduced_slist_node_traits
|
||||||
|
<typename real_value_traits::node_traits>::type
|
||||||
|
>::type slist_impl;
|
||||||
|
typedef typename slist_impl::iterator siterator;
|
||||||
|
typedef typename slist_impl::const_iterator const_siterator;
|
||||||
|
typedef detail::bucket_impl<slist_impl> bucket_type;
|
||||||
|
|
||||||
typedef typename pointer_traits
|
typedef typename pointer_traits
|
||||||
<typename Container::pointer>::template rebind_pointer
|
<typename real_value_traits::pointer>::template rebind_pointer
|
||||||
< const Container >::type const_cont_ptr;
|
< const BucketValueTraits >::type const_bucketvaltraits_ptr;
|
||||||
typedef typename Container::size_type size_type;
|
typedef typename slist_impl::size_type size_type;
|
||||||
|
|
||||||
static typename Container::node_ptr downcast_bucket(typename bucket_type::node_ptr p)
|
|
||||||
|
static typename node_traits::node_ptr downcast_bucket(typename bucket_type::node_ptr p)
|
||||||
{
|
{
|
||||||
return pointer_traits<typename Container::node_ptr>::
|
return pointer_traits<typename node_traits::node_ptr>::
|
||||||
pointer_to(static_cast<typename Container::node&>(*p));
|
pointer_to(static_cast<typename node_traits::node&>(*p));
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename Container::value_type value_type;
|
typedef typename real_value_traits::value_type value_type;
|
||||||
typedef typename detail::add_const_if_c
|
typedef typename detail::add_const_if_c<value_type, IsConst>::type *pointer;
|
||||||
<typename Container::value_type, IsConst>::type *pointer;
|
typedef typename detail::add_const_if_c<value_type, IsConst>::type &reference;
|
||||||
typedef typename detail::add_const_if_c
|
|
||||||
<typename Container::value_type, IsConst>::type &reference;
|
|
||||||
|
|
||||||
hashtable_iterator ()
|
hashtable_iterator ()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
explicit hashtable_iterator(siterator ptr, const Container *cont)
|
explicit hashtable_iterator(siterator ptr, const BucketValueTraits *cont)
|
||||||
: slist_it_ (ptr), cont_ (cont ? pointer_traits<const_cont_ptr>::pointer_to(*cont) : const_cont_ptr() )
|
: slist_it_ (ptr), traitsptr_ (cont ? pointer_traits<const_bucketvaltraits_ptr>::pointer_to(*cont) : const_bucketvaltraits_ptr() )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
hashtable_iterator(const hashtable_iterator<Container, false> &other)
|
hashtable_iterator(const hashtable_iterator<BucketValueTraits, false> &other)
|
||||||
: slist_it_(other.slist_it()), cont_(other.get_container())
|
: slist_it_(other.slist_it()), traitsptr_(other.get_bucket_value_traits())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
const siterator &slist_it() const
|
const siterator &slist_it() const
|
||||||
{ return slist_it_; }
|
{ return slist_it_; }
|
||||||
|
|
||||||
hashtable_iterator<Container, false> unconst() const
|
hashtable_iterator<BucketValueTraits, false> unconst() const
|
||||||
{ return hashtable_iterator<Container, false>(this->slist_it(), this->get_container()); }
|
{ return hashtable_iterator<BucketValueTraits, false>(this->slist_it(), this->get_bucket_value_traits()); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
hashtable_iterator& operator++()
|
hashtable_iterator& operator++()
|
||||||
@ -201,48 +250,57 @@ class hashtable_iterator
|
|||||||
|
|
||||||
pointer operator->() const
|
pointer operator->() const
|
||||||
{
|
{
|
||||||
return boost::intrusive::detail::to_raw_pointer(this->get_real_value_traits()->to_value_ptr
|
return boost::intrusive::detail::to_raw_pointer(this->priv_real_value_traits().to_value_ptr
|
||||||
(downcast_bucket(slist_it_.pointed_node())));
|
(downcast_bucket(slist_it_.pointed_node())));
|
||||||
}
|
}
|
||||||
|
|
||||||
const const_cont_ptr &get_container() const
|
const const_bucketvaltraits_ptr &get_bucket_value_traits() const
|
||||||
{ return cont_; }
|
{ return traitsptr_; }
|
||||||
|
|
||||||
const real_value_traits *get_real_value_traits() const
|
const real_value_traits &priv_real_value_traits() const
|
||||||
{ return &this->get_container()->get_real_value_traits(); }
|
{ return traitsptr_->priv_real_value_traits(); }
|
||||||
|
|
||||||
|
const real_bucket_traits &priv_real_bucket_traits() const
|
||||||
|
{ return traitsptr_->priv_real_bucket_traits(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void increment()
|
void increment()
|
||||||
{
|
{
|
||||||
const Container *cont = boost::intrusive::detail::to_raw_pointer(cont_);
|
const real_bucket_traits &rbuck_traits = this->priv_real_bucket_traits();
|
||||||
bucket_type* buckets = boost::intrusive::detail::to_raw_pointer(cont->bucket_pointer());
|
bucket_type* const buckets = boost::intrusive::detail::to_raw_pointer(rbuck_traits.bucket_begin());
|
||||||
size_type buckets_len = cont->bucket_count();
|
const size_type buckets_len = rbuck_traits.bucket_count();
|
||||||
|
|
||||||
++slist_it_;
|
++slist_it_;
|
||||||
if(buckets[0].cend().pointed_node() <= slist_it_.pointed_node() &&
|
const typename slist_impl::node_ptr n = slist_it_.pointed_node();
|
||||||
slist_it_.pointed_node()<= buckets[buckets_len].cend().pointed_node() ){
|
const siterator first_bucket_bbegin = buckets->end();
|
||||||
//Now get the bucket_impl from the iterator
|
if(first_bucket_bbegin.pointed_node() <= n && n <= buckets[buckets_len-1].cend().pointed_node()){
|
||||||
|
//If one-past the node is inside the bucket then look for the next non-empty bucket
|
||||||
|
//1. get the bucket_impl from the iterator
|
||||||
const bucket_type &b = static_cast<const bucket_type&>
|
const bucket_type &b = static_cast<const bucket_type&>
|
||||||
(bucket_type::slist_type::container_from_end_iterator(slist_it_));
|
(bucket_type::slist_type::container_from_end_iterator(slist_it_));
|
||||||
|
|
||||||
//Now just calculate the index b has in the bucket array
|
//2. Now just calculate the index b has in the bucket array
|
||||||
size_type n_bucket = static_cast<size_type>(&b - &buckets[0]);
|
size_type n_bucket = static_cast<size_type>(&b - buckets);
|
||||||
|
|
||||||
|
//3. Iterate until a non-empty bucket is found
|
||||||
do{
|
do{
|
||||||
if (++n_bucket == buckets_len){
|
if (++n_bucket >= buckets_len){ //bucket overflow, return end() iterator
|
||||||
slist_it_ = (&buckets[0] + buckets_len)->end();
|
slist_it_ = buckets->before_begin();
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
slist_it_ = buckets[n_bucket].begin();
|
|
||||||
}
|
}
|
||||||
while (slist_it_ == buckets[n_bucket].end());
|
while (buckets[n_bucket].empty());
|
||||||
|
slist_it_ = buckets[n_bucket].begin();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
//++slist_it_ yield to a valid object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
siterator slist_it_;
|
siterator slist_it_;
|
||||||
const_cont_ptr cont_;
|
const_bucketvaltraits_ptr traitsptr_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace detail {
|
|
||||||
} //namespace intrusive {
|
} //namespace intrusive {
|
||||||
} //namespace boost {
|
} //namespace boost {
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2009-2012.
|
// (C) Copyright Ion Gaztanaga 2009-2013.
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -65,41 +65,41 @@ struct list_node_traits
|
|||||||
|
|
||||||
// list_iterator provides some basic functions for a
|
// list_iterator provides some basic functions for a
|
||||||
// node oriented bidirectional iterator:
|
// node oriented bidirectional iterator:
|
||||||
template<class Container, bool IsConst>
|
template<class RealValueTraits, bool IsConst>
|
||||||
class list_iterator
|
class list_iterator
|
||||||
: public std::iterator
|
: public iiterator<RealValueTraits, IsConst, std::bidirectional_iterator_tag>::iterator_base
|
||||||
< std::bidirectional_iterator_tag
|
|
||||||
, typename Container::value_type
|
|
||||||
, typename Container::difference_type
|
|
||||||
, typename detail::if_c<IsConst,typename Container::const_pointer,typename Container::pointer>::type
|
|
||||||
, typename detail::if_c<IsConst,typename Container::const_reference,typename Container::reference>::type
|
|
||||||
>
|
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
typedef typename Container::real_value_traits real_value_traits;
|
typedef iiterator
|
||||||
typedef typename real_value_traits::node_traits node_traits;
|
<RealValueTraits, IsConst, std::bidirectional_iterator_tag> types_t;
|
||||||
typedef typename node_traits::node node;
|
|
||||||
typedef typename node_traits::node_ptr node_ptr;
|
static const bool stateful_value_traits = types_t::stateful_value_traits;
|
||||||
typedef typename pointer_traits<node_ptr>::
|
|
||||||
template rebind_pointer<void>::type void_pointer;
|
typedef RealValueTraits real_value_traits;
|
||||||
static const bool store_container_ptr =
|
typedef typename types_t::node_traits node_traits;
|
||||||
detail::store_cont_ptr_on_it<Container>::value;
|
|
||||||
|
typedef typename types_t::node node;
|
||||||
|
typedef typename types_t::node_ptr node_ptr;
|
||||||
|
typedef typename types_t::void_pointer void_pointer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename Container::value_type value_type;
|
typedef typename types_t::value_type value_type;
|
||||||
typedef typename detail::if_c<IsConst,typename Container::const_pointer,typename Container::pointer>::type pointer;
|
typedef typename types_t::pointer pointer;
|
||||||
typedef typename detail::if_c<IsConst,typename Container::const_reference,typename Container::reference>::type reference;
|
typedef typename types_t::reference reference;
|
||||||
|
|
||||||
|
typedef typename pointer_traits
|
||||||
|
<void_pointer>::template rebind_pointer
|
||||||
|
<const real_value_traits>::type const_real_value_traits_ptr;
|
||||||
|
|
||||||
list_iterator()
|
list_iterator()
|
||||||
: members_ (node_ptr(), 0)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
explicit list_iterator(const node_ptr & node, const Container *cont_ptr)
|
explicit list_iterator(const node_ptr & nodeptr, const const_real_value_traits_ptr &traits_ptr)
|
||||||
: members_ (node, cont_ptr)
|
: members_(nodeptr, traits_ptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
list_iterator(list_iterator<Container, false> const& other)
|
list_iterator(list_iterator<RealValueTraits, false> const& other)
|
||||||
: members_(other.pointed_node(), other.get_container())
|
: members_(other.pointed_node(), other.get_real_value_traits())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
const node_ptr &pointed_node() const
|
const node_ptr &pointed_node() const
|
||||||
@ -108,12 +108,14 @@ class list_iterator
|
|||||||
list_iterator &operator=(const node_ptr &node)
|
list_iterator &operator=(const node_ptr &node)
|
||||||
{ members_.nodeptr_ = node; return static_cast<list_iterator&>(*this); }
|
{ members_.nodeptr_ = node; return static_cast<list_iterator&>(*this); }
|
||||||
|
|
||||||
|
const_real_value_traits_ptr get_real_value_traits() const
|
||||||
|
{ return pointer_traits<const_real_value_traits_ptr>::static_cast_from(members_.get_ptr()); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
list_iterator& operator++()
|
list_iterator& operator++()
|
||||||
{
|
{
|
||||||
node_ptr p = node_traits::get_next(members_.nodeptr_);
|
node_ptr p = node_traits::get_next(members_.nodeptr_);
|
||||||
members_.nodeptr_ = p;
|
members_.nodeptr_ = p;
|
||||||
//members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
|
|
||||||
return static_cast<list_iterator&> (*this);
|
return static_cast<list_iterator&> (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,43 +151,11 @@ class list_iterator
|
|||||||
pointer operator->() const
|
pointer operator->() const
|
||||||
{ return this->get_real_value_traits()->to_value_ptr(members_.nodeptr_); }
|
{ return this->get_real_value_traits()->to_value_ptr(members_.nodeptr_); }
|
||||||
|
|
||||||
const Container *get_container() const
|
list_iterator<RealValueTraits, false> unconst() const
|
||||||
{
|
{ return list_iterator<RealValueTraits, false>(this->pointed_node(), this->get_real_value_traits()); }
|
||||||
if(store_container_ptr){
|
|
||||||
const Container* c = static_cast<const Container*>(members_.get_ptr());
|
|
||||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(c != 0);
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const real_value_traits *get_real_value_traits() const
|
|
||||||
{
|
|
||||||
if(store_container_ptr)
|
|
||||||
return &this->get_container()->get_real_value_traits();
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
list_iterator<Container, false> unconst() const
|
|
||||||
{ return list_iterator<Container, false>(this->pointed_node(), this->get_container()); }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct members
|
iiterator_members<node_ptr, stateful_value_traits> members_;
|
||||||
: public detail::select_constptr
|
|
||||||
<void_pointer, store_container_ptr>::type
|
|
||||||
{
|
|
||||||
typedef typename detail::select_constptr
|
|
||||||
<void_pointer, store_container_ptr>::type Base;
|
|
||||||
|
|
||||||
members(const node_ptr &n_ptr, const void *cont)
|
|
||||||
: Base(cont), nodeptr_(n_ptr)
|
|
||||||
{}
|
|
||||||
|
|
||||||
node_ptr nodeptr_;
|
|
||||||
} members_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
|
// (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost
|
||||||
// Software License, Version 1.0. (See accompanying file
|
// Software License, Version 1.0. (See accompanying file
|
||||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -30,18 +30,38 @@ inline std::ptrdiff_t offset_from_pointer_to_member(const Member Parent::* ptr_t
|
|||||||
{
|
{
|
||||||
//The implementation of a pointer to member is compiler dependent.
|
//The implementation of a pointer to member is compiler dependent.
|
||||||
#if defined(BOOST_INTRUSIVE_MSVC_ABI_PTR_TO_MEMBER)
|
#if defined(BOOST_INTRUSIVE_MSVC_ABI_PTR_TO_MEMBER)
|
||||||
//msvc compliant compilers use their the first 32 bits as offset (even in 64 bit mode)
|
|
||||||
|
//MSVC compliant compilers use their the first 32 bits as offset (even in 64 bit mode)
|
||||||
union caster_union
|
union caster_union
|
||||||
{
|
{
|
||||||
const Member Parent::* ptr_to_member;
|
const Member Parent::* ptr_to_member;
|
||||||
boost::int32_t offset;
|
boost::int32_t offset;
|
||||||
} caster;
|
} caster;
|
||||||
caster.ptr_to_member = ptr_to_member;
|
|
||||||
//MSVC ABI can use up to 3 int32 to represent pointer to member data
|
//MSVC ABI can use up to 3 int32 to represent pointer to member data
|
||||||
//with virtual base classes, in those cases there is no simple to
|
//with virtual base classes, in those cases there is no simple to
|
||||||
//obtain the address of parent. So static assert to avoid runtime errors
|
//obtain the address of the parent. So static assert to avoid runtime errors
|
||||||
BOOST_STATIC_ASSERT( sizeof(caster) == sizeof(boost::int32_t) );
|
BOOST_STATIC_ASSERT( sizeof(caster) == sizeof(boost::int32_t) );
|
||||||
|
|
||||||
|
caster.ptr_to_member = ptr_to_member;
|
||||||
return std::ptrdiff_t(caster.offset);
|
return std::ptrdiff_t(caster.offset);
|
||||||
|
//Additional info on MSVC behaviour for the future. For 2/3 int ptr-to-member
|
||||||
|
//types dereference seems to be:
|
||||||
|
//
|
||||||
|
// vboffset = [compile_time_offset if 2-int ptr2memb] /
|
||||||
|
// [ptr2memb.i32[2] if 3-int ptr2memb].
|
||||||
|
// vbtable = *(this + vboffset);
|
||||||
|
// adj = vbtable[ptr2memb.i32[1]];
|
||||||
|
// var = adj + (this + vboffset) + ptr2memb.i32[0];
|
||||||
|
//
|
||||||
|
//To reverse the operation we need to
|
||||||
|
// - obtain vboffset (in 2-int ptr2memb implementation only)
|
||||||
|
// - Go to Parent's vbtable and obtain adjustment at index ptr2memb.i32[1]
|
||||||
|
// - parent = member - adj - vboffset - ptr2memb.i32[0]
|
||||||
|
//
|
||||||
|
//Even accessing to RTTI we might not be able to obtain this information
|
||||||
|
//so anyone who thinks it's possible, please send a patch.
|
||||||
|
|
||||||
//This works with gcc, msvc, ac++, ibmcpp
|
//This works with gcc, msvc, ac++, ibmcpp
|
||||||
#elif defined(__GNUC__) || defined(__HP_aCC) || defined(BOOST_INTEL) || \
|
#elif defined(__GNUC__) || defined(__HP_aCC) || defined(BOOST_INTEL) || \
|
||||||
defined(__IBMCPP__) || defined(__DECCXX)
|
defined(__IBMCPP__) || defined(__DECCXX)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost
|
// (C) Copyright Ion Gaztanaga 2008-2013. Distributed under the Boost
|
||||||
// Software License, Version 1.0. (See accompanying file
|
// Software License, Version 1.0. (See accompanying file
|
||||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012.
|
// (C) Copyright Ion Gaztanaga 2006-2013.
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -20,6 +20,8 @@
|
|||||||
#include <boost/intrusive/rbtree_algorithms.hpp>
|
#include <boost/intrusive/rbtree_algorithms.hpp>
|
||||||
#include <boost/intrusive/pointer_plus_bits.hpp>
|
#include <boost/intrusive/pointer_plus_bits.hpp>
|
||||||
#include <boost/intrusive/detail/mpl.hpp>
|
#include <boost/intrusive/detail/mpl.hpp>
|
||||||
|
#include <boost/intrusive/detail/utilities.hpp>
|
||||||
|
#include <boost/intrusive/detail/tree_node.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace intrusive {
|
namespace intrusive {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -15,7 +15,7 @@
|
|||||||
#define BOOST_INTRUSIVE_SLIST_NODE_HPP
|
#define BOOST_INTRUSIVE_SLIST_NODE_HPP
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_begin.hpp>
|
#include <boost/intrusive/detail/config_begin.hpp>
|
||||||
#include <iterator>
|
#include <boost/intrusive/detail/utilities.hpp>
|
||||||
#include <boost/intrusive/detail/assert.hpp>
|
#include <boost/intrusive/detail/assert.hpp>
|
||||||
#include <boost/intrusive/pointer_traits.hpp>
|
#include <boost/intrusive/pointer_traits.hpp>
|
||||||
|
|
||||||
@ -54,41 +54,41 @@ struct slist_node_traits
|
|||||||
|
|
||||||
// slist_iterator provides some basic functions for a
|
// slist_iterator provides some basic functions for a
|
||||||
// node oriented bidirectional iterator:
|
// node oriented bidirectional iterator:
|
||||||
template<class Container, bool IsConst>
|
template<class RealValueTraits, bool IsConst>
|
||||||
class slist_iterator
|
class slist_iterator
|
||||||
: public std::iterator
|
: public iiterator<RealValueTraits, IsConst, std::forward_iterator_tag>::iterator_base
|
||||||
< std::forward_iterator_tag
|
|
||||||
, typename Container::value_type
|
|
||||||
, typename Container::difference_type
|
|
||||||
, typename detail::if_c<IsConst,typename Container::const_pointer,typename Container::pointer>::type
|
|
||||||
, typename detail::if_c<IsConst,typename Container::const_reference,typename Container::reference>::type
|
|
||||||
>
|
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
typedef typename Container::real_value_traits real_value_traits;
|
typedef iiterator
|
||||||
typedef typename real_value_traits::node_traits node_traits;
|
<RealValueTraits, IsConst, std::forward_iterator_tag> types_t;
|
||||||
typedef typename node_traits::node node;
|
|
||||||
typedef typename node_traits::node_ptr node_ptr;
|
static const bool stateful_value_traits = types_t::stateful_value_traits;
|
||||||
typedef typename pointer_traits
|
|
||||||
<node_ptr>::template rebind_pointer <void>::type void_pointer;
|
typedef RealValueTraits real_value_traits;
|
||||||
static const bool store_container_ptr =
|
typedef typename types_t::node_traits node_traits;
|
||||||
detail::store_cont_ptr_on_it<Container>::value;
|
|
||||||
|
typedef typename types_t::node node;
|
||||||
|
typedef typename types_t::node_ptr node_ptr;
|
||||||
|
typedef typename types_t::void_pointer void_pointer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename Container::value_type value_type;
|
typedef typename types_t::value_type value_type;
|
||||||
typedef typename detail::if_c<IsConst,typename Container::const_pointer,typename Container::pointer>::type pointer;
|
typedef typename types_t::pointer pointer;
|
||||||
typedef typename detail::if_c<IsConst,typename Container::const_reference,typename Container::reference>::type reference;
|
typedef typename types_t::reference reference;
|
||||||
|
|
||||||
|
typedef typename pointer_traits
|
||||||
|
<void_pointer>::template rebind_pointer
|
||||||
|
<const real_value_traits>::type const_real_value_traits_ptr;
|
||||||
|
|
||||||
slist_iterator()
|
slist_iterator()
|
||||||
: members_ (node_ptr(), 0)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
explicit slist_iterator(const node_ptr & node, const Container *cont_ptr)
|
explicit slist_iterator(const node_ptr & nodeptr, const const_real_value_traits_ptr &traits_ptr)
|
||||||
: members_ (node, cont_ptr)
|
: members_(nodeptr, traits_ptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
slist_iterator(slist_iterator<Container, false> const& other)
|
slist_iterator(slist_iterator<RealValueTraits, false> const& other)
|
||||||
: members_(other.pointed_node(), other.get_container())
|
: members_(other.pointed_node(), other.get_real_value_traits())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
const node_ptr &pointed_node() const
|
const node_ptr &pointed_node() const
|
||||||
@ -97,6 +97,9 @@ class slist_iterator
|
|||||||
slist_iterator &operator=(const node_ptr &node)
|
slist_iterator &operator=(const node_ptr &node)
|
||||||
{ members_.nodeptr_ = node; return static_cast<slist_iterator&>(*this); }
|
{ members_.nodeptr_ = node; return static_cast<slist_iterator&>(*this); }
|
||||||
|
|
||||||
|
const_real_value_traits_ptr get_real_value_traits() const
|
||||||
|
{ return pointer_traits<const_real_value_traits_ptr>::static_cast_from(members_.get_ptr()); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
slist_iterator& operator++()
|
slist_iterator& operator++()
|
||||||
{
|
{
|
||||||
@ -123,39 +126,12 @@ class slist_iterator
|
|||||||
pointer operator->() const
|
pointer operator->() const
|
||||||
{ return this->get_real_value_traits()->to_value_ptr(members_.nodeptr_); }
|
{ return this->get_real_value_traits()->to_value_ptr(members_.nodeptr_); }
|
||||||
|
|
||||||
const Container *get_container() const
|
slist_iterator<RealValueTraits, false> unconst() const
|
||||||
{
|
{ return slist_iterator<RealValueTraits, false>(this->pointed_node(), this->get_real_value_traits()); }
|
||||||
if(store_container_ptr)
|
|
||||||
return static_cast<const Container*>(members_.get_ptr());
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
slist_iterator<Container, false> unconst() const
|
|
||||||
{ return slist_iterator<Container, false>(this->pointed_node(), this->get_container()); }
|
|
||||||
|
|
||||||
const real_value_traits *get_real_value_traits() const
|
|
||||||
{
|
|
||||||
if(store_container_ptr)
|
|
||||||
return &this->get_container()->get_real_value_traits();
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct members
|
|
||||||
: public detail::select_constptr
|
|
||||||
<void_pointer, store_container_ptr>::type
|
|
||||||
{
|
|
||||||
typedef typename detail::select_constptr
|
|
||||||
<void_pointer, store_container_ptr>::type Base;
|
|
||||||
|
|
||||||
members(const node_ptr &n_ptr, const void *cont)
|
iiterator_members<node_ptr, stateful_value_traits> members_;
|
||||||
: Base(cont), nodeptr_(n_ptr)
|
|
||||||
{}
|
|
||||||
|
|
||||||
node_ptr nodeptr_;
|
|
||||||
} members_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -15,8 +15,11 @@
|
|||||||
|
|
||||||
#include <boost/intrusive/detail/config_begin.hpp>
|
#include <boost/intrusive/detail/config_begin.hpp>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
#include <boost/intrusive/detail/utilities.hpp>
|
||||||
|
#include <boost/intrusive/options.hpp>
|
||||||
#include <boost/intrusive/pointer_traits.hpp>
|
#include <boost/intrusive/pointer_traits.hpp>
|
||||||
#include <boost/intrusive/detail/mpl.hpp>
|
#include <boost/intrusive/detail/mpl.hpp>
|
||||||
|
#include <boost/intrusive/bstree_algorithms.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace intrusive {
|
namespace intrusive {
|
||||||
@ -77,43 +80,42 @@ struct tree_node_traits
|
|||||||
|
|
||||||
// tree_iterator provides some basic functions for a
|
// tree_iterator provides some basic functions for a
|
||||||
// node oriented bidirectional iterator:
|
// node oriented bidirectional iterator:
|
||||||
template<class Container, bool IsConst>
|
template<class RealValueTraits, bool IsConst>
|
||||||
class tree_iterator
|
class tree_iterator
|
||||||
: public std::iterator
|
: public iiterator<RealValueTraits, IsConst, std::bidirectional_iterator_tag>::iterator_base
|
||||||
< std::bidirectional_iterator_tag
|
|
||||||
, typename Container::value_type
|
|
||||||
, typename Container::difference_type
|
|
||||||
, typename detail::if_c<IsConst,typename Container::const_pointer,typename Container::pointer>::type
|
|
||||||
, typename detail::if_c<IsConst,typename Container::const_reference,typename Container::reference>::type
|
|
||||||
>
|
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
typedef typename Container::real_value_traits real_value_traits;
|
typedef iiterator< RealValueTraits, IsConst
|
||||||
typedef typename Container::node_algorithms node_algorithms;
|
, std::bidirectional_iterator_tag> types_t;
|
||||||
typedef typename real_value_traits::node_traits node_traits;
|
|
||||||
typedef typename node_traits::node node;
|
typedef RealValueTraits real_value_traits;
|
||||||
typedef typename node_traits::node_ptr node_ptr;
|
typedef typename types_t::node_traits node_traits;
|
||||||
typedef typename pointer_traits<node_ptr>::template
|
|
||||||
rebind_pointer<void>::type void_pointer;
|
typedef typename types_t::node node;
|
||||||
static const bool store_container_ptr =
|
typedef typename types_t::node_ptr node_ptr;
|
||||||
detail::store_cont_ptr_on_it<Container>::value;
|
typedef typename types_t::void_pointer void_pointer;
|
||||||
|
static const bool stateful_value_traits = types_t::stateful_value_traits;
|
||||||
|
|
||||||
|
typedef typename pointer_traits
|
||||||
|
<void_pointer>::template rebind_pointer
|
||||||
|
<const real_value_traits>::type const_real_value_traits_ptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename Container::value_type value_type;
|
typedef typename types_t::value_type value_type;
|
||||||
typedef typename detail::if_c<IsConst,typename Container::const_pointer,typename Container::pointer>::type pointer;
|
typedef typename types_t::pointer pointer;
|
||||||
typedef typename detail::if_c<IsConst,typename Container::const_reference,typename Container::reference>::type reference;
|
typedef typename types_t::reference reference;
|
||||||
|
|
||||||
|
typedef bstree_algorithms<node_traits> node_algorithms;
|
||||||
|
|
||||||
tree_iterator()
|
tree_iterator()
|
||||||
: members_ (node_ptr(), (const void *)0)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
explicit tree_iterator(const node_ptr & nodeptr, const Container *cont_ptr)
|
explicit tree_iterator(const node_ptr & nodeptr, const const_real_value_traits_ptr &traits_ptr)
|
||||||
: members_ (nodeptr, cont_ptr)
|
: members_(nodeptr, traits_ptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
tree_iterator(tree_iterator<Container, false> const& other)
|
tree_iterator(tree_iterator<real_value_traits, false> const& other)
|
||||||
: members_(other.pointed_node(), other.get_container())
|
: members_(other.pointed_node(), other.get_real_value_traits())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
const node_ptr &pointed_node() const
|
const node_ptr &pointed_node() const
|
||||||
@ -161,34 +163,21 @@ class tree_iterator
|
|||||||
pointer operator->() const
|
pointer operator->() const
|
||||||
{ return this->get_real_value_traits()->to_value_ptr(members_.nodeptr_); }
|
{ return this->get_real_value_traits()->to_value_ptr(members_.nodeptr_); }
|
||||||
|
|
||||||
const Container *get_container() const
|
const_real_value_traits_ptr get_real_value_traits() const
|
||||||
{ return static_cast<const Container*>(members_.get_ptr()); }
|
{
|
||||||
|
return pointer_traits<const_real_value_traits_ptr>::static_cast_from(members_.get_ptr());
|
||||||
const real_value_traits *get_real_value_traits() const
|
}
|
||||||
{ return &this->get_container()->get_real_value_traits(); }
|
|
||||||
|
|
||||||
tree_iterator end_iterator_from_it() const
|
tree_iterator end_iterator_from_it() const
|
||||||
{
|
{
|
||||||
return tree_iterator(node_algorithms::get_header(this->pointed_node()), this->get_container());
|
return tree_iterator(node_algorithms::get_header(this->pointed_node()), this->get_real_value_traits());
|
||||||
}
|
}
|
||||||
|
|
||||||
tree_iterator<Container, false> unconst() const
|
tree_iterator<real_value_traits, false> unconst() const
|
||||||
{ return tree_iterator<Container, false>(this->pointed_node(), this->get_container()); }
|
{ return tree_iterator<real_value_traits, false>(this->pointed_node(), this->get_real_value_traits()); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct members
|
iiterator_members<node_ptr, stateful_value_traits> members_;
|
||||||
: public detail::select_constptr
|
|
||||||
<void_pointer, store_container_ptr>::type
|
|
||||||
{
|
|
||||||
typedef typename detail::select_constptr
|
|
||||||
<void_pointer, store_container_ptr>::type Base;
|
|
||||||
|
|
||||||
members(const node_ptr &n_ptr, const void *cont)
|
|
||||||
: Base(cont), nodeptr_(n_ptr)
|
|
||||||
{}
|
|
||||||
|
|
||||||
node_ptr nodeptr_;
|
|
||||||
} members_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -29,9 +29,36 @@
|
|||||||
#include <boost/cstdint.hpp>
|
#include <boost/cstdint.hpp>
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
#include <boost/detail/no_exceptions_support.hpp>
|
#include <boost/detail/no_exceptions_support.hpp>
|
||||||
|
#include <functional>
|
||||||
|
#include <boost/functional/hash.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace intrusive {
|
namespace intrusive {
|
||||||
|
|
||||||
|
enum algo_types
|
||||||
|
{
|
||||||
|
CircularListAlgorithms,
|
||||||
|
CircularSListAlgorithms,
|
||||||
|
LinearSListAlgorithms,
|
||||||
|
BsTreeAlgorithms,
|
||||||
|
RbTreeAlgorithms,
|
||||||
|
AvlTreeAlgorithms,
|
||||||
|
SgTreeAlgorithms,
|
||||||
|
SplayTreeAlgorithms,
|
||||||
|
TreapAlgorithms
|
||||||
|
};
|
||||||
|
|
||||||
|
template<algo_types AlgoType, class NodeTraits>
|
||||||
|
struct get_algo;
|
||||||
|
|
||||||
|
template <link_mode_type link_mode>
|
||||||
|
struct is_safe_autounlink
|
||||||
|
{
|
||||||
|
static const bool value =
|
||||||
|
(int)link_mode == (int)auto_unlink ||
|
||||||
|
(int)link_mode == (int)safe_link;
|
||||||
|
};
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@ -60,17 +87,12 @@ struct TRAITS_PREFIX##_bool_is_true\
|
|||||||
};\
|
};\
|
||||||
//
|
//
|
||||||
|
|
||||||
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(internal_base_hook, boost_intrusive_tags::is_base_hook)
|
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(internal_base_hook, hooktags::is_base_hook)
|
||||||
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(internal_any_hook, is_any_hook)
|
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(internal_any_hook, is_any_hook)
|
||||||
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(external_value_traits, external_value_traits)
|
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(external_value_traits, external_value_traits)
|
||||||
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(external_bucket_traits, external_bucket_traits)
|
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(external_bucket_traits, external_bucket_traits)
|
||||||
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(resizable, resizable)
|
BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(resizable, resizable)
|
||||||
|
|
||||||
template<class Node, class Tag, link_mode_type LinkMode, int>
|
|
||||||
struct node_holder
|
|
||||||
: public Node
|
|
||||||
{};
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T* to_raw_pointer(T* p)
|
inline T* to_raw_pointer(T* p)
|
||||||
{ return p; }
|
{ return p; }
|
||||||
@ -114,7 +136,7 @@ class init_disposer
|
|||||||
{ NodeAlgorithms::init(p); }
|
{ NodeAlgorithms::init(p); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<bool ConstantSize, class SizeType>
|
template<bool ConstantSize, class SizeType, class Tag = void>
|
||||||
struct size_holder
|
struct size_holder
|
||||||
{
|
{
|
||||||
static const bool constant_time_size = ConstantSize;
|
static const bool constant_time_size = ConstantSize;
|
||||||
@ -166,17 +188,17 @@ struct size_holder<false, SizeType>
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class KeyValueCompare, class Container>
|
template<class KeyValueCompare, class RealValueTraits>
|
||||||
struct key_nodeptr_comp
|
struct key_nodeptr_comp
|
||||||
: private detail::ebo_functor_holder<KeyValueCompare>
|
: private detail::ebo_functor_holder<KeyValueCompare>
|
||||||
{
|
{
|
||||||
typedef typename Container::real_value_traits real_value_traits;
|
typedef RealValueTraits real_value_traits;
|
||||||
typedef typename Container::value_type value_type;
|
typedef typename real_value_traits::value_type value_type;
|
||||||
typedef typename real_value_traits::node_ptr node_ptr;
|
typedef typename real_value_traits::node_ptr node_ptr;
|
||||||
typedef typename real_value_traits::const_node_ptr const_node_ptr;
|
typedef typename real_value_traits::const_node_ptr const_node_ptr;
|
||||||
typedef detail::ebo_functor_holder<KeyValueCompare> base_t;
|
typedef detail::ebo_functor_holder<KeyValueCompare> base_t;
|
||||||
key_nodeptr_comp(KeyValueCompare kcomp, const Container *cont)
|
key_nodeptr_comp(KeyValueCompare kcomp, const RealValueTraits *traits)
|
||||||
: base_t(kcomp), cont_(cont)
|
: base_t(kcomp), traits_(traits)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -188,7 +210,7 @@ struct key_nodeptr_comp
|
|||||||
template<class T>
|
template<class T>
|
||||||
const value_type & key_forward
|
const value_type & key_forward
|
||||||
(const T &node, typename enable_if_c<is_node_ptr<T>::value>::type * = 0) const
|
(const T &node, typename enable_if_c<is_node_ptr<T>::value>::type * = 0) const
|
||||||
{ return *cont_->get_real_value_traits().to_value_ptr(node); }
|
{ return *traits_->to_value_ptr(node); }
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
const T & key_forward(const T &key, typename enable_if_c<!is_node_ptr<T>::value>::type* = 0) const
|
const T & key_forward(const T &key, typename enable_if_c<!is_node_ptr<T>::value>::type* = 0) const
|
||||||
@ -199,27 +221,28 @@ struct key_nodeptr_comp
|
|||||||
bool operator()(const KeyType &key1, const KeyType2 &key2) const
|
bool operator()(const KeyType &key1, const KeyType2 &key2) const
|
||||||
{ return base_t::get()(this->key_forward(key1), this->key_forward(key2)); }
|
{ return base_t::get()(this->key_forward(key1), this->key_forward(key2)); }
|
||||||
|
|
||||||
const Container *cont_;
|
const RealValueTraits *traits_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class F, class Container>
|
template<class F, class RealValueTraits, algo_types AlgoType>
|
||||||
struct node_cloner
|
struct node_cloner
|
||||||
: private detail::ebo_functor_holder<F>
|
: private detail::ebo_functor_holder<F>
|
||||||
{
|
{
|
||||||
typedef typename Container::real_value_traits real_value_traits;
|
typedef RealValueTraits real_value_traits;
|
||||||
typedef typename Container::node_algorithms node_algorithms;
|
typedef typename real_value_traits::node_traits node_traits;
|
||||||
typedef typename real_value_traits::value_type value_type;
|
typedef typename node_traits::node_ptr node_ptr;
|
||||||
typedef typename real_value_traits::pointer pointer;
|
typedef detail::ebo_functor_holder<F> base_t;
|
||||||
typedef typename real_value_traits::node_traits::node node;
|
typedef typename get_algo< AlgoType
|
||||||
typedef typename real_value_traits::node_ptr node_ptr;
|
, node_traits>::type node_algorithms;
|
||||||
|
static const bool safemode_or_autounlink =
|
||||||
|
is_safe_autounlink<real_value_traits::link_mode>::value;
|
||||||
|
typedef typename real_value_traits::value_type value_type;
|
||||||
|
typedef typename real_value_traits::pointer pointer;
|
||||||
|
typedef typename node_traits::node node;
|
||||||
typedef typename real_value_traits::const_node_ptr const_node_ptr;
|
typedef typename real_value_traits::const_node_ptr const_node_ptr;
|
||||||
typedef detail::ebo_functor_holder<F> base_t;
|
|
||||||
enum { safemode_or_autounlink =
|
|
||||||
(int)real_value_traits::link_mode == (int)auto_unlink ||
|
|
||||||
(int)real_value_traits::link_mode == (int)safe_link };
|
|
||||||
|
|
||||||
node_cloner(F f, const Container *cont)
|
node_cloner(F f, const RealValueTraits *traits)
|
||||||
: base_t(f), cont_(cont)
|
: base_t(f), traits_(traits)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
node_ptr operator()(const node_ptr & p)
|
node_ptr operator()(const node_ptr & p)
|
||||||
@ -228,50 +251,58 @@ struct node_cloner
|
|||||||
node_ptr operator()(const node &to_clone)
|
node_ptr operator()(const node &to_clone)
|
||||||
{
|
{
|
||||||
const value_type &v =
|
const value_type &v =
|
||||||
*cont_->get_real_value_traits().to_value_ptr
|
*traits_->to_value_ptr
|
||||||
(pointer_traits<const_node_ptr>::pointer_to(to_clone));
|
(pointer_traits<const_node_ptr>::pointer_to(to_clone));
|
||||||
node_ptr n = cont_->get_real_value_traits().to_node_ptr(*base_t::get()(v));
|
node_ptr n = traits_->to_node_ptr(*base_t::get()(v));
|
||||||
//Cloned node must be in default mode if the linking mode requires it
|
//Cloned node must be in default mode if the linking mode requires it
|
||||||
if(safemode_or_autounlink)
|
if(safemode_or_autounlink)
|
||||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n));
|
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n));
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Container *cont_;
|
const RealValueTraits *traits_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class F, class Container>
|
template<class F, class RealValueTraits, algo_types AlgoType>
|
||||||
struct node_disposer
|
struct node_disposer
|
||||||
: private detail::ebo_functor_holder<F>
|
: private detail::ebo_functor_holder<F>
|
||||||
{
|
{
|
||||||
typedef typename Container::real_value_traits real_value_traits;
|
typedef RealValueTraits real_value_traits;
|
||||||
typedef typename real_value_traits::node_ptr node_ptr;
|
typedef typename real_value_traits::node_traits node_traits;
|
||||||
|
typedef typename node_traits::node_ptr node_ptr;
|
||||||
typedef detail::ebo_functor_holder<F> base_t;
|
typedef detail::ebo_functor_holder<F> base_t;
|
||||||
typedef typename Container::node_algorithms node_algorithms;
|
typedef typename get_algo< AlgoType
|
||||||
enum { safemode_or_autounlink =
|
, node_traits>::type node_algorithms;
|
||||||
(int)real_value_traits::link_mode == (int)auto_unlink ||
|
static const bool safemode_or_autounlink =
|
||||||
(int)real_value_traits::link_mode == (int)safe_link };
|
is_safe_autounlink<real_value_traits::link_mode>::value;
|
||||||
|
|
||||||
node_disposer(F f, const Container *cont)
|
node_disposer(F f, const RealValueTraits *cont)
|
||||||
: base_t(f), cont_(cont)
|
: base_t(f), traits_(cont)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void operator()(const node_ptr & p)
|
void operator()(const node_ptr & p)
|
||||||
{
|
{
|
||||||
if(safemode_or_autounlink)
|
if(safemode_or_autounlink)
|
||||||
node_algorithms::init(p);
|
node_algorithms::init(p);
|
||||||
base_t::get()(cont_->get_real_value_traits().to_value_ptr(p));
|
base_t::get()(traits_->to_value_ptr(p));
|
||||||
}
|
}
|
||||||
const Container *cont_;
|
const RealValueTraits *traits_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class VoidPointer>
|
||||||
struct dummy_constptr
|
struct dummy_constptr
|
||||||
{
|
{
|
||||||
dummy_constptr(const void *)
|
typedef typename boost::intrusive::pointer_traits<VoidPointer>::
|
||||||
|
template rebind_pointer<const void>::type ConstVoidPtr;
|
||||||
|
|
||||||
|
explicit dummy_constptr(ConstVoidPtr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
const void *get_ptr() const
|
dummy_constptr()
|
||||||
{ return 0; }
|
{}
|
||||||
|
|
||||||
|
ConstVoidPtr get_ptr() const
|
||||||
|
{ return ConstVoidPtr(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class VoidPointer>
|
template<class VoidPointer>
|
||||||
@ -280,7 +311,10 @@ struct constptr
|
|||||||
typedef typename boost::intrusive::pointer_traits<VoidPointer>::
|
typedef typename boost::intrusive::pointer_traits<VoidPointer>::
|
||||||
template rebind_pointer<const void>::type ConstVoidPtr;
|
template rebind_pointer<const void>::type ConstVoidPtr;
|
||||||
|
|
||||||
constptr(const void *ptr)
|
constptr()
|
||||||
|
{}
|
||||||
|
|
||||||
|
explicit constptr(const ConstVoidPtr &ptr)
|
||||||
: const_void_ptr_(ptr)
|
: const_void_ptr_(ptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -296,7 +330,7 @@ struct select_constptr
|
|||||||
typedef typename detail::if_c
|
typedef typename detail::if_c
|
||||||
< store_ptr
|
< store_ptr
|
||||||
, constptr<VoidPointer>
|
, constptr<VoidPointer>
|
||||||
, dummy_constptr
|
, dummy_constptr<VoidPointer>
|
||||||
>::type type;
|
>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -330,148 +364,6 @@ template<class Hook>
|
|||||||
void destructor_impl(Hook &, detail::link_dispatch<normal_link>)
|
void destructor_impl(Hook &, detail::link_dispatch<normal_link>)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<class T, class NodeTraits, link_mode_type LinkMode, class Tag, int HookType>
|
|
||||||
struct base_hook_traits
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef detail::node_holder
|
|
||||||
<typename NodeTraits::node, Tag, LinkMode, HookType> node_holder;
|
|
||||||
typedef typename NodeTraits::node node;
|
|
||||||
typedef NodeTraits node_traits;
|
|
||||||
typedef T value_type;
|
|
||||||
typedef typename node_traits::node_ptr node_ptr;
|
|
||||||
typedef typename node_traits::const_node_ptr const_node_ptr;
|
|
||||||
typedef typename pointer_traits<node_ptr>::
|
|
||||||
template rebind_pointer<T>::type pointer;
|
|
||||||
typedef typename pointer_traits<node_ptr>::
|
|
||||||
template rebind_pointer<const T>::type const_pointer;
|
|
||||||
//typedef typename pointer_traits<pointer>::reference reference;
|
|
||||||
//typedef typename pointer_traits<const_pointer>::reference const_reference;
|
|
||||||
typedef T & reference;
|
|
||||||
typedef const T & const_reference;
|
|
||||||
typedef node_holder & node_holder_reference;
|
|
||||||
typedef const node_holder & const_node_holder_reference;
|
|
||||||
typedef node& node_reference;
|
|
||||||
typedef const node & const_node_reference;
|
|
||||||
|
|
||||||
static const link_mode_type link_mode = LinkMode;
|
|
||||||
|
|
||||||
static pointer to_value_ptr(const node_ptr & n)
|
|
||||||
{
|
|
||||||
return pointer_traits<pointer>::pointer_to
|
|
||||||
(static_cast<reference>(static_cast<node_holder_reference>(*n)));
|
|
||||||
}
|
|
||||||
|
|
||||||
static const_pointer to_value_ptr(const const_node_ptr & n)
|
|
||||||
{
|
|
||||||
return pointer_traits<const_pointer>::pointer_to
|
|
||||||
(static_cast<const_reference>(static_cast<const_node_holder_reference>(*n)));
|
|
||||||
}
|
|
||||||
|
|
||||||
static node_ptr to_node_ptr(reference value)
|
|
||||||
{
|
|
||||||
return pointer_traits<node_ptr>::pointer_to
|
|
||||||
(static_cast<node_reference>(static_cast<node_holder_reference>(value)));
|
|
||||||
}
|
|
||||||
|
|
||||||
static const_node_ptr to_node_ptr(const_reference value)
|
|
||||||
{
|
|
||||||
return pointer_traits<const_node_ptr>::pointer_to
|
|
||||||
(static_cast<const_node_reference>(static_cast<const_node_holder_reference>(value)));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class T, class Hook, Hook T::* P>
|
|
||||||
struct member_hook_traits
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef Hook hook_type;
|
|
||||||
typedef typename hook_type::boost_intrusive_tags::node_traits node_traits;
|
|
||||||
typedef typename node_traits::node node;
|
|
||||||
typedef T value_type;
|
|
||||||
typedef typename node_traits::node_ptr node_ptr;
|
|
||||||
typedef typename node_traits::const_node_ptr const_node_ptr;
|
|
||||||
typedef typename pointer_traits<node_ptr>::
|
|
||||||
template rebind_pointer<T>::type pointer;
|
|
||||||
typedef typename pointer_traits<node_ptr>::
|
|
||||||
template rebind_pointer<const T>::type const_pointer;
|
|
||||||
typedef T & reference;
|
|
||||||
typedef const T & const_reference;
|
|
||||||
typedef node& node_reference;
|
|
||||||
typedef const node & const_node_reference;
|
|
||||||
typedef hook_type& hook_reference;
|
|
||||||
typedef const hook_type & const_hook_reference;
|
|
||||||
|
|
||||||
static const link_mode_type link_mode = Hook::boost_intrusive_tags::link_mode;
|
|
||||||
|
|
||||||
static node_ptr to_node_ptr(reference value)
|
|
||||||
{
|
|
||||||
return pointer_traits<node_ptr>::pointer_to
|
|
||||||
(static_cast<node_reference>(static_cast<hook_reference>(value.*P)));
|
|
||||||
}
|
|
||||||
|
|
||||||
static const_node_ptr to_node_ptr(const_reference value)
|
|
||||||
{
|
|
||||||
return pointer_traits<const_node_ptr>::pointer_to
|
|
||||||
(static_cast<const_node_reference>(static_cast<const_hook_reference>(value.*P)));
|
|
||||||
}
|
|
||||||
|
|
||||||
static pointer to_value_ptr(const node_ptr & n)
|
|
||||||
{
|
|
||||||
return pointer_traits<pointer>::pointer_to
|
|
||||||
(*detail::parent_from_member<T, Hook>
|
|
||||||
(static_cast<Hook*>(boost::intrusive::detail::to_raw_pointer(n)), P));
|
|
||||||
}
|
|
||||||
|
|
||||||
static const_pointer to_value_ptr(const const_node_ptr & n)
|
|
||||||
{
|
|
||||||
return pointer_traits<const_pointer>::pointer_to
|
|
||||||
(*detail::parent_from_member<T, Hook>
|
|
||||||
(static_cast<const Hook*>(boost::intrusive::detail::to_raw_pointer(n)), P));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class Functor>
|
|
||||||
struct function_hook_traits
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef typename Functor::hook_type hook_type;
|
|
||||||
typedef typename Functor::hook_ptr hook_ptr;
|
|
||||||
typedef typename Functor::const_hook_ptr const_hook_ptr;
|
|
||||||
typedef typename hook_type::boost_intrusive_tags::node_traits node_traits;
|
|
||||||
typedef typename node_traits::node node;
|
|
||||||
typedef typename Functor::value_type value_type;
|
|
||||||
typedef typename node_traits::node_ptr node_ptr;
|
|
||||||
typedef typename node_traits::const_node_ptr const_node_ptr;
|
|
||||||
typedef typename pointer_traits<node_ptr>::
|
|
||||||
template rebind_pointer<value_type>::type pointer;
|
|
||||||
typedef typename pointer_traits<node_ptr>::
|
|
||||||
template rebind_pointer<const value_type>::type const_pointer;
|
|
||||||
typedef value_type & reference;
|
|
||||||
typedef const value_type & const_reference;
|
|
||||||
static const link_mode_type link_mode = hook_type::boost_intrusive_tags::link_mode;
|
|
||||||
|
|
||||||
static node_ptr to_node_ptr(reference value)
|
|
||||||
{ return static_cast<node*>(boost::intrusive::detail::to_raw_pointer(Functor::to_hook_ptr(value))); }
|
|
||||||
|
|
||||||
static const_node_ptr to_node_ptr(const_reference value)
|
|
||||||
{ return static_cast<const node*>(boost::intrusive::detail::to_raw_pointer(Functor::to_hook_ptr(value))); }
|
|
||||||
|
|
||||||
static pointer to_value_ptr(const node_ptr & n)
|
|
||||||
{ return Functor::to_value_ptr(to_hook_ptr(n)); }
|
|
||||||
|
|
||||||
static const_pointer to_value_ptr(const const_node_ptr & n)
|
|
||||||
{ return Functor::to_value_ptr(to_hook_ptr(n)); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
static hook_ptr to_hook_ptr(const node_ptr & n)
|
|
||||||
{ return hook_ptr(&*static_cast<hook_type*>(&*n)); }
|
|
||||||
|
|
||||||
static const_hook_ptr to_hook_ptr(const const_node_ptr & n)
|
|
||||||
{ return const_hook_ptr(&*static_cast<const hook_type*>(&*n)); }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//This function uses binary search to discover the
|
//This function uses binary search to discover the
|
||||||
//highest set bit of the integer
|
//highest set bit of the integer
|
||||||
inline std::size_t floor_log2 (std::size_t x)
|
inline std::size_t floor_log2 (std::size_t x)
|
||||||
@ -492,6 +384,8 @@ inline std::size_t floor_log2 (std::size_t x)
|
|||||||
return log2;
|
return log2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Thanks to Laurent de Soras in
|
||||||
|
//http://www.flipcode.com/archives/Fast_log_Function.shtml
|
||||||
inline float fast_log2 (float val)
|
inline float fast_log2 (float val)
|
||||||
{
|
{
|
||||||
union caster_t
|
union caster_t
|
||||||
@ -502,13 +396,15 @@ inline float fast_log2 (float val)
|
|||||||
|
|
||||||
caster.val = val;
|
caster.val = val;
|
||||||
boost::uint32_t x = caster.x;
|
boost::uint32_t x = caster.x;
|
||||||
const int log_2 = (int)(((x >> 23) & 255) - 128);
|
const int log_2 = int((x >> 23) & 255) - 128;
|
||||||
x &= ~(255 << 23);
|
x &= ~(boost::uint32_t(255u) << 23u);
|
||||||
x += 127 << 23;
|
x += boost::uint32_t(127) << 23u;
|
||||||
caster.x = x;
|
caster.x = x;
|
||||||
val = caster.val;
|
val = caster.val;
|
||||||
|
//1+log2(m), m ranging from 1 to 2
|
||||||
|
//3rd degree polynomial keeping first derivate continuity.
|
||||||
|
//For less precision the line can be commented out
|
||||||
val = ((-1.0f/3.f) * val + 2.f) * val - (2.0f/3.f);
|
val = ((-1.0f/3.f) * val + 2.f) * val - (2.0f/3.f);
|
||||||
|
|
||||||
return (val + log_2);
|
return (val + log_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -605,72 +501,47 @@ class exception_array_disposer
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class ValueTraits, bool ExternalValueTraits>
|
template<class RealValueTraits, bool IsConst>
|
||||||
struct store_cont_ptr_on_it_impl
|
|
||||||
{
|
|
||||||
static const bool value = is_stateful_value_traits<ValueTraits>::value;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class ValueTraits>
|
|
||||||
struct store_cont_ptr_on_it_impl<ValueTraits, true>
|
|
||||||
{
|
|
||||||
static const bool value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class Container>
|
|
||||||
struct store_cont_ptr_on_it
|
|
||||||
{
|
|
||||||
typedef typename Container::value_traits value_traits;
|
|
||||||
static const bool value = store_cont_ptr_on_it_impl
|
|
||||||
<value_traits, external_value_traits_bool_is_true<value_traits>::value>::value;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class Container, bool IsConst>
|
|
||||||
struct node_to_value
|
struct node_to_value
|
||||||
: public detail::select_constptr
|
: public detail::select_constptr
|
||||||
< typename pointer_traits
|
< typename pointer_traits
|
||||||
<typename Container::pointer>::template rebind_pointer<void>::type
|
<typename RealValueTraits::pointer>::template rebind_pointer<void>::type
|
||||||
, detail::store_cont_ptr_on_it<Container>::value
|
, is_stateful_value_traits<RealValueTraits>::value
|
||||||
>::type
|
>::type
|
||||||
{
|
{
|
||||||
static const bool store_container_ptr =
|
static const bool stateful_value_traits = is_stateful_value_traits<RealValueTraits>::value;
|
||||||
detail::store_cont_ptr_on_it<Container>::value;
|
|
||||||
|
|
||||||
typedef typename Container::real_value_traits real_value_traits;
|
|
||||||
typedef typename real_value_traits::value_type value_type;
|
|
||||||
typedef typename detail::select_constptr
|
typedef typename detail::select_constptr
|
||||||
< typename pointer_traits
|
< typename pointer_traits
|
||||||
<typename Container::pointer>::template rebind_pointer<void>::type
|
<typename RealValueTraits::pointer>::
|
||||||
, store_container_ptr >::type Base;
|
template rebind_pointer<void>::type
|
||||||
typedef typename real_value_traits::node_traits::node node;
|
, stateful_value_traits >::type Base;
|
||||||
typedef typename detail::add_const_if_c
|
|
||||||
<value_type, IsConst>::type vtype;
|
|
||||||
typedef typename detail::add_const_if_c
|
|
||||||
<node, IsConst>::type ntype;
|
|
||||||
typedef typename pointer_traits
|
|
||||||
<typename Container::pointer>::template rebind_pointer<ntype>::type npointer;
|
|
||||||
|
|
||||||
node_to_value(const Container *cont)
|
typedef RealValueTraits real_value_traits;
|
||||||
: Base(cont)
|
typedef typename real_value_traits::value_type value_type;
|
||||||
|
typedef typename real_value_traits::node_traits::node node;
|
||||||
|
typedef typename detail::add_const_if_c
|
||||||
|
<value_type, IsConst>::type vtype;
|
||||||
|
typedef typename detail::add_const_if_c
|
||||||
|
<node, IsConst>::type ntype;
|
||||||
|
typedef typename pointer_traits
|
||||||
|
<typename RealValueTraits::pointer>::
|
||||||
|
template rebind_pointer<ntype>::type npointer;
|
||||||
|
typedef typename pointer_traits<npointer>::
|
||||||
|
template rebind_pointer<const RealValueTraits>::type const_real_value_traits_ptr;
|
||||||
|
|
||||||
|
node_to_value(const const_real_value_traits_ptr &ptr)
|
||||||
|
: Base(ptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
typedef vtype & result_type;
|
typedef vtype & result_type;
|
||||||
typedef ntype & first_argument_type;
|
typedef ntype & first_argument_type;
|
||||||
|
|
||||||
const Container *get_container() const
|
const_real_value_traits_ptr get_real_value_traits() const
|
||||||
{
|
{
|
||||||
if(store_container_ptr)
|
if(stateful_value_traits)
|
||||||
return static_cast<const Container*>(Base::get_ptr());
|
return pointer_traits<const_real_value_traits_ptr>::static_cast_from(Base::get_ptr());
|
||||||
else
|
else
|
||||||
return 0;
|
return const_real_value_traits_ptr();
|
||||||
}
|
|
||||||
|
|
||||||
const real_value_traits *get_real_value_traits() const
|
|
||||||
{
|
|
||||||
if(store_container_ptr)
|
|
||||||
return &this->get_container()->get_real_value_traits();
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result_type operator()(first_argument_type arg) const
|
result_type operator()(first_argument_type arg) const
|
||||||
@ -849,7 +720,346 @@ class reverse_iterator
|
|||||||
It m_current; // the wrapped iterator
|
It m_current; // the wrapped iterator
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class ConstNodePtr>
|
||||||
|
struct uncast_types
|
||||||
|
{
|
||||||
|
typedef typename pointer_traits<ConstNodePtr>::element_type element_type;
|
||||||
|
typedef typename remove_const<element_type>::type non_const_type;
|
||||||
|
typedef typename pointer_traits<ConstNodePtr>::
|
||||||
|
template rebind_pointer<non_const_type>::type non_const_pointer;
|
||||||
|
typedef pointer_traits<non_const_pointer> non_const_traits;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class ConstNodePtr>
|
||||||
|
static typename uncast_types<ConstNodePtr>::non_const_pointer
|
||||||
|
uncast(const ConstNodePtr & ptr)
|
||||||
|
{
|
||||||
|
return uncast_types<ConstNodePtr>::non_const_traits::const_cast_from(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
} //namespace detail
|
} //namespace detail
|
||||||
|
|
||||||
|
template<class Node, class Tag, unsigned int>
|
||||||
|
struct node_holder
|
||||||
|
: public Node
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<class T, class NodePtr, class Tag, unsigned int Type>
|
||||||
|
struct bhtraits_base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef NodePtr node_ptr;
|
||||||
|
typedef typename pointer_traits<node_ptr>::element_type node;
|
||||||
|
typedef node_holder<node, Tag, Type> node_holder_type;
|
||||||
|
typedef T value_type;
|
||||||
|
typedef typename pointer_traits<node_ptr>::
|
||||||
|
template rebind_pointer<const node>::type const_node_ptr;
|
||||||
|
typedef typename pointer_traits<node_ptr>::
|
||||||
|
template rebind_pointer<T>::type pointer;
|
||||||
|
typedef typename pointer_traits<node_ptr>::
|
||||||
|
template rebind_pointer<const T>::type const_pointer;
|
||||||
|
//typedef typename pointer_traits<pointer>::reference reference;
|
||||||
|
//typedef typename pointer_traits<const_pointer>::reference const_reference;
|
||||||
|
typedef T & reference;
|
||||||
|
typedef const T & const_reference;
|
||||||
|
typedef node_holder_type & node_holder_reference;
|
||||||
|
typedef const node_holder_type & const_node_holder_reference;
|
||||||
|
typedef node& node_reference;
|
||||||
|
typedef const node & const_node_reference;
|
||||||
|
|
||||||
|
static pointer to_value_ptr(const node_ptr & n)
|
||||||
|
{
|
||||||
|
return pointer_traits<pointer>::pointer_to
|
||||||
|
(static_cast<reference>(static_cast<node_holder_reference>(*n)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static const_pointer to_value_ptr(const const_node_ptr & n)
|
||||||
|
{
|
||||||
|
return pointer_traits<const_pointer>::pointer_to
|
||||||
|
(static_cast<const_reference>(static_cast<const_node_holder_reference>(*n)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static node_ptr to_node_ptr(reference value)
|
||||||
|
{
|
||||||
|
return pointer_traits<node_ptr>::pointer_to
|
||||||
|
(static_cast<node_reference>(static_cast<node_holder_reference>(value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static const_node_ptr to_node_ptr(const_reference value)
|
||||||
|
{
|
||||||
|
return pointer_traits<const_node_ptr>::pointer_to
|
||||||
|
(static_cast<const_node_reference>(static_cast<const_node_holder_reference>(value)));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T, class NodeTraits, link_mode_type LinkMode, class Tag, unsigned int Type>
|
||||||
|
struct bhtraits
|
||||||
|
: public bhtraits_base<T, typename NodeTraits::node_ptr, Tag, Type>
|
||||||
|
{
|
||||||
|
static const link_mode_type link_mode = LinkMode;
|
||||||
|
typedef NodeTraits node_traits;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
template<class T, class NodePtr, typename pointer_traits<NodePtr>::element_type T::* P>
|
||||||
|
struct mhtraits_base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename pointer_traits<NodePtr>::element_type node;
|
||||||
|
typedef T value_type;
|
||||||
|
typedef NodePtr node_ptr;
|
||||||
|
typedef typename pointer_traits<node_ptr>::
|
||||||
|
template rebind_pointer<const node>::type const_node_ptr;
|
||||||
|
typedef typename pointer_traits<node_ptr>::
|
||||||
|
template rebind_pointer<T>::type pointer;
|
||||||
|
typedef typename pointer_traits<node_ptr>::
|
||||||
|
template rebind_pointer<const T>::type const_pointer;
|
||||||
|
typedef T & reference;
|
||||||
|
typedef const T & const_reference;
|
||||||
|
typedef node& node_reference;
|
||||||
|
typedef const node & const_node_reference;
|
||||||
|
|
||||||
|
static node_ptr to_node_ptr(reference value)
|
||||||
|
{
|
||||||
|
return pointer_traits<node_ptr>::pointer_to
|
||||||
|
(static_cast<node_reference>(value.*P));
|
||||||
|
}
|
||||||
|
|
||||||
|
static const_node_ptr to_node_ptr(const_reference value)
|
||||||
|
{
|
||||||
|
return pointer_traits<const_node_ptr>::pointer_to
|
||||||
|
(static_cast<const_node_reference>(value.*P));
|
||||||
|
}
|
||||||
|
|
||||||
|
static pointer to_value_ptr(const node_ptr & n)
|
||||||
|
{
|
||||||
|
return pointer_traits<pointer>::pointer_to
|
||||||
|
(*detail::parent_from_member<T, node>
|
||||||
|
(boost::intrusive::detail::to_raw_pointer(n), P));
|
||||||
|
}
|
||||||
|
|
||||||
|
static const_pointer to_value_ptr(const const_node_ptr & n)
|
||||||
|
{
|
||||||
|
return pointer_traits<const_pointer>::pointer_to
|
||||||
|
(*detail::parent_from_member<T, node>
|
||||||
|
(boost::intrusive::detail::to_raw_pointer(n), P));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, class NodeTraits, typename NodeTraits::node T::* P, link_mode_type LinkMode>
|
||||||
|
struct mhtraits
|
||||||
|
: public mhtraits_base<T, typename NodeTraits::node_ptr, P>
|
||||||
|
{
|
||||||
|
static const link_mode_type link_mode = LinkMode;
|
||||||
|
typedef NodeTraits node_traits;
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, class Hook, Hook T::* P>
|
||||||
|
struct mhtraits
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef Hook hook_type;
|
||||||
|
typedef typename hook_type::hooktags::node_traits node_traits;
|
||||||
|
typedef typename node_traits::node node;
|
||||||
|
typedef T value_type;
|
||||||
|
typedef typename node_traits::node_ptr node_ptr;
|
||||||
|
typedef typename node_traits::const_node_ptr const_node_ptr;
|
||||||
|
typedef typename pointer_traits<node_ptr>::
|
||||||
|
template rebind_pointer<T>::type pointer;
|
||||||
|
typedef typename pointer_traits<node_ptr>::
|
||||||
|
template rebind_pointer<const T>::type const_pointer;
|
||||||
|
typedef T & reference;
|
||||||
|
typedef const T & const_reference;
|
||||||
|
typedef node& node_reference;
|
||||||
|
typedef const node & const_node_reference;
|
||||||
|
typedef hook_type& hook_reference;
|
||||||
|
typedef const hook_type & const_hook_reference;
|
||||||
|
|
||||||
|
static const link_mode_type link_mode = Hook::hooktags::link_mode;
|
||||||
|
|
||||||
|
static node_ptr to_node_ptr(reference value)
|
||||||
|
{
|
||||||
|
return pointer_traits<node_ptr>::pointer_to
|
||||||
|
(static_cast<node_reference>(static_cast<hook_reference>(value.*P)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static const_node_ptr to_node_ptr(const_reference value)
|
||||||
|
{
|
||||||
|
return pointer_traits<const_node_ptr>::pointer_to
|
||||||
|
(static_cast<const_node_reference>(static_cast<const_hook_reference>(value.*P)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static pointer to_value_ptr(const node_ptr & n)
|
||||||
|
{
|
||||||
|
return pointer_traits<pointer>::pointer_to
|
||||||
|
(*detail::parent_from_member<T, Hook>
|
||||||
|
(static_cast<Hook*>(boost::intrusive::detail::to_raw_pointer(n)), P));
|
||||||
|
}
|
||||||
|
|
||||||
|
static const_pointer to_value_ptr(const const_node_ptr & n)
|
||||||
|
{
|
||||||
|
return pointer_traits<const_pointer>::pointer_to
|
||||||
|
(*detail::parent_from_member<T, Hook>
|
||||||
|
(static_cast<const Hook*>(boost::intrusive::detail::to_raw_pointer(n)), P));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<class Functor>
|
||||||
|
struct fhtraits
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Functor::hook_type hook_type;
|
||||||
|
typedef typename Functor::hook_ptr hook_ptr;
|
||||||
|
typedef typename Functor::const_hook_ptr const_hook_ptr;
|
||||||
|
typedef typename hook_type::hooktags::node_traits node_traits;
|
||||||
|
typedef typename node_traits::node node;
|
||||||
|
typedef typename Functor::value_type value_type;
|
||||||
|
typedef typename node_traits::node_ptr node_ptr;
|
||||||
|
typedef typename node_traits::const_node_ptr const_node_ptr;
|
||||||
|
typedef typename pointer_traits<node_ptr>::
|
||||||
|
template rebind_pointer<value_type>::type pointer;
|
||||||
|
typedef typename pointer_traits<node_ptr>::
|
||||||
|
template rebind_pointer<const value_type>::type const_pointer;
|
||||||
|
typedef value_type & reference;
|
||||||
|
typedef const value_type & const_reference;
|
||||||
|
static const link_mode_type link_mode = hook_type::hooktags::link_mode;
|
||||||
|
|
||||||
|
static node_ptr to_node_ptr(reference value)
|
||||||
|
{ return static_cast<node*>(boost::intrusive::detail::to_raw_pointer(Functor::to_hook_ptr(value))); }
|
||||||
|
|
||||||
|
static const_node_ptr to_node_ptr(const_reference value)
|
||||||
|
{ return static_cast<const node*>(boost::intrusive::detail::to_raw_pointer(Functor::to_hook_ptr(value))); }
|
||||||
|
|
||||||
|
static pointer to_value_ptr(const node_ptr & n)
|
||||||
|
{ return Functor::to_value_ptr(to_hook_ptr(n)); }
|
||||||
|
|
||||||
|
static const_pointer to_value_ptr(const const_node_ptr & n)
|
||||||
|
{ return Functor::to_value_ptr(to_hook_ptr(n)); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
static hook_ptr to_hook_ptr(const node_ptr & n)
|
||||||
|
{ return hook_ptr(&*static_cast<hook_type*>(&*n)); }
|
||||||
|
|
||||||
|
static const_hook_ptr to_hook_ptr(const const_node_ptr & n)
|
||||||
|
{ return const_hook_ptr(&*static_cast<const hook_type*>(&*n)); }
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class RealValueTraits, bool IsConst, class Category>
|
||||||
|
struct iiterator
|
||||||
|
{
|
||||||
|
typedef RealValueTraits real_value_traits;
|
||||||
|
typedef typename real_value_traits::node_traits node_traits;
|
||||||
|
typedef typename node_traits::node node;
|
||||||
|
typedef typename node_traits::node_ptr node_ptr;
|
||||||
|
typedef ::boost::intrusive::pointer_traits<node_ptr> nodepointer_traits_t;
|
||||||
|
typedef typename nodepointer_traits_t::template
|
||||||
|
rebind_pointer<void>::type void_pointer;
|
||||||
|
typedef typename RealValueTraits::value_type value_type;
|
||||||
|
typedef typename RealValueTraits::pointer nonconst_pointer;
|
||||||
|
typedef typename RealValueTraits::const_pointer yesconst_pointer;
|
||||||
|
typedef typename ::boost::intrusive::pointer_traits
|
||||||
|
<nonconst_pointer>::reference nonconst_reference;
|
||||||
|
typedef typename ::boost::intrusive::pointer_traits
|
||||||
|
<yesconst_pointer>::reference yesconst_reference;
|
||||||
|
typedef typename nodepointer_traits_t::difference_type difference_type;
|
||||||
|
typedef typename detail::if_c
|
||||||
|
<IsConst, yesconst_pointer, nonconst_pointer>::type pointer;
|
||||||
|
typedef typename detail::if_c
|
||||||
|
<IsConst, yesconst_reference, nonconst_reference>::type reference;
|
||||||
|
typedef std::iterator
|
||||||
|
< Category
|
||||||
|
, value_type
|
||||||
|
, difference_type
|
||||||
|
, pointer
|
||||||
|
, reference
|
||||||
|
> iterator_base;
|
||||||
|
static const bool stateful_value_traits =
|
||||||
|
detail::is_stateful_value_traits<real_value_traits>::value;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class NodePtr, bool StatefulValueTraits = true>
|
||||||
|
struct iiterator_members
|
||||||
|
{
|
||||||
|
typedef ::boost::intrusive::pointer_traits<NodePtr> pointer_traits_t;
|
||||||
|
typedef typename pointer_traits_t::template
|
||||||
|
rebind_pointer<const void>::type const_void_pointer;
|
||||||
|
|
||||||
|
iiterator_members()
|
||||||
|
{}
|
||||||
|
|
||||||
|
iiterator_members(const NodePtr &n_ptr, const const_void_pointer &data)
|
||||||
|
: nodeptr_(n_ptr), ptr_(data)
|
||||||
|
{}
|
||||||
|
|
||||||
|
const_void_pointer get_ptr() const
|
||||||
|
{ return ptr_; }
|
||||||
|
|
||||||
|
NodePtr nodeptr_;
|
||||||
|
const_void_pointer ptr_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class NodePtr>
|
||||||
|
struct iiterator_members<NodePtr, false>
|
||||||
|
{
|
||||||
|
typedef ::boost::intrusive::pointer_traits<NodePtr> pointer_traits_t;
|
||||||
|
typedef typename pointer_traits_t::template
|
||||||
|
rebind_pointer<const void>::type const_void_pointer;
|
||||||
|
|
||||||
|
iiterator_members()
|
||||||
|
{}
|
||||||
|
|
||||||
|
iiterator_members(const NodePtr &n_ptr, const const_void_pointer &)
|
||||||
|
: nodeptr_(n_ptr)
|
||||||
|
{}
|
||||||
|
|
||||||
|
const_void_pointer get_ptr() const
|
||||||
|
{ return const_void_pointer(); }
|
||||||
|
|
||||||
|
NodePtr nodeptr_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class Less, class T>
|
||||||
|
struct get_less
|
||||||
|
{
|
||||||
|
typedef Less type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct get_less<void, T>
|
||||||
|
{
|
||||||
|
typedef ::std::less<T> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class EqualTo, class T>
|
||||||
|
struct get_equal_to
|
||||||
|
{
|
||||||
|
typedef EqualTo type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct get_equal_to<void, T>
|
||||||
|
{
|
||||||
|
typedef ::std::equal_to<T> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class Hash, class T>
|
||||||
|
struct get_hash
|
||||||
|
{
|
||||||
|
typedef Hash type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct get_hash<void, T>
|
||||||
|
{
|
||||||
|
typedef ::boost::hash<T> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct empty{};
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
|
// (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
|
||||||
// Software License, Version 1.0. (See accompanying file
|
// Software License, Version 1.0. (See accompanying file
|
||||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
@ -17,6 +17,10 @@
|
|||||||
#define BOOST_INTRUSIVE_PERFECT_FORWARDING
|
#define BOOST_INTRUSIVE_PERFECT_FORWARDING
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//Macros for documentation purposes. For code, expands to the argument
|
||||||
|
#define BOOST_INTRUSIVE_IMPDEF(TYPE) TYPE
|
||||||
|
#define BOOST_INTRUSIVE_SEEDOC(TYPE) TYPE
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_end.hpp>
|
#include <boost/intrusive/detail/config_end.hpp>
|
||||||
|
|
||||||
#endif //#ifndef BOOST_INTRUSIVE_DETAIL_WRKRND_HPP
|
#endif //#ifndef BOOST_INTRUSIVE_DETAIL_WRKRND_HPP
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -19,15 +19,6 @@
|
|||||||
|
|
||||||
/// @cond
|
/// @cond
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
|
|
||||||
namespace intrusive {
|
|
||||||
|
|
||||||
struct none;
|
|
||||||
|
|
||||||
} //namespace intrusive{
|
|
||||||
} //namespace boost{
|
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace intrusive {
|
namespace intrusive {
|
||||||
|
|
||||||
@ -53,11 +44,11 @@ class rbtree_algorithms;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
, class O5 = none
|
, class O5 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -66,9 +57,9 @@ class slist;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
@ -77,9 +68,9 @@ class slist_base_hook;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
@ -90,9 +81,9 @@ class slist_member_hook;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -101,9 +92,9 @@ class list;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
@ -112,9 +103,9 @@ class list_base_hook;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
@ -123,9 +114,9 @@ class list_member_hook;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
@ -136,10 +127,10 @@ class list_hook;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -149,10 +140,10 @@ class rbtree;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -162,10 +153,10 @@ class set;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -174,10 +165,10 @@ class multiset;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
@ -186,10 +177,10 @@ class set_base_hook;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
@ -200,10 +191,10 @@ class set_member_hook;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -213,10 +204,10 @@ class splaytree;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -226,10 +217,10 @@ class splay_set;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -238,9 +229,9 @@ class splay_multiset;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
@ -249,9 +240,9 @@ class splay_set_base_hook;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
@ -262,10 +253,10 @@ class splay_set_member_hook;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -275,10 +266,10 @@ class avltree;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -288,10 +279,10 @@ class avl_set;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -300,10 +291,10 @@ class avl_multiset;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
@ -312,10 +303,10 @@ class avl_set_base_hook;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
@ -327,10 +318,10 @@ class avl_set_member_hook;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -340,10 +331,10 @@ class treap;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -353,10 +344,10 @@ class treap_set;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -371,10 +362,10 @@ struct priority_compare;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -384,10 +375,10 @@ class sgtree;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -397,10 +388,10 @@ class sg_set;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -409,9 +400,48 @@ class sg_multiset;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class T
|
||||||
, class O2 = none
|
, class O1 = void
|
||||||
, class O3 = none
|
, class O2 = void
|
||||||
|
, class O3 = void
|
||||||
|
, class O4 = void
|
||||||
|
>
|
||||||
|
#else
|
||||||
|
template<class T, class ...Options>
|
||||||
|
#endif
|
||||||
|
class bstree;
|
||||||
|
|
||||||
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
|
template
|
||||||
|
< class T
|
||||||
|
, class O1 = void
|
||||||
|
, class O2 = void
|
||||||
|
, class O3 = void
|
||||||
|
, class O4 = void
|
||||||
|
>
|
||||||
|
#else
|
||||||
|
template<class T, class ...Options>
|
||||||
|
#endif
|
||||||
|
class bs_set;
|
||||||
|
|
||||||
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
|
template
|
||||||
|
< class T
|
||||||
|
, class O1 = void
|
||||||
|
, class O2 = void
|
||||||
|
, class O3 = void
|
||||||
|
, class O4 = void
|
||||||
|
>
|
||||||
|
#else
|
||||||
|
template<class T, class ...Options>
|
||||||
|
#endif
|
||||||
|
class bs_multiset;
|
||||||
|
|
||||||
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
|
template
|
||||||
|
< class O1 = void
|
||||||
|
, class O2 = void
|
||||||
|
, class O3 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
@ -420,9 +450,9 @@ class bs_set_base_hook;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
@ -434,16 +464,16 @@ class bs_set_member_hook;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
, class O5 = none
|
, class O5 = void
|
||||||
, class O6 = none
|
, class O6 = void
|
||||||
, class O7 = none
|
, class O7 = void
|
||||||
, class O8 = none
|
, class O8 = void
|
||||||
, class O9 = none
|
, class O9 = void
|
||||||
, class O10 = none
|
, class O10 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -453,16 +483,16 @@ class hashtable;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
, class O5 = none
|
, class O5 = void
|
||||||
, class O6 = none
|
, class O6 = void
|
||||||
, class O7 = none
|
, class O7 = void
|
||||||
, class O8 = none
|
, class O8 = void
|
||||||
, class O9 = none
|
, class O9 = void
|
||||||
, class O10 = none
|
, class O10 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -472,16 +502,16 @@ class unordered_set;
|
|||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class T
|
< class T
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
, class O5 = none
|
, class O5 = void
|
||||||
, class O6 = none
|
, class O6 = void
|
||||||
, class O7 = none
|
, class O7 = void
|
||||||
, class O8 = none
|
, class O8 = void
|
||||||
, class O9 = none
|
, class O9 = void
|
||||||
, class O10 = none
|
, class O10 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
@ -490,10 +520,10 @@ class unordered_multiset;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
@ -502,10 +532,10 @@ class unordered_set_base_hook;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
@ -514,9 +544,9 @@ class unordered_set_member_hook;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
@ -525,9 +555,9 @@ class any_base_hook;
|
|||||||
|
|
||||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template
|
template
|
||||||
< class O1 = none
|
< class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
>
|
>
|
||||||
#else
|
#else
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -17,6 +17,7 @@
|
|||||||
#include <boost/intrusive/detail/config_begin.hpp>
|
#include <boost/intrusive/detail/config_begin.hpp>
|
||||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||||
#include <boost/intrusive/detail/common_slist_algorithms.hpp>
|
#include <boost/intrusive/detail/common_slist_algorithms.hpp>
|
||||||
|
#include <boost/intrusive/detail/utilities.hpp>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@ -319,6 +320,16 @@ class linear_slist_algorithms
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// @cond
|
||||||
|
|
||||||
|
template<class NodeTraits>
|
||||||
|
struct get_algo<LinearSListAlgorithms, NodeTraits>
|
||||||
|
{
|
||||||
|
typedef linear_slist_algorithms<NodeTraits> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// @endcond
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -38,24 +38,12 @@ namespace intrusive {
|
|||||||
|
|
||||||
/// @cond
|
/// @cond
|
||||||
|
|
||||||
template <class ValueTraits, class SizeType, bool ConstantTimeSize>
|
|
||||||
struct listopt
|
|
||||||
{
|
|
||||||
typedef ValueTraits value_traits;
|
|
||||||
typedef SizeType size_type;
|
|
||||||
static const bool constant_time_size = ConstantTimeSize;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
struct list_defaults
|
struct list_defaults
|
||||||
: pack_options
|
{
|
||||||
< none
|
typedef detail::default_list_hook proto_value_traits;
|
||||||
, base_hook<detail::default_list_hook>
|
static const bool constant_time_size = true;
|
||||||
, constant_time_size<true>
|
typedef std::size_t size_type;
|
||||||
, size_type<std::size_t>
|
};
|
||||||
>::type
|
|
||||||
{};
|
|
||||||
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
@ -72,23 +60,19 @@ struct list_defaults
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class Config>
|
template <class ValueTraits, class SizeType, bool ConstantTimeSize>
|
||||||
#endif
|
#endif
|
||||||
class list_impl
|
class list_impl
|
||||||
: private detail::clear_on_destructor_base< list_impl<Config> >
|
: private detail::clear_on_destructor_base< list_impl<ValueTraits, SizeType, ConstantTimeSize> >
|
||||||
{
|
{
|
||||||
template<class C> friend class detail::clear_on_destructor_base;
|
template<class C> friend class detail::clear_on_destructor_base;
|
||||||
//Public typedefs
|
//Public typedefs
|
||||||
public:
|
public:
|
||||||
typedef typename Config::value_traits value_traits;
|
typedef ValueTraits value_traits;
|
||||||
/// @cond
|
/// @cond
|
||||||
static const bool external_value_traits =
|
static const bool external_value_traits =
|
||||||
detail::external_value_traits_bool_is_true<value_traits>::value;
|
detail::external_value_traits_bool_is_true<value_traits>::value;
|
||||||
typedef typename detail::eval_if_c
|
typedef typename detail::get_real_value_traits<ValueTraits>::type real_value_traits;
|
||||||
< external_value_traits
|
|
||||||
, detail::eval_value_traits<value_traits>
|
|
||||||
, detail::identity<value_traits>
|
|
||||||
>::type real_value_traits;
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef typename real_value_traits::pointer pointer;
|
typedef typename real_value_traits::pointer pointer;
|
||||||
typedef typename real_value_traits::const_pointer const_pointer;
|
typedef typename real_value_traits::const_pointer const_pointer;
|
||||||
@ -96,9 +80,9 @@ class list_impl
|
|||||||
typedef typename pointer_traits<pointer>::reference reference;
|
typedef typename pointer_traits<pointer>::reference reference;
|
||||||
typedef typename pointer_traits<const_pointer>::reference const_reference;
|
typedef typename pointer_traits<const_pointer>::reference const_reference;
|
||||||
typedef typename pointer_traits<pointer>::difference_type difference_type;
|
typedef typename pointer_traits<pointer>::difference_type difference_type;
|
||||||
typedef typename Config::size_type size_type;
|
typedef SizeType size_type;
|
||||||
typedef list_iterator<list_impl, false> iterator;
|
typedef list_iterator<real_value_traits, false> iterator;
|
||||||
typedef list_iterator<list_impl, true> const_iterator;
|
typedef list_iterator<real_value_traits, true> const_iterator;
|
||||||
typedef boost::intrusive::detail::reverse_iterator<iterator> reverse_iterator;
|
typedef boost::intrusive::detail::reverse_iterator<iterator> reverse_iterator;
|
||||||
typedef boost::intrusive::detail::reverse_iterator<const_iterator>const_reverse_iterator;
|
typedef boost::intrusive::detail::reverse_iterator<const_iterator>const_reverse_iterator;
|
||||||
typedef typename real_value_traits::node_traits node_traits;
|
typedef typename real_value_traits::node_traits node_traits;
|
||||||
@ -107,7 +91,7 @@ class list_impl
|
|||||||
typedef typename node_traits::const_node_ptr const_node_ptr;
|
typedef typename node_traits::const_node_ptr const_node_ptr;
|
||||||
typedef circular_list_algorithms<node_traits> node_algorithms;
|
typedef circular_list_algorithms<node_traits> node_algorithms;
|
||||||
|
|
||||||
static const bool constant_time_size = Config::constant_time_size;
|
static const bool constant_time_size = ConstantTimeSize;
|
||||||
static const bool stateful_value_traits = detail::is_stateful_value_traits<real_value_traits>::value;
|
static const bool stateful_value_traits = detail::is_stateful_value_traits<real_value_traits>::value;
|
||||||
|
|
||||||
/// @cond
|
/// @cond
|
||||||
@ -118,19 +102,13 @@ class list_impl
|
|||||||
//noncopyable
|
//noncopyable
|
||||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(list_impl)
|
BOOST_MOVABLE_BUT_NOT_COPYABLE(list_impl)
|
||||||
|
|
||||||
enum { safemode_or_autounlink =
|
static const bool safemode_or_autounlink = is_safe_autounlink<real_value_traits::link_mode>::value;
|
||||||
(int)real_value_traits::link_mode == (int)auto_unlink ||
|
|
||||||
(int)real_value_traits::link_mode == (int)safe_link };
|
|
||||||
|
|
||||||
//Constant-time size is incompatible with auto-unlink hooks!
|
//Constant-time size is incompatible with auto-unlink hooks!
|
||||||
BOOST_STATIC_ASSERT(!(constant_time_size &&
|
BOOST_STATIC_ASSERT(!(constant_time_size &&
|
||||||
((int)real_value_traits::link_mode == (int)auto_unlink)
|
((int)real_value_traits::link_mode == (int)auto_unlink)
|
||||||
));
|
));
|
||||||
|
|
||||||
//Const cast emulation for smart pointers
|
|
||||||
static node_ptr uncast(const const_node_ptr & ptr)
|
|
||||||
{ return pointer_traits<node_ptr>::const_cast_from(ptr); }
|
|
||||||
|
|
||||||
node_ptr get_root_node()
|
node_ptr get_root_node()
|
||||||
{ return pointer_traits<node_ptr>::pointer_to(data_.root_plus_size_.root_); }
|
{ return pointer_traits<node_ptr>::pointer_to(data_.root_plus_size_.root_); }
|
||||||
|
|
||||||
@ -196,6 +174,11 @@ class list_impl
|
|||||||
real_value_traits &get_real_value_traits()
|
real_value_traits &get_real_value_traits()
|
||||||
{ return this->get_real_value_traits(detail::bool_<external_value_traits>()); }
|
{ return this->get_real_value_traits(detail::bool_<external_value_traits>()); }
|
||||||
|
|
||||||
|
typedef typename pointer_traits<node_ptr>::template rebind_pointer<const real_value_traits>::type const_real_value_traits_ptr;
|
||||||
|
|
||||||
|
const_real_value_traits_ptr real_value_traits_ptr() const
|
||||||
|
{ return pointer_traits<const_real_value_traits_ptr>::pointer_to(this->get_real_value_traits()); }
|
||||||
|
|
||||||
//! <b>Effects</b>: constructs an empty list.
|
//! <b>Effects</b>: constructs an empty list.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant
|
//! <b>Complexity</b>: Constant
|
||||||
@ -371,7 +354,7 @@ class list_impl
|
|||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
const_reference front() const
|
const_reference front() const
|
||||||
{ return *get_real_value_traits().to_value_ptr(uncast(node_traits::get_next(this->get_root_node()))); }
|
{ return *get_real_value_traits().to_value_ptr(detail::uncast(node_traits::get_next(this->get_root_node()))); }
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns a reference to the last element of the list.
|
//! <b>Effects</b>: Returns a reference to the last element of the list.
|
||||||
//!
|
//!
|
||||||
@ -387,7 +370,7 @@ class list_impl
|
|||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
const_reference back() const
|
const_reference back() const
|
||||||
{ return *get_real_value_traits().to_value_ptr(uncast(node_traits::get_previous(this->get_root_node()))); }
|
{ return *get_real_value_traits().to_value_ptr(detail::uncast(node_traits::get_previous(this->get_root_node()))); }
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns an iterator to the first element contained in the list.
|
//! <b>Effects</b>: Returns an iterator to the first element contained in the list.
|
||||||
//!
|
//!
|
||||||
@ -395,7 +378,7 @@ class list_impl
|
|||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
iterator begin()
|
iterator begin()
|
||||||
{ return iterator(node_traits::get_next(this->get_root_node()), this); }
|
{ return iterator(node_traits::get_next(this->get_root_node()), real_value_traits_ptr()); }
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
|
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
|
||||||
//!
|
//!
|
||||||
@ -411,7 +394,7 @@ class list_impl
|
|||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
const_iterator cbegin() const
|
const_iterator cbegin() const
|
||||||
{ return const_iterator(node_traits::get_next(this->get_root_node()), this); }
|
{ return const_iterator(node_traits::get_next(this->get_root_node()), real_value_traits_ptr()); }
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns an iterator to the end of the list.
|
//! <b>Effects</b>: Returns an iterator to the end of the list.
|
||||||
//!
|
//!
|
||||||
@ -419,7 +402,7 @@ class list_impl
|
|||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
iterator end()
|
iterator end()
|
||||||
{ return iterator(this->get_root_node(), this); }
|
{ return iterator(this->get_root_node(), real_value_traits_ptr()); }
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
|
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
|
||||||
//!
|
//!
|
||||||
@ -435,7 +418,7 @@ class list_impl
|
|||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
const_iterator cend() const
|
const_iterator cend() const
|
||||||
{ return const_iterator(uncast(this->get_root_node()), this); }
|
{ return const_iterator(detail::uncast(this->get_root_node()), real_value_traits_ptr()); }
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
|
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
|
||||||
//! of the reversed list.
|
//! of the reversed list.
|
||||||
@ -806,7 +789,7 @@ class list_impl
|
|||||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(to_insert));
|
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(to_insert));
|
||||||
node_algorithms::link_before(p.pointed_node(), to_insert);
|
node_algorithms::link_before(p.pointed_node(), to_insert);
|
||||||
this->priv_size_traits().increment();
|
this->priv_size_traits().increment();
|
||||||
return iterator(to_insert, this);
|
return iterator(to_insert, real_value_traits_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: Dereferencing iterator must yield
|
//! <b>Requires</b>: Dereferencing iterator must yield
|
||||||
@ -1240,7 +1223,7 @@ class list_impl
|
|||||||
{
|
{
|
||||||
BOOST_STATIC_ASSERT((!stateful_value_traits));
|
BOOST_STATIC_ASSERT((!stateful_value_traits));
|
||||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(value)));
|
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(value)));
|
||||||
return iterator(real_value_traits::to_node_ptr(value), 0);
|
return iterator(real_value_traits::to_node_ptr(value), const_real_value_traits_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
|
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
|
||||||
@ -1258,7 +1241,7 @@ class list_impl
|
|||||||
{
|
{
|
||||||
BOOST_STATIC_ASSERT((!stateful_value_traits));
|
BOOST_STATIC_ASSERT((!stateful_value_traits));
|
||||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(const_cast<reference> (value))));
|
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(const_cast<reference> (value))));
|
||||||
return const_iterator(real_value_traits::to_node_ptr(const_cast<reference> (value)), 0);
|
return const_iterator(real_value_traits::to_node_ptr(const_cast<reference> (value)), const_real_value_traits_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: value must be a reference to a value inserted in a list.
|
//! <b>Requires</b>: value must be a reference to a value inserted in a list.
|
||||||
@ -1273,7 +1256,7 @@ class list_impl
|
|||||||
iterator iterator_to(reference value)
|
iterator iterator_to(reference value)
|
||||||
{
|
{
|
||||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(value)));
|
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(value)));
|
||||||
return iterator(real_value_traits::to_node_ptr(value), this);
|
return iterator(real_value_traits::to_node_ptr(value), real_value_traits_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
|
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
|
||||||
@ -1288,7 +1271,7 @@ class list_impl
|
|||||||
const_iterator iterator_to(const_reference value) const
|
const_iterator iterator_to(const_reference value) const
|
||||||
{
|
{
|
||||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(const_cast<reference> (value))));
|
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(const_cast<reference> (value))));
|
||||||
return const_iterator(real_value_traits::to_node_ptr(const_cast<reference> (value)), this);
|
return const_iterator(real_value_traits::to_node_ptr(const_cast<reference> (value)), real_value_traits_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @cond
|
/// @cond
|
||||||
@ -1309,29 +1292,29 @@ class list_impl
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class Config>
|
template <class ValueTraits, class SizeType, bool ConstantTimeSize>
|
||||||
#endif
|
#endif
|
||||||
inline bool operator<
|
inline bool operator<
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
|
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
|
||||||
#else
|
#else
|
||||||
(const list_impl<Config> &x, const list_impl<Config> &y)
|
(const list_impl<ValueTraits, SizeType, ConstantTimeSize> &x, const list_impl<ValueTraits, SizeType, ConstantTimeSize> &y)
|
||||||
#endif
|
#endif
|
||||||
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
|
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
|
||||||
|
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class Config>
|
template <class ValueTraits, class SizeType, bool ConstantTimeSize>
|
||||||
#endif
|
#endif
|
||||||
bool operator==
|
bool operator==
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
|
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
|
||||||
#else
|
#else
|
||||||
(const list_impl<Config> &x, const list_impl<Config> &y)
|
(const list_impl<ValueTraits, SizeType, ConstantTimeSize> &x, const list_impl<ValueTraits, SizeType, ConstantTimeSize> &y)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
typedef list_impl<Config> list_type;
|
typedef list_impl<ValueTraits, SizeType, ConstantTimeSize> list_type;
|
||||||
typedef typename list_type::const_iterator const_iterator;
|
typedef typename list_type::const_iterator const_iterator;
|
||||||
const bool C = list_type::constant_time_size;
|
const bool C = list_type::constant_time_size;
|
||||||
if(C && x.size() != y.size()){
|
if(C && x.size() != y.size()){
|
||||||
@ -1361,65 +1344,65 @@ bool operator==
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class Config>
|
template <class ValueTraits, class SizeType, bool ConstantTimeSize>
|
||||||
#endif
|
#endif
|
||||||
inline bool operator!=
|
inline bool operator!=
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
|
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
|
||||||
#else
|
#else
|
||||||
(const list_impl<Config> &x, const list_impl<Config> &y)
|
(const list_impl<ValueTraits, SizeType, ConstantTimeSize> &x, const list_impl<ValueTraits, SizeType, ConstantTimeSize> &y)
|
||||||
#endif
|
#endif
|
||||||
{ return !(x == y); }
|
{ return !(x == y); }
|
||||||
|
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class Config>
|
template <class ValueTraits, class SizeType, bool ConstantTimeSize>
|
||||||
#endif
|
#endif
|
||||||
inline bool operator>
|
inline bool operator>
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
|
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
|
||||||
#else
|
#else
|
||||||
(const list_impl<Config> &x, const list_impl<Config> &y)
|
(const list_impl<ValueTraits, SizeType, ConstantTimeSize> &x, const list_impl<ValueTraits, SizeType, ConstantTimeSize> &y)
|
||||||
#endif
|
#endif
|
||||||
{ return y < x; }
|
{ return y < x; }
|
||||||
|
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class Config>
|
template <class ValueTraits, class SizeType, bool ConstantTimeSize>
|
||||||
#endif
|
#endif
|
||||||
inline bool operator<=
|
inline bool operator<=
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
|
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
|
||||||
#else
|
#else
|
||||||
(const list_impl<Config> &x, const list_impl<Config> &y)
|
(const list_impl<ValueTraits, SizeType, ConstantTimeSize> &x, const list_impl<ValueTraits, SizeType, ConstantTimeSize> &y)
|
||||||
#endif
|
#endif
|
||||||
{ return !(y < x); }
|
{ return !(y < x); }
|
||||||
|
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class Config>
|
template <class ValueTraits, class SizeType, bool ConstantTimeSize>
|
||||||
#endif
|
#endif
|
||||||
inline bool operator>=
|
inline bool operator>=
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
|
(const list_impl<T, Options...> &x, const list_impl<T, Options...> &y)
|
||||||
#else
|
#else
|
||||||
(const list_impl<Config> &x, const list_impl<Config> &y)
|
(const list_impl<ValueTraits, SizeType, ConstantTimeSize> &x, const list_impl<ValueTraits, SizeType, ConstantTimeSize> &y)
|
||||||
#endif
|
#endif
|
||||||
{ return !(x < y); }
|
{ return !(x < y); }
|
||||||
|
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class Config>
|
template <class ValueTraits, class SizeType, bool ConstantTimeSize>
|
||||||
#endif
|
#endif
|
||||||
inline void swap
|
inline void swap
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
(list_impl<T, Options...> &x, list_impl<T, Options...> &y)
|
(list_impl<T, Options...> &x, list_impl<T, Options...> &y)
|
||||||
#else
|
#else
|
||||||
(list_impl<Config> &x, list_impl<Config> &y)
|
(list_impl<ValueTraits, SizeType, ConstantTimeSize> &x, list_impl<ValueTraits, SizeType, ConstantTimeSize> &y)
|
||||||
#endif
|
#endif
|
||||||
{ x.swap(y); }
|
{ x.swap(y); }
|
||||||
|
|
||||||
@ -1428,13 +1411,13 @@ inline void swap
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class T, class O1 = none, class O2 = none, class O3 = none>
|
template<class T, class O1 = void, class O2 = void, class O3 = void>
|
||||||
#endif
|
#endif
|
||||||
struct make_list
|
struct make_list
|
||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef typename pack_options
|
typedef typename pack_options
|
||||||
< list_defaults<T>,
|
< list_defaults,
|
||||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
O1, O2, O3
|
O1, O2, O3
|
||||||
#else
|
#else
|
||||||
@ -1443,15 +1426,13 @@ struct make_list
|
|||||||
>::type packed_options;
|
>::type packed_options;
|
||||||
|
|
||||||
typedef typename detail::get_value_traits
|
typedef typename detail::get_value_traits
|
||||||
<T, typename packed_options::value_traits>::type value_traits;
|
<T, typename packed_options::proto_value_traits>::type value_traits;
|
||||||
|
|
||||||
typedef list_impl
|
typedef list_impl
|
||||||
<
|
<
|
||||||
listopt
|
value_traits,
|
||||||
< value_traits
|
typename packed_options::size_type,
|
||||||
, typename packed_options::size_type
|
packed_options::constant_time_size
|
||||||
, packed_options::constant_time_size
|
|
||||||
>
|
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
@ -1506,7 +1487,7 @@ class list
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
list& operator=(BOOST_RV_REF(list) x)
|
list& operator=(BOOST_RV_REF(list) x)
|
||||||
{ this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
|
{ return static_cast<list &>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); }
|
||||||
|
|
||||||
static list &container_from_end_iterator(iterator end_iterator)
|
static list &container_from_end_iterator(iterator end_iterator)
|
||||||
{ return static_cast<list &>(Base::container_from_end_iterator(end_iterator)); }
|
{ return static_cast<list &>(Base::container_from_end_iterator(end_iterator)); }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -38,7 +38,7 @@ struct get_list_node_algo
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class O1 = none, class O2 = none, class O3 = none>
|
template<class O1 = void, class O2 = void, class O3 = void>
|
||||||
#endif
|
#endif
|
||||||
struct make_list_base_hook
|
struct make_list_base_hook
|
||||||
{
|
{
|
||||||
@ -52,11 +52,11 @@ struct make_list_base_hook
|
|||||||
#endif
|
#endif
|
||||||
>::type packed_options;
|
>::type packed_options;
|
||||||
|
|
||||||
typedef detail::generic_hook
|
typedef generic_hook
|
||||||
< get_list_node_algo<typename packed_options::void_pointer>
|
< get_list_node_algo<typename packed_options::void_pointer>
|
||||||
, typename packed_options::tag
|
, typename packed_options::tag
|
||||||
, packed_options::link_mode
|
, packed_options::link_mode
|
||||||
, detail::ListBaseHook
|
, ListBaseHookId
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
@ -165,7 +165,7 @@ class list_base_hook
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class O1 = none, class O2 = none, class O3 = none>
|
template<class O1 = void, class O2 = void, class O3 = void>
|
||||||
#endif
|
#endif
|
||||||
struct make_list_member_hook
|
struct make_list_member_hook
|
||||||
{
|
{
|
||||||
@ -179,11 +179,11 @@ struct make_list_member_hook
|
|||||||
#endif
|
#endif
|
||||||
>::type packed_options;
|
>::type packed_options;
|
||||||
|
|
||||||
typedef detail::generic_hook
|
typedef generic_hook
|
||||||
< get_list_node_algo<typename packed_options::void_pointer>
|
< get_list_node_algo<typename packed_options::void_pointer>
|
||||||
, member_tag
|
, member_tag
|
||||||
, packed_options::link_mode
|
, packed_options::link_mode
|
||||||
, detail::NoBaseHook
|
, NoBaseHookId
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -26,6 +26,7 @@ namespace intrusive {
|
|||||||
|
|
||||||
/// @cond
|
/// @cond
|
||||||
|
|
||||||
|
//typedef void default_tag;
|
||||||
struct default_tag;
|
struct default_tag;
|
||||||
struct member_tag;
|
struct member_tag;
|
||||||
|
|
||||||
@ -45,11 +46,13 @@ struct BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER : public default_hook_tag\
|
|||||||
|
|
||||||
BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_list_hook);
|
BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_list_hook);
|
||||||
BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_slist_hook);
|
BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_slist_hook);
|
||||||
BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_set_hook);
|
BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_rbtree_hook);
|
||||||
BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_uset_hook);
|
BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_hashtable_hook);
|
||||||
BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_avl_set_hook);
|
BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_avltree_hook);
|
||||||
BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_splay_set_hook);
|
BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_bstree_hook);
|
||||||
BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_bs_set_hook);
|
//BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_splaytree_hook);
|
||||||
|
//BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_sgtree_hook);
|
||||||
|
//BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_treap_hook);
|
||||||
|
|
||||||
#undef BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION
|
#undef BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION
|
||||||
|
|
||||||
@ -61,6 +64,15 @@ struct eval_value_traits
|
|||||||
typedef typename ValueTraits::value_traits type;
|
typedef typename ValueTraits::value_traits type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class ValueTraits>
|
||||||
|
struct get_real_value_traits
|
||||||
|
: public eval_if_c
|
||||||
|
< external_value_traits_bool_is_true<ValueTraits>::value
|
||||||
|
, eval_value_traits<ValueTraits>
|
||||||
|
, identity<ValueTraits>
|
||||||
|
>
|
||||||
|
{};
|
||||||
|
|
||||||
template <class BucketTraits>
|
template <class BucketTraits>
|
||||||
struct eval_bucket_traits
|
struct eval_bucket_traits
|
||||||
{
|
{
|
||||||
@ -70,29 +82,36 @@ struct eval_bucket_traits
|
|||||||
template <class T, class BaseHook>
|
template <class T, class BaseHook>
|
||||||
struct concrete_hook_base_value_traits
|
struct concrete_hook_base_value_traits
|
||||||
{
|
{
|
||||||
typedef typename BaseHook::boost_intrusive_tags tags;
|
typedef typename BaseHook::hooktags tags;
|
||||||
typedef detail::base_hook_traits
|
typedef bhtraits
|
||||||
< T
|
< T
|
||||||
, typename tags::node_traits
|
, typename tags::node_traits
|
||||||
, tags::link_mode
|
, tags::link_mode
|
||||||
, typename tags::tag
|
, typename tags::tag
|
||||||
, tags::hook_type> type;
|
, tags::type> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class BaseHook>
|
template <class BaseHook>
|
||||||
struct concrete_hook_base_node_traits
|
struct concrete_hook_base_node_traits
|
||||||
{ typedef typename BaseHook::boost_intrusive_tags::node_traits type; };
|
{ typedef typename BaseHook::hooktags::node_traits type; };
|
||||||
|
|
||||||
template <class T, class BaseHook>
|
template <class T, class AnyToSomeHook_ProtoValueTraits>
|
||||||
struct any_hook_base_value_traits
|
struct any_hook_base_value_traits
|
||||||
{
|
{
|
||||||
typedef typename BaseHook::boost_intrusive_tags tags;
|
//AnyToSomeHook value_traits derive from a generic_hook
|
||||||
typedef detail::base_hook_traits
|
//The generic_hook is configured with any_node_traits
|
||||||
|
//and AnyToSomeHook::value_traits with the correct
|
||||||
|
//node traits for the container, so use node_traits
|
||||||
|
//from AnyToSomeHook_ProtoValueTraits and the rest of
|
||||||
|
//elements from the hooktags member of the generic_hook
|
||||||
|
typedef AnyToSomeHook_ProtoValueTraits proto_value_traits;
|
||||||
|
typedef bhtraits
|
||||||
< T
|
< T
|
||||||
, typename BaseHook::node_traits
|
, typename proto_value_traits::node_traits
|
||||||
, tags::link_mode
|
, proto_value_traits::hooktags::link_mode
|
||||||
, typename tags::tag
|
, typename proto_value_traits::hooktags::tag
|
||||||
, tags::hook_type> type;
|
, proto_value_traits::hooktags::type
|
||||||
|
> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class BaseHook>
|
template <class BaseHook>
|
||||||
@ -139,6 +158,7 @@ struct get_value_traits
|
|||||||
,detail::apply<SupposedValueTraits, T>
|
,detail::apply<SupposedValueTraits, T>
|
||||||
,detail::identity<SupposedValueTraits>
|
,detail::identity<SupposedValueTraits>
|
||||||
>::type supposed_value_traits;
|
>::type supposed_value_traits;
|
||||||
|
|
||||||
//...if it's a default hook
|
//...if it's a default hook
|
||||||
typedef typename detail::eval_if_c
|
typedef typename detail::eval_if_c
|
||||||
< internal_base_hook_bool_is_true<supposed_value_traits>::value
|
< internal_base_hook_bool_is_true<supposed_value_traits>::value
|
||||||
@ -183,16 +203,6 @@ struct get_node_traits
|
|||||||
|
|
||||||
} //namespace detail{
|
} //namespace detail{
|
||||||
|
|
||||||
|
|
||||||
//!This type indicates that no option is being used
|
|
||||||
//!and that the default options should be used
|
|
||||||
struct none
|
|
||||||
{
|
|
||||||
template<class Base>
|
|
||||||
struct pack : Base
|
|
||||||
{ };
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
//!This option setter specifies if the intrusive
|
//!This option setter specifies if the intrusive
|
||||||
@ -314,7 +324,7 @@ struct value_traits
|
|||||||
template<class Base>
|
template<class Base>
|
||||||
struct pack : Base
|
struct pack : Base
|
||||||
{
|
{
|
||||||
typedef ValueTraits value_traits;
|
typedef ValueTraits proto_value_traits;
|
||||||
};
|
};
|
||||||
/// @endcond
|
/// @endcond
|
||||||
};
|
};
|
||||||
@ -327,7 +337,22 @@ template< typename Parent
|
|||||||
struct member_hook
|
struct member_hook
|
||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef detail::member_hook_traits
|
/*
|
||||||
|
typedef typename MemberHook::hooktags::node_traits node_traits;
|
||||||
|
typedef typename node_traits::node node_type;
|
||||||
|
typedef node_type Parent::* Ptr2MemNode;
|
||||||
|
typedef mhtraits
|
||||||
|
< Parent
|
||||||
|
, node_traits
|
||||||
|
//This cast is really ugly but necessary to reduce template bloat.
|
||||||
|
//Since we control the layout between the hook and the node, and there is
|
||||||
|
//always single inheritance, the offset of the node is exactly the offset of
|
||||||
|
//the hook. Since the node type is shared between all member hooks, this saves
|
||||||
|
//quite a lot of symbol stuff.
|
||||||
|
, (Ptr2MemNode)PtrToMember
|
||||||
|
, MemberHook::hooktags::link_mode> member_value_traits;
|
||||||
|
*/
|
||||||
|
typedef mhtraits
|
||||||
< Parent
|
< Parent
|
||||||
, MemberHook
|
, MemberHook
|
||||||
, PtrToMember
|
, PtrToMember
|
||||||
@ -335,7 +360,7 @@ struct member_hook
|
|||||||
template<class Base>
|
template<class Base>
|
||||||
struct pack : Base
|
struct pack : Base
|
||||||
{
|
{
|
||||||
typedef member_value_traits value_traits;
|
typedef member_value_traits proto_value_traits;
|
||||||
};
|
};
|
||||||
/// @endcond
|
/// @endcond
|
||||||
};
|
};
|
||||||
@ -348,12 +373,12 @@ template< typename Functor>
|
|||||||
struct function_hook
|
struct function_hook
|
||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef detail::function_hook_traits
|
typedef fhtraits
|
||||||
<Functor> function_value_traits;
|
<Functor> function_value_traits;
|
||||||
template<class Base>
|
template<class Base>
|
||||||
struct pack : Base
|
struct pack : Base
|
||||||
{
|
{
|
||||||
typedef function_value_traits value_traits;
|
typedef function_value_traits proto_value_traits;
|
||||||
};
|
};
|
||||||
/// @endcond
|
/// @endcond
|
||||||
};
|
};
|
||||||
@ -368,7 +393,7 @@ struct base_hook
|
|||||||
template<class Base>
|
template<class Base>
|
||||||
struct pack : Base
|
struct pack : Base
|
||||||
{
|
{
|
||||||
typedef BaseHook value_traits;
|
typedef BaseHook proto_value_traits;
|
||||||
};
|
};
|
||||||
/// @endcond
|
/// @endcond
|
||||||
};
|
};
|
||||||
@ -583,6 +608,13 @@ struct incremental
|
|||||||
|
|
||||||
/// @cond
|
/// @cond
|
||||||
|
|
||||||
|
struct none
|
||||||
|
{
|
||||||
|
template<class Base>
|
||||||
|
struct pack : Base
|
||||||
|
{};
|
||||||
|
};
|
||||||
|
|
||||||
//To-do: pass to variadic templates
|
//To-do: pass to variadic templates
|
||||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
|
|
||||||
@ -594,25 +626,25 @@ struct do_pack
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<class Prev>
|
template<class Prev>
|
||||||
struct do_pack<Prev, none>
|
struct do_pack<Prev, void>
|
||||||
{
|
{
|
||||||
//Avoid packing "none" to shorten template names
|
//Avoid packing "void" to shorten template names
|
||||||
typedef Prev type;
|
typedef Prev type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template
|
template
|
||||||
< class DefaultOptions
|
< class DefaultOptions
|
||||||
, class O1 = none
|
, class O1 = void
|
||||||
, class O2 = none
|
, class O2 = void
|
||||||
, class O3 = none
|
, class O3 = void
|
||||||
, class O4 = none
|
, class O4 = void
|
||||||
, class O5 = none
|
, class O5 = void
|
||||||
, class O6 = none
|
, class O6 = void
|
||||||
, class O7 = none
|
, class O7 = void
|
||||||
, class O8 = none
|
, class O8 = void
|
||||||
, class O9 = none
|
, class O9 = void
|
||||||
, class O10 = none
|
, class O10 = void
|
||||||
, class O11 = none
|
, class O11 = void
|
||||||
>
|
>
|
||||||
struct pack_options
|
struct pack_options
|
||||||
{
|
{
|
||||||
@ -788,17 +820,15 @@ struct pack_options
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct hook_defaults
|
struct hook_defaults
|
||||||
: public pack_options
|
{
|
||||||
< none
|
typedef void* void_pointer;
|
||||||
, void_pointer<void*>
|
static const link_mode_type link_mode = safe_link;
|
||||||
, link_mode<safe_link>
|
typedef default_tag tag;
|
||||||
, tag<default_tag>
|
static const bool optimize_size = false;
|
||||||
, optimize_size<false>
|
static const bool store_hash = false;
|
||||||
, store_hash<false>
|
static const bool linear = false;
|
||||||
, linear<false>
|
static const bool optimize_multikey = false;
|
||||||
, optimize_multikey<false>
|
};
|
||||||
>::type
|
|
||||||
{};
|
|
||||||
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2010-2012
|
// (C) Copyright Ion Gaztanaga 2010-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
|
// (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost
|
||||||
// Software License, Version 1.0. (See accompanying file
|
// Software License, Version 1.0. (See accompanying file
|
||||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
|
@ -31,6 +31,23 @@ struct priority_compare
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// @cond
|
||||||
|
|
||||||
|
template<class Less, class T>
|
||||||
|
struct get_prio
|
||||||
|
{
|
||||||
|
typedef Less type;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct get_prio<void, T>
|
||||||
|
{
|
||||||
|
typedef ::boost::intrusive::priority_compare<T> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// @endcond
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012.
|
// (C) Copyright Ion Gaztanaga 2006-2013.
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -55,12 +55,50 @@
|
|||||||
|
|
||||||
#include <boost/intrusive/detail/assert.hpp>
|
#include <boost/intrusive/detail/assert.hpp>
|
||||||
#include <boost/intrusive/detail/utilities.hpp>
|
#include <boost/intrusive/detail/utilities.hpp>
|
||||||
#include <boost/intrusive/detail/tree_algorithms.hpp>
|
#include <boost/intrusive/bstree_algorithms.hpp>
|
||||||
#include <boost/intrusive/pointer_traits.hpp>
|
#include <boost/intrusive/pointer_traits.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace intrusive {
|
namespace intrusive {
|
||||||
|
|
||||||
|
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
|
||||||
|
template<class NodeTraits, class F>
|
||||||
|
struct rbtree_node_cloner
|
||||||
|
: private detail::ebo_functor_holder<F>
|
||||||
|
{
|
||||||
|
typedef typename NodeTraits::node_ptr node_ptr;
|
||||||
|
typedef detail::ebo_functor_holder<F> base_t;
|
||||||
|
|
||||||
|
rbtree_node_cloner(F f)
|
||||||
|
: base_t(f)
|
||||||
|
{}
|
||||||
|
|
||||||
|
node_ptr operator()(const node_ptr & p)
|
||||||
|
{
|
||||||
|
node_ptr n = base_t::get()(p);
|
||||||
|
NodeTraits::set_color(n, NodeTraits::get_color(p));
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class NodeTraits>
|
||||||
|
struct rbtree_erase_fixup
|
||||||
|
{
|
||||||
|
typedef typename NodeTraits::node_ptr node_ptr;
|
||||||
|
typedef typename NodeTraits::color color;
|
||||||
|
|
||||||
|
void operator()(const node_ptr & to_erase, const node_ptr & successor)
|
||||||
|
{
|
||||||
|
//Swap color of y and z
|
||||||
|
color tmp(NodeTraits::get_color(successor));
|
||||||
|
NodeTraits::set_color(successor, NodeTraits::get_color(to_erase));
|
||||||
|
NodeTraits::set_color(to_erase, tmp);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
|
||||||
//! rbtree_algorithms provides basic algorithms to manipulate
|
//! rbtree_algorithms provides basic algorithms to manipulate
|
||||||
//! nodes forming a red-black tree. The insertion and deletion algorithms are
|
//! nodes forming a red-black tree. The insertion and deletion algorithms are
|
||||||
//! based on those in Cormen, Leiserson, and Rivest, Introduction to Algorithms
|
//! based on those in Cormen, Leiserson, and Rivest, Introduction to Algorithms
|
||||||
@ -82,7 +120,7 @@ namespace intrusive {
|
|||||||
//!
|
//!
|
||||||
//! <b>Typedefs</b>:
|
//! <b>Typedefs</b>:
|
||||||
//!
|
//!
|
||||||
//! <tt>node</tt>: The type of the node that forms the circular list
|
//! <tt>node</tt>: The type of the node that forms the binary search tree
|
||||||
//!
|
//!
|
||||||
//! <tt>node_ptr</tt>: A pointer to a node
|
//! <tt>node_ptr</tt>: A pointer to a node
|
||||||
//!
|
//!
|
||||||
@ -113,6 +151,9 @@ namespace intrusive {
|
|||||||
//! <tt>static color red();</tt>
|
//! <tt>static color red();</tt>
|
||||||
template<class NodeTraits>
|
template<class NodeTraits>
|
||||||
class rbtree_algorithms
|
class rbtree_algorithms
|
||||||
|
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
: public bstree_algorithms<NodeTraits>
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef NodeTraits node_traits;
|
typedef NodeTraits node_traits;
|
||||||
@ -124,167 +165,71 @@ class rbtree_algorithms
|
|||||||
/// @cond
|
/// @cond
|
||||||
private:
|
private:
|
||||||
|
|
||||||
typedef detail::tree_algorithms<NodeTraits> tree_algorithms;
|
typedef bstree_algorithms<NodeTraits> bstree_algorithms;
|
||||||
|
|
||||||
template<class F>
|
|
||||||
struct rbtree_node_cloner
|
|
||||||
: private detail::ebo_functor_holder<F>
|
|
||||||
{
|
|
||||||
typedef detail::ebo_functor_holder<F> base_t;
|
|
||||||
|
|
||||||
rbtree_node_cloner(F f)
|
|
||||||
: base_t(f)
|
|
||||||
{}
|
|
||||||
|
|
||||||
node_ptr operator()(const node_ptr & p)
|
|
||||||
{
|
|
||||||
node_ptr n = base_t::get()(p);
|
|
||||||
NodeTraits::set_color(n, NodeTraits::get_color(p));
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct rbtree_erase_fixup
|
|
||||||
{
|
|
||||||
void operator()(const node_ptr & to_erase, const node_ptr & successor)
|
|
||||||
{
|
|
||||||
//Swap color of y and z
|
|
||||||
color tmp(NodeTraits::get_color(successor));
|
|
||||||
NodeTraits::set_color(successor, NodeTraits::get_color(to_erase));
|
|
||||||
NodeTraits::set_color(to_erase, tmp);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static node_ptr uncast(const const_node_ptr & ptr)
|
|
||||||
{ return pointer_traits<node_ptr>::const_cast_from(ptr); }
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static node_ptr begin_node(const const_node_ptr & header)
|
|
||||||
{ return tree_algorithms::begin_node(header); }
|
|
||||||
|
|
||||||
static node_ptr end_node(const const_node_ptr & header)
|
|
||||||
{ return tree_algorithms::end_node(header); }
|
|
||||||
|
|
||||||
//! This type is the information that will be
|
//! This type is the information that will be
|
||||||
//! filled by insert_unique_check
|
//! filled by insert_unique_check
|
||||||
typedef typename tree_algorithms::insert_commit_data insert_commit_data;
|
typedef typename bstree_algorithms::insert_commit_data insert_commit_data;
|
||||||
|
|
||||||
//! <b>Requires</b>: header1 and header2 must be the header nodes
|
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//! of two trees.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Swaps two trees. After the function header1 will contain
|
|
||||||
//! links to the second tree and header2 will have links to the first tree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
|
|
||||||
{ return tree_algorithms::swap_tree(header1, header2); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! @copydoc ::boost::intrusive::bstree_algorithms::get_header(const const_node_ptr&)
|
||||||
//! of two trees.
|
static node_ptr get_header(const const_node_ptr & n);
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
//! @copydoc ::boost::intrusive::bstree_algorithms::begin_node
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
static node_ptr begin_node(const const_node_ptr & header);
|
||||||
//! position node1 had before the function.
|
|
||||||
//!
|
//! @copydoc ::boost::intrusive::bstree_algorithms::end_node
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
static node_ptr end_node(const const_node_ptr & header);
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::swap_tree
|
||||||
//!
|
static void swap_tree(const node_ptr & header1, const node_ptr & header2);
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//!
|
|
||||||
//!Experimental function
|
//! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&)
|
||||||
static void swap_nodes(const node_ptr & node1, const node_ptr & node2)
|
static void swap_nodes(const node_ptr & node1, const node_ptr & node2)
|
||||||
{
|
{
|
||||||
if(node1 == node2)
|
if(node1 == node2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
|
node_ptr header1(bstree_algorithms::get_header(node1)), header2(bstree_algorithms::get_header(node2));
|
||||||
swap_nodes(node1, header1, node2, header2);
|
swap_nodes(node1, header1, node2, header2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&,const node_ptr&,const node_ptr&)
|
||||||
//! of two trees with header header1 and header2.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
|
||||||
//! position node1 had before the function.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
|
||||||
//!
|
|
||||||
//!Experimental function
|
|
||||||
static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2)
|
static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2)
|
||||||
{
|
{
|
||||||
if(node1 == node2) return;
|
if(node1 == node2) return;
|
||||||
|
|
||||||
tree_algorithms::swap_nodes(node1, header1, node2, header2);
|
bstree_algorithms::swap_nodes(node1, header1, node2, header2);
|
||||||
//Swap color
|
//Swap color
|
||||||
color c = NodeTraits::get_color(node1);
|
color c = NodeTraits::get_color(node1);
|
||||||
NodeTraits::set_color(node1, NodeTraits::get_color(node2));
|
NodeTraits::set_color(node1, NodeTraits::get_color(node2));
|
||||||
NodeTraits::set_color(node2, c);
|
NodeTraits::set_color(node2, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&)
|
||||||
//! and new_node must not be inserted in a tree.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
|
||||||
//! the node, since no rebalancing and comparison is needed.
|
|
||||||
//!
|
|
||||||
//!Experimental function
|
|
||||||
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node)
|
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node)
|
||||||
{
|
{
|
||||||
if(node_to_be_replaced == new_node)
|
if(node_to_be_replaced == new_node)
|
||||||
return;
|
return;
|
||||||
replace_node(node_to_be_replaced, tree_algorithms::get_header(node_to_be_replaced), new_node);
|
replace_node(node_to_be_replaced, bstree_algorithms::get_header(node_to_be_replaced), new_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&,const node_ptr&)
|
||||||
//! with header "header" and new_node must not be inserted in a tree.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
|
||||||
//! the node, since no rebalancing or comparison is needed.
|
|
||||||
//!
|
|
||||||
//!Experimental function
|
|
||||||
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node)
|
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node)
|
||||||
{
|
{
|
||||||
tree_algorithms::replace_node(node_to_be_replaced, header, new_node);
|
bstree_algorithms::replace_node(node_to_be_replaced, header, new_node);
|
||||||
NodeTraits::set_color(new_node, NodeTraits::get_color(node_to_be_replaced));
|
NodeTraits::set_color(new_node, NodeTraits::get_color(node_to_be_replaced));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a tree node but not the header.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::unlink(const node_ptr&)
|
||||||
//!
|
static void unlink(const node_ptr& node)
|
||||||
//! <b>Effects</b>: Unlinks the node and rebalances the tree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity is constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static void unlink(const node_ptr & node)
|
|
||||||
{
|
{
|
||||||
node_ptr x = NodeTraits::get_parent(node);
|
node_ptr x = NodeTraits::get_parent(node);
|
||||||
if(x){
|
if(x){
|
||||||
@ -294,517 +239,176 @@ class rbtree_algorithms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: header is the header of a tree.
|
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//!
|
//! @copydoc ::boost::intrusive::bstree_algorithms::unlink_leftmost_without_rebalance
|
||||||
//! <b>Effects</b>: Unlinks the leftmost node from the tree, and
|
static node_ptr unlink_leftmost_without_rebalance(const node_ptr & header);
|
||||||
//! updates the header link to the new leftmost node.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity is constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Notes</b>: This function breaks the tree and the tree can
|
|
||||||
//! only be used for more unlink_leftmost_without_rebalance calls.
|
|
||||||
//! This function is normally used to achieve a step by step
|
|
||||||
//! controlled destruction of the tree.
|
|
||||||
static node_ptr unlink_leftmost_without_rebalance(const node_ptr & header)
|
|
||||||
{ return tree_algorithms::unlink_leftmost_without_rebalance(header); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree or an node initialized
|
//! @copydoc ::boost::intrusive::bstree_algorithms::unique(const const_node_ptr&)
|
||||||
//! by init(...).
|
static bool unique(const const_node_ptr & node);
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns true if the node is initialized by init().
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static bool unique(const const_node_ptr & node)
|
|
||||||
{ return tree_algorithms::unique(node); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::size(const const_node_ptr&)
|
||||||
//!
|
static std::size_t size(const const_node_ptr & header);
|
||||||
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Linear time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static std::size_t count(const const_node_ptr & node)
|
|
||||||
{ return tree_algorithms::count(node); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: header is the header node of the tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::next_node(const node_ptr&)
|
||||||
//!
|
static node_ptr next_node(const node_ptr & node);
|
||||||
//! <b>Effects</b>: Returns the number of nodes above the header.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Linear time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static std::size_t size(const const_node_ptr & header)
|
|
||||||
{ return tree_algorithms::size(header); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node from the tree except the header.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::prev_node(const node_ptr&)
|
||||||
//!
|
static node_ptr prev_node(const node_ptr & node);
|
||||||
//! <b>Effects</b>: Returns the next node of the tree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static node_ptr next_node(const node_ptr & p)
|
|
||||||
{ return tree_algorithms::next_node(p); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node from the tree except the leftmost node.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::init(const node_ptr&)
|
||||||
//!
|
static void init(const node_ptr & node);
|
||||||
//! <b>Effects</b>: Returns the previous node of the tree.
|
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static node_ptr prev_node(const node_ptr & p)
|
|
||||||
{ return tree_algorithms::prev_node(p); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node must not be part of any tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::init_header(const node_ptr&)
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: After the function unique(node) == true.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
|
||||||
static void init(const node_ptr & node)
|
|
||||||
{ tree_algorithms::init(node); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node must not be part of any tree.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Initializes the header to represent an empty tree.
|
|
||||||
//! unique(header) == true.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
|
||||||
static void init_header(const node_ptr & header)
|
static void init_header(const node_ptr & header)
|
||||||
{
|
{
|
||||||
tree_algorithms::init_header(header);
|
bstree_algorithms::init_header(header);
|
||||||
NodeTraits::set_color(header, NodeTraits::red());
|
NodeTraits::set_color(header, NodeTraits::red());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: header must be the header of a tree, z a node
|
//! @copydoc ::boost::intrusive::bstree_algorithms::erase(const node_ptr&,const node_ptr&)
|
||||||
//! of that tree and z != header.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Erases node "z" from the tree with header "header".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Amortized constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static node_ptr erase(const node_ptr & header, const node_ptr & z)
|
static node_ptr erase(const node_ptr & header, const node_ptr & z)
|
||||||
{
|
{
|
||||||
typename tree_algorithms::data_for_rebalance info;
|
typename bstree_algorithms::data_for_rebalance info;
|
||||||
tree_algorithms::erase(header, z, rbtree_erase_fixup(), info);
|
bstree_algorithms::erase(header, z, rbtree_erase_fixup<NodeTraits>(), info);
|
||||||
node_ptr x = info.x;
|
|
||||||
node_ptr x_parent = info.x_parent;
|
|
||||||
|
|
||||||
//Rebalance rbtree
|
//Rebalance rbtree
|
||||||
if(NodeTraits::get_color(z) != NodeTraits::red()){
|
if(NodeTraits::get_color(z) != NodeTraits::red()){
|
||||||
rebalance_after_erasure(header, x, x_parent);
|
rebalance_after_erasure(header, info.x, info.x_parent);
|
||||||
}
|
}
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "cloner" must be a function
|
//! @copydoc ::boost::intrusive::bstree_algorithms::clone(const const_node_ptr&,const node_ptr&,Cloner,Disposer)
|
||||||
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
|
|
||||||
//! take a node_ptr and shouldn't throw.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: First empties target tree calling
|
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
|
||||||
//! except the header.
|
|
||||||
//!
|
|
||||||
//! Then, duplicates the entire tree pointed by "source_header" cloning each
|
|
||||||
//! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
|
|
||||||
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
|
|
||||||
//! are disposed using <tt>void disposer(const node_ptr &)</tt>.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
|
||||||
//! number of elements of tree target tree when calling this function.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
|
||||||
template <class Cloner, class Disposer>
|
template <class Cloner, class Disposer>
|
||||||
static void clone
|
static void clone
|
||||||
(const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer)
|
(const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer)
|
||||||
{
|
{
|
||||||
rbtree_node_cloner<Cloner> new_cloner(cloner);
|
rbtree_node_cloner<NodeTraits, Cloner> new_cloner(cloner);
|
||||||
tree_algorithms::clone(source_header, target_header, new_cloner, disposer);
|
bstree_algorithms::clone(source_header, target_header, new_cloner, disposer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "disposer" must be an object function
|
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//! taking a node_ptr parameter and shouldn't throw.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::clear_and_dispose(const node_ptr&,Disposer)
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Empties the target tree calling
|
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
|
||||||
//! except the header.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
|
||||||
//! number of elements of tree target tree when calling this function.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
|
||||||
template<class Disposer>
|
template<class Disposer>
|
||||||
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
|
static void clear_and_dispose(const node_ptr & header, Disposer disposer);
|
||||||
{ tree_algorithms::clear_and_dispose(header, disposer); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::lower_bound(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns an node_ptr to the first element that is
|
|
||||||
//! not less than "key" according to "comp" or "header" if that element does
|
|
||||||
//! not exist.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr lower_bound
|
static node_ptr lower_bound
|
||||||
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
|
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp);
|
||||||
{ return tree_algorithms::lower_bound(header, key, comp); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::upper_bound(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns an node_ptr to the first element that is greater
|
|
||||||
//! than "key" according to "comp" or "header" if that element does not exist.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr upper_bound
|
static node_ptr upper_bound
|
||||||
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
|
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp);
|
||||||
{ return tree_algorithms::upper_bound(header, key, comp); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::find(const const_node_ptr&, const KeyType&,KeyNodePtrCompare)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns an node_ptr to the element that is equivalent to
|
|
||||||
//! "key" according to "comp" or "header" if that element does not exist.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr find
|
static node_ptr find
|
||||||
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
|
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp);
|
||||||
{ return tree_algorithms::find(header, key, comp); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::equal_range(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns an a pair of node_ptr delimiting a range containing
|
|
||||||
//! all elements that are equivalent to "key" according to "comp" or an
|
|
||||||
//! empty range that indicates the position where those elements would be
|
|
||||||
//! if they there are no equivalent elements.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, node_ptr> equal_range
|
static std::pair<node_ptr, node_ptr> equal_range
|
||||||
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
|
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp);
|
||||||
{ return tree_algorithms::equal_range(header, key, comp); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::bounded_range(const const_node_ptr&,const KeyType&,const KeyType&,KeyNodePtrCompare,bool,bool)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
|
|
||||||
//! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
|
|
||||||
//! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns an a pair with the following criteria:
|
|
||||||
//!
|
|
||||||
//! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
|
|
||||||
//!
|
|
||||||
//! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: This function can be more efficient than calling upper_bound
|
|
||||||
//! and lower_bound for lower_key and upper_key.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, node_ptr> bounded_range
|
static std::pair<node_ptr, node_ptr> bounded_range
|
||||||
(const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp
|
(const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp
|
||||||
, bool left_closed, bool right_closed)
|
, bool left_closed, bool right_closed);
|
||||||
{ return tree_algorithms::bounded_range(header, lower_key, upper_key, comp, left_closed, right_closed); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "h" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::count(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
|
||||||
//! NodePtrCompare is a function object that induces a strict weak
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
static std::size_t count(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp);
|
||||||
//! the tree. NodePtrCompare compares two node_ptrs.
|
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_upper_bound(const node_ptr&,const node_ptr&,NodePtrCompare)
|
||||||
//! according to "comp".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
|
||||||
//! most logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class NodePtrCompare>
|
template<class NodePtrCompare>
|
||||||
static node_ptr insert_equal_upper_bound
|
static node_ptr insert_equal_upper_bound
|
||||||
(const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp)
|
(const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp)
|
||||||
{
|
{
|
||||||
tree_algorithms::insert_equal_upper_bound(h, new_node, comp);
|
bstree_algorithms::insert_equal_upper_bound(h, new_node, comp);
|
||||||
rebalance_after_insertion(h, new_node);
|
rebalance_after_insertion(h, new_node);
|
||||||
return new_node;
|
return new_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "h" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_lower_bound(const node_ptr&,const node_ptr&,NodePtrCompare)
|
||||||
//! NodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. NodePtrCompare compares two node_ptrs.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before the lower bound
|
|
||||||
//! according to "comp".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
|
||||||
//! most logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class NodePtrCompare>
|
template<class NodePtrCompare>
|
||||||
static node_ptr insert_equal_lower_bound
|
static node_ptr insert_equal_lower_bound
|
||||||
(const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp)
|
(const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp)
|
||||||
{
|
{
|
||||||
tree_algorithms::insert_equal_lower_bound(h, new_node, comp);
|
bstree_algorithms::insert_equal_lower_bound(h, new_node, comp);
|
||||||
rebalance_after_insertion(h, new_node);
|
rebalance_after_insertion(h, new_node);
|
||||||
return new_node;
|
return new_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal(const node_ptr&,const node_ptr&,const node_ptr&,NodePtrCompare)
|
||||||
//! NodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from
|
|
||||||
//! the "header"'s tree.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree, using "hint" as a hint to
|
|
||||||
//! where it will be inserted. If "hint" is the upper_bound
|
|
||||||
//! the insertion takes constant time (two comparisons in the worst case).
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
|
|
||||||
//! constant time if new_node is inserted immediately before "hint".
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class NodePtrCompare>
|
template<class NodePtrCompare>
|
||||||
static node_ptr insert_equal
|
static node_ptr insert_equal
|
||||||
(const node_ptr & header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp)
|
(const node_ptr & header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp)
|
||||||
{
|
{
|
||||||
tree_algorithms::insert_equal(header, hint, new_node, comp);
|
bstree_algorithms::insert_equal(header, hint, new_node, comp);
|
||||||
rebalance_after_insertion(header, new_node);
|
rebalance_after_insertion(header, new_node);
|
||||||
return new_node;
|
return new_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_before(const node_ptr&,const node_ptr&,const node_ptr&)
|
||||||
//! "pos" must be a valid iterator or header (end) node.
|
|
||||||
//! "pos" must be an iterator pointing to the successor to "new_node"
|
|
||||||
//! once inserted according to the order of already inserted nodes. This function does not
|
|
||||||
//! check "pos" and this precondition must be guaranteed by the caller.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant-time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
|
|
||||||
//! tree invariants might be broken.
|
|
||||||
static node_ptr insert_before
|
static node_ptr insert_before
|
||||||
(const node_ptr & header, const node_ptr & pos, const node_ptr & new_node)
|
(const node_ptr & header, const node_ptr & pos, const node_ptr & new_node)
|
||||||
{
|
{
|
||||||
tree_algorithms::insert_before(header, pos, new_node);
|
bstree_algorithms::insert_before(header, pos, new_node);
|
||||||
rebalance_after_insertion(header, new_node);
|
rebalance_after_insertion(header, new_node);
|
||||||
return new_node;
|
return new_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::push_back(const node_ptr&,const node_ptr&)
|
||||||
//! "new_node" must be, according to the used ordering no less than the
|
|
||||||
//! greatest inserted key.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant-time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
|
|
||||||
//! tree invariants are broken. This function is slightly faster than
|
|
||||||
//! using "insert_before".
|
|
||||||
static void push_back(const node_ptr & header, const node_ptr & new_node)
|
static void push_back(const node_ptr & header, const node_ptr & new_node)
|
||||||
{
|
{
|
||||||
tree_algorithms::push_back(header, new_node);
|
bstree_algorithms::push_back(header, new_node);
|
||||||
rebalance_after_insertion(header, new_node);
|
rebalance_after_insertion(header, new_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::push_front(const node_ptr&,const node_ptr&)
|
||||||
//! "new_node" must be, according to the used ordering, no greater than the
|
|
||||||
//! lowest inserted key.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant-time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
|
|
||||||
//! tree invariants are broken. This function is slightly faster than
|
|
||||||
//! using "insert_before".
|
|
||||||
static void push_front(const node_ptr & header, const node_ptr & new_node)
|
static void push_front(const node_ptr & header, const node_ptr & new_node)
|
||||||
{
|
{
|
||||||
tree_algorithms::push_front(header, new_node);
|
bstree_algorithms::push_front(header, new_node);
|
||||||
rebalance_after_insertion(header, new_node);
|
rebalance_after_insertion(header, new_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_check(const const_node_ptr&,const KeyType&,KeyNodePtrCompare,insert_commit_data&)
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
|
||||||
//! tree according to "comp" and obtains the needed information to realize
|
|
||||||
//! a constant-time node insertion if there is no equivalent node.
|
|
||||||
//!
|
|
||||||
//! <b>Returns</b>: If there is an equivalent value
|
|
||||||
//! returns a pair containing a node_ptr to the already present node
|
|
||||||
//! and false. If there is not equivalent key can be inserted returns true
|
|
||||||
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
|
||||||
//! be used with the "insert_commit" function to achieve a constant-time
|
|
||||||
//! insertion function.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity is at most logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
//!
|
|
||||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
|
||||||
//! a node is expensive and the user does not want to have two equivalent nodes
|
|
||||||
//! in the tree: if there is an equivalent value
|
|
||||||
//! the constructed object must be discarded. Many times, the part of the
|
|
||||||
//! node that is used to impose the order is much cheaper to construct
|
|
||||||
//! than the node and this function offers the possibility to use that part
|
|
||||||
//! to check if the insertion will be successful.
|
|
||||||
//!
|
|
||||||
//! If the check is successful, the user can construct the node and use
|
|
||||||
//! "insert_commit" to insert the node in constant-time. This gives a total
|
|
||||||
//! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).
|
|
||||||
//!
|
|
||||||
//! "commit_data" remains valid for a subsequent "insert_unique_commit" only
|
|
||||||
//! if no more objects are inserted or erased from the set.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, bool> insert_unique_check
|
static std::pair<node_ptr, bool> insert_unique_check
|
||||||
(const const_node_ptr & header, const KeyType &key
|
(const const_node_ptr & header, const KeyType &key
|
||||||
,KeyNodePtrCompare comp, insert_commit_data &commit_data)
|
,KeyNodePtrCompare comp, insert_commit_data &commit_data);
|
||||||
{ return tree_algorithms::insert_unique_check(header, key, comp, commit_data); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_check(const const_node_ptr&,const node_ptr&,const KeyType&,KeyNodePtrCompare,insert_commit_data&)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
|
||||||
//! "hint" is node from the "header"'s tree.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
|
||||||
//! tree according to "comp" using "hint" as a hint to where it should be
|
|
||||||
//! inserted and obtains the needed information to realize
|
|
||||||
//! a constant-time node insertion if there is no equivalent node.
|
|
||||||
//! If "hint" is the upper_bound the function has constant time
|
|
||||||
//! complexity (two comparisons in the worst case).
|
|
||||||
//!
|
|
||||||
//! <b>Returns</b>: If there is an equivalent value
|
|
||||||
//! returns a pair containing a node_ptr to the already present node
|
|
||||||
//! and false. If there is not equivalent key can be inserted returns true
|
|
||||||
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
|
||||||
//! be used with the "insert_commit" function to achieve a constant-time
|
|
||||||
//! insertion function.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity is at most logarithmic, but it is
|
|
||||||
//! amortized constant time if new_node should be inserted immediately before "hint".
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
//!
|
|
||||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
|
||||||
//! a node is expensive and the user does not want to have two equivalent nodes
|
|
||||||
//! in the tree: if there is an equivalent value
|
|
||||||
//! the constructed object must be discarded. Many times, the part of the
|
|
||||||
//! node that is used to impose the order is much cheaper to construct
|
|
||||||
//! than the node and this function offers the possibility to use that part
|
|
||||||
//! to check if the insertion will be successful.
|
|
||||||
//!
|
|
||||||
//! If the check is successful, the user can construct the node and use
|
|
||||||
//! "insert_commit" to insert the node in constant-time. This gives a total
|
|
||||||
//! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).
|
|
||||||
//!
|
|
||||||
//! "commit_data" remains valid for a subsequent "insert_unique_commit" only
|
|
||||||
//! if no more objects are inserted or erased from the set.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, bool> insert_unique_check
|
static std::pair<node_ptr, bool> insert_unique_check
|
||||||
(const const_node_ptr & header, const node_ptr &hint, const KeyType &key
|
(const const_node_ptr & header, const node_ptr &hint, const KeyType &key
|
||||||
,KeyNodePtrCompare comp, insert_commit_data &commit_data)
|
,KeyNodePtrCompare comp, insert_commit_data &commit_data);
|
||||||
{ return tree_algorithms::insert_unique_check(header, hint, key, comp, commit_data); }
|
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_commit(const node_ptr&,const node_ptr&,const insert_commit_data&)
|
||||||
//! "commit_data" must have been obtained from a previous call to
|
|
||||||
//! "insert_unique_check". No objects should have been inserted or erased
|
|
||||||
//! from the set between the "insert_unique_check" that filled "commit_data"
|
|
||||||
//! and the call to "insert_commit".
|
|
||||||
//!
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node in the set using the information obtained
|
|
||||||
//! from the "commit_data" that a previous "insert_check" filled.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Notes</b>: This function has only sense if a "insert_unique_check" has been
|
|
||||||
//! previously executed to fill "commit_data". No value should be inserted or
|
|
||||||
//! erased between the "insert_check" and "insert_commit" calls.
|
|
||||||
static void insert_unique_commit
|
static void insert_unique_commit
|
||||||
(const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data)
|
(const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data)
|
||||||
{
|
{
|
||||||
tree_algorithms::insert_unique_commit(header, new_value, commit_data);
|
bstree_algorithms::insert_unique_commit(header, new_value, commit_data);
|
||||||
rebalance_after_insertion(header, new_value);
|
rebalance_after_insertion(header, new_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "n" must be a node inserted in a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::is_header
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static node_ptr get_header(const node_ptr & n)
|
|
||||||
{ return tree_algorithms::get_header(n); }
|
|
||||||
|
|
||||||
/// @cond
|
|
||||||
private:
|
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node of a tree.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns true if p is the header of the tree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static bool is_header(const const_node_ptr & p)
|
static bool is_header(const const_node_ptr & p)
|
||||||
{
|
{
|
||||||
return NodeTraits::get_color(p) == NodeTraits::red() &&
|
return NodeTraits::get_color(p) == NodeTraits::red() &&
|
||||||
tree_algorithms::is_header(p);
|
bstree_algorithms::is_header(p);
|
||||||
//return NodeTraits::get_color(p) == NodeTraits::red() &&
|
|
||||||
// NodeTraits::get_parent(NodeTraits::get_parent(p)) == p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @cond
|
||||||
|
private:
|
||||||
|
|
||||||
static void rebalance_after_erasure(const node_ptr & header, node_ptr x, node_ptr x_parent)
|
static void rebalance_after_erasure(const node_ptr & header, node_ptr x, node_ptr x_parent)
|
||||||
{
|
{
|
||||||
while(x != NodeTraits::get_parent(header) && (!x || NodeTraits::get_color(x) == NodeTraits::black())){
|
while(x != NodeTraits::get_parent(header) && (!x || NodeTraits::get_color(x) == NodeTraits::black())){
|
||||||
@ -814,7 +418,7 @@ class rbtree_algorithms
|
|||||||
if(NodeTraits::get_color(w) == NodeTraits::red()){
|
if(NodeTraits::get_color(w) == NodeTraits::red()){
|
||||||
NodeTraits::set_color(w, NodeTraits::black());
|
NodeTraits::set_color(w, NodeTraits::black());
|
||||||
NodeTraits::set_color(x_parent, NodeTraits::red());
|
NodeTraits::set_color(x_parent, NodeTraits::red());
|
||||||
tree_algorithms::rotate_left(x_parent, header);
|
bstree_algorithms::rotate_left(x_parent, header);
|
||||||
w = NodeTraits::get_right(x_parent);
|
w = NodeTraits::get_right(x_parent);
|
||||||
}
|
}
|
||||||
if((!NodeTraits::get_left(w) || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black()) &&
|
if((!NodeTraits::get_left(w) || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black()) &&
|
||||||
@ -827,14 +431,14 @@ class rbtree_algorithms
|
|||||||
if(!NodeTraits::get_right(w) || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black()){
|
if(!NodeTraits::get_right(w) || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black()){
|
||||||
NodeTraits::set_color(NodeTraits::get_left(w), NodeTraits::black());
|
NodeTraits::set_color(NodeTraits::get_left(w), NodeTraits::black());
|
||||||
NodeTraits::set_color(w, NodeTraits::red());
|
NodeTraits::set_color(w, NodeTraits::red());
|
||||||
tree_algorithms::rotate_right(w, header);
|
bstree_algorithms::rotate_right(w, header);
|
||||||
w = NodeTraits::get_right(x_parent);
|
w = NodeTraits::get_right(x_parent);
|
||||||
}
|
}
|
||||||
NodeTraits::set_color(w, NodeTraits::get_color(x_parent));
|
NodeTraits::set_color(w, NodeTraits::get_color(x_parent));
|
||||||
NodeTraits::set_color(x_parent, NodeTraits::black());
|
NodeTraits::set_color(x_parent, NodeTraits::black());
|
||||||
if(NodeTraits::get_right(w))
|
if(NodeTraits::get_right(w))
|
||||||
NodeTraits::set_color(NodeTraits::get_right(w), NodeTraits::black());
|
NodeTraits::set_color(NodeTraits::get_right(w), NodeTraits::black());
|
||||||
tree_algorithms::rotate_left(x_parent, header);
|
bstree_algorithms::rotate_left(x_parent, header);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -844,7 +448,7 @@ class rbtree_algorithms
|
|||||||
if(NodeTraits::get_color(w) == NodeTraits::red()){
|
if(NodeTraits::get_color(w) == NodeTraits::red()){
|
||||||
NodeTraits::set_color(w, NodeTraits::black());
|
NodeTraits::set_color(w, NodeTraits::black());
|
||||||
NodeTraits::set_color(x_parent, NodeTraits::red());
|
NodeTraits::set_color(x_parent, NodeTraits::red());
|
||||||
tree_algorithms::rotate_right(x_parent, header);
|
bstree_algorithms::rotate_right(x_parent, header);
|
||||||
w = NodeTraits::get_left(x_parent);
|
w = NodeTraits::get_left(x_parent);
|
||||||
}
|
}
|
||||||
if((!NodeTraits::get_right(w) || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black()) &&
|
if((!NodeTraits::get_right(w) || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black()) &&
|
||||||
@ -857,14 +461,14 @@ class rbtree_algorithms
|
|||||||
if(!NodeTraits::get_left(w) || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black()){
|
if(!NodeTraits::get_left(w) || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black()){
|
||||||
NodeTraits::set_color(NodeTraits::get_right(w), NodeTraits::black());
|
NodeTraits::set_color(NodeTraits::get_right(w), NodeTraits::black());
|
||||||
NodeTraits::set_color(w, NodeTraits::red());
|
NodeTraits::set_color(w, NodeTraits::red());
|
||||||
tree_algorithms::rotate_left(w, header);
|
bstree_algorithms::rotate_left(w, header);
|
||||||
w = NodeTraits::get_left(x_parent);
|
w = NodeTraits::get_left(x_parent);
|
||||||
}
|
}
|
||||||
NodeTraits::set_color(w, NodeTraits::get_color(x_parent));
|
NodeTraits::set_color(w, NodeTraits::get_color(x_parent));
|
||||||
NodeTraits::set_color(x_parent, NodeTraits::black());
|
NodeTraits::set_color(x_parent, NodeTraits::black());
|
||||||
if(NodeTraits::get_left(w))
|
if(NodeTraits::get_left(w))
|
||||||
NodeTraits::set_color(NodeTraits::get_left(w), NodeTraits::black());
|
NodeTraits::set_color(NodeTraits::get_left(w), NodeTraits::black());
|
||||||
tree_algorithms::rotate_right(x_parent, header);
|
bstree_algorithms::rotate_right(x_parent, header);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -873,14 +477,13 @@ class rbtree_algorithms
|
|||||||
NodeTraits::set_color(x, NodeTraits::black());
|
NodeTraits::set_color(x, NodeTraits::black());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void rebalance_after_insertion(const node_ptr & header, node_ptr p)
|
static void rebalance_after_insertion(const node_ptr & header, node_ptr p)
|
||||||
{
|
{
|
||||||
NodeTraits::set_color(p, NodeTraits::red());
|
NodeTraits::set_color(p, NodeTraits::red());
|
||||||
while(p != NodeTraits::get_parent(header) && NodeTraits::get_color(NodeTraits::get_parent(p)) == NodeTraits::red()){
|
while(p != NodeTraits::get_parent(header) && NodeTraits::get_color(NodeTraits::get_parent(p)) == NodeTraits::red()){
|
||||||
node_ptr p_parent(NodeTraits::get_parent(p));
|
node_ptr p_parent(NodeTraits::get_parent(p));
|
||||||
node_ptr p_parent_parent(NodeTraits::get_parent(p_parent));
|
node_ptr p_parent_parent(NodeTraits::get_parent(p_parent));
|
||||||
if(tree_algorithms::is_left_child(p_parent)){
|
if(bstree_algorithms::is_left_child(p_parent)){
|
||||||
node_ptr x = NodeTraits::get_right(p_parent_parent);
|
node_ptr x = NodeTraits::get_right(p_parent_parent);
|
||||||
if(x && NodeTraits::get_color(x) == NodeTraits::red()){
|
if(x && NodeTraits::get_color(x) == NodeTraits::red()){
|
||||||
NodeTraits::set_color(p_parent, NodeTraits::black());
|
NodeTraits::set_color(p_parent, NodeTraits::black());
|
||||||
@ -889,15 +492,15 @@ class rbtree_algorithms
|
|||||||
p = p_parent_parent;
|
p = p_parent_parent;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(!tree_algorithms::is_left_child(p)){
|
if(!bstree_algorithms::is_left_child(p)){
|
||||||
p = p_parent;
|
p = p_parent;
|
||||||
tree_algorithms::rotate_left(p, header);
|
bstree_algorithms::rotate_left(p, header);
|
||||||
}
|
}
|
||||||
node_ptr new_p_parent(NodeTraits::get_parent(p));
|
node_ptr new_p_parent(NodeTraits::get_parent(p));
|
||||||
node_ptr new_p_parent_parent(NodeTraits::get_parent(new_p_parent));
|
node_ptr new_p_parent_parent(NodeTraits::get_parent(new_p_parent));
|
||||||
NodeTraits::set_color(new_p_parent, NodeTraits::black());
|
NodeTraits::set_color(new_p_parent, NodeTraits::black());
|
||||||
NodeTraits::set_color(new_p_parent_parent, NodeTraits::red());
|
NodeTraits::set_color(new_p_parent_parent, NodeTraits::red());
|
||||||
tree_algorithms::rotate_right(new_p_parent_parent, header);
|
bstree_algorithms::rotate_right(new_p_parent_parent, header);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -909,15 +512,15 @@ class rbtree_algorithms
|
|||||||
p = p_parent_parent;
|
p = p_parent_parent;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(tree_algorithms::is_left_child(p)){
|
if(bstree_algorithms::is_left_child(p)){
|
||||||
p = p_parent;
|
p = p_parent;
|
||||||
tree_algorithms::rotate_right(p, header);
|
bstree_algorithms::rotate_right(p, header);
|
||||||
}
|
}
|
||||||
node_ptr new_p_parent(NodeTraits::get_parent(p));
|
node_ptr new_p_parent(NodeTraits::get_parent(p));
|
||||||
node_ptr new_p_parent_parent(NodeTraits::get_parent(new_p_parent));
|
node_ptr new_p_parent_parent(NodeTraits::get_parent(new_p_parent));
|
||||||
NodeTraits::set_color(new_p_parent, NodeTraits::black());
|
NodeTraits::set_color(new_p_parent, NodeTraits::black());
|
||||||
NodeTraits::set_color(new_p_parent_parent, NodeTraits::red());
|
NodeTraits::set_color(new_p_parent_parent, NodeTraits::red());
|
||||||
tree_algorithms::rotate_left(new_p_parent_parent, header);
|
bstree_algorithms::rotate_left(new_p_parent_parent, header);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -926,6 +529,16 @@ class rbtree_algorithms
|
|||||||
/// @endcond
|
/// @endcond
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// @cond
|
||||||
|
|
||||||
|
template<class NodeTraits>
|
||||||
|
struct get_algo<RbTreeAlgorithms, NodeTraits>
|
||||||
|
{
|
||||||
|
typedef rbtree_algorithms<NodeTraits> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// @endcond
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -38,7 +38,7 @@ struct get_set_node_algo
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
|
template<class O1 = void, class O2 = void, class O3 = void, class O4 = void>
|
||||||
#endif
|
#endif
|
||||||
struct make_set_base_hook
|
struct make_set_base_hook
|
||||||
{
|
{
|
||||||
@ -52,12 +52,12 @@ struct make_set_base_hook
|
|||||||
#endif
|
#endif
|
||||||
>::type packed_options;
|
>::type packed_options;
|
||||||
|
|
||||||
typedef detail::generic_hook
|
typedef generic_hook
|
||||||
< get_set_node_algo<typename packed_options::void_pointer
|
< get_set_node_algo<typename packed_options::void_pointer
|
||||||
,packed_options::optimize_size>
|
,packed_options::optimize_size>
|
||||||
, typename packed_options::tag
|
, typename packed_options::tag
|
||||||
, packed_options::link_mode
|
, packed_options::link_mode
|
||||||
, detail::SetBaseHook
|
, RbTreeBaseHookId
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
@ -170,7 +170,7 @@ class set_base_hook
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
|
template<class O1 = void, class O2 = void, class O3 = void, class O4 = void>
|
||||||
#endif
|
#endif
|
||||||
struct make_set_member_hook
|
struct make_set_member_hook
|
||||||
{
|
{
|
||||||
@ -184,12 +184,12 @@ struct make_set_member_hook
|
|||||||
#endif
|
#endif
|
||||||
>::type packed_options;
|
>::type packed_options;
|
||||||
|
|
||||||
typedef detail::generic_hook
|
typedef generic_hook
|
||||||
< get_set_node_algo<typename packed_options::void_pointer
|
< get_set_node_algo<typename packed_options::void_pointer
|
||||||
,packed_options::optimize_size>
|
,packed_options::optimize_size>
|
||||||
, member_tag
|
, member_tag
|
||||||
, packed_options::link_mode
|
, packed_options::link_mode
|
||||||
, detail::NoBaseHook
|
, NoBaseHookId
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Ion Gaztanaga 2007-2012
|
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -23,7 +23,7 @@
|
|||||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||||
#include <boost/intrusive/detail/assert.hpp>
|
#include <boost/intrusive/detail/assert.hpp>
|
||||||
#include <boost/intrusive/detail/utilities.hpp>
|
#include <boost/intrusive/detail/utilities.hpp>
|
||||||
#include <boost/intrusive/detail/tree_algorithms.hpp>
|
#include <boost/intrusive/bstree_algorithms.hpp>
|
||||||
#include <boost/intrusive/pointer_traits.hpp>
|
#include <boost/intrusive/pointer_traits.hpp>
|
||||||
|
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ namespace intrusive {
|
|||||||
//!
|
//!
|
||||||
//! <b>Typedefs</b>:
|
//! <b>Typedefs</b>:
|
||||||
//!
|
//!
|
||||||
//! <tt>node</tt>: The type of the node that forms the circular list
|
//! <tt>node</tt>: The type of the node that forms the binary search tree
|
||||||
//!
|
//!
|
||||||
//! <tt>node_ptr</tt>: A pointer to a node
|
//! <tt>node_ptr</tt>: A pointer to a node
|
||||||
//!
|
//!
|
||||||
@ -57,6 +57,9 @@ namespace intrusive {
|
|||||||
//! <tt>static void set_right(node_ptr n, node_ptr right);</tt>
|
//! <tt>static void set_right(node_ptr n, node_ptr right);</tt>
|
||||||
template<class NodeTraits>
|
template<class NodeTraits>
|
||||||
class sgtree_algorithms
|
class sgtree_algorithms
|
||||||
|
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
: public bstree_algorithms<NodeTraits>
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename NodeTraits::node node;
|
typedef typename NodeTraits::node node;
|
||||||
@ -67,490 +70,194 @@ class sgtree_algorithms
|
|||||||
/// @cond
|
/// @cond
|
||||||
private:
|
private:
|
||||||
|
|
||||||
typedef detail::tree_algorithms<NodeTraits> tree_algorithms;
|
typedef bstree_algorithms<NodeTraits> bstree_algorithms;
|
||||||
|
|
||||||
static node_ptr uncast(const const_node_ptr & ptr)
|
|
||||||
{ return pointer_traits<node_ptr>::const_cast_from(ptr); }
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static node_ptr begin_node(const const_node_ptr & header)
|
|
||||||
{ return tree_algorithms::begin_node(header); }
|
|
||||||
|
|
||||||
static node_ptr end_node(const const_node_ptr & header)
|
|
||||||
{ return tree_algorithms::end_node(header); }
|
|
||||||
|
|
||||||
//! This type is the information that will be
|
//! This type is the information that will be
|
||||||
//! filled by insert_unique_check
|
//! filled by insert_unique_check
|
||||||
struct insert_commit_data
|
struct insert_commit_data
|
||||||
: tree_algorithms::insert_commit_data
|
: bstree_algorithms::insert_commit_data
|
||||||
{
|
{
|
||||||
std::size_t depth;
|
std::size_t depth;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! <b>Requires</b>: header1 and header2 must be the header nodes
|
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//! of two trees.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::get_header(const const_node_ptr&)
|
||||||
//!
|
static node_ptr get_header(const const_node_ptr & n);
|
||||||
//! <b>Effects</b>: Swaps two trees. After the function header1 will contain
|
|
||||||
//! links to the second tree and header2 will have links to the first tree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static void swap_tree(const node_ptr & header1, const node_ptr & header2)
|
|
||||||
{ return tree_algorithms::swap_tree(header1, header2); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! @copydoc ::boost::intrusive::bstree_algorithms::begin_node
|
||||||
//! of two trees.
|
static node_ptr begin_node(const const_node_ptr & header);
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
|
||||||
//! position node1 had before the function.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
|
||||||
//!
|
|
||||||
//!Experimental function
|
|
||||||
static void swap_nodes(const node_ptr & node1, const node_ptr & node2)
|
|
||||||
{
|
|
||||||
if(node1 == node2)
|
|
||||||
return;
|
|
||||||
|
|
||||||
node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2));
|
//! @copydoc ::boost::intrusive::bstree_algorithms::end_node
|
||||||
swap_nodes(node1, header1, node2, header2);
|
static node_ptr end_node(const const_node_ptr & header);
|
||||||
}
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node1 and node2 can't be header nodes
|
//! @copydoc ::boost::intrusive::bstree_algorithms::swap_tree
|
||||||
//! of two trees with header header1 and header2.
|
static void swap_tree(const node_ptr & header1, const node_ptr & header2);
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Swaps two nodes. After the function node1 will be inserted
|
|
||||||
//! in the position node2 before the function. node2 will be inserted in the
|
|
||||||
//! position node1 had before the function.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
|
||||||
//! node1 and node2 are not equivalent according to the ordering rules.
|
|
||||||
//!
|
|
||||||
//!Experimental function
|
|
||||||
static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2)
|
|
||||||
{ tree_algorithms::swap_nodes(node1, header1, node2, header2); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&)
|
||||||
//! and new_node must not be inserted in a tree.
|
static void swap_nodes(const node_ptr & node1, const node_ptr & node2);
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
|
||||||
//! the node, since no rebalancing and comparison is needed.
|
|
||||||
//!
|
|
||||||
//!Experimental function
|
|
||||||
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node)
|
|
||||||
{
|
|
||||||
if(node_to_be_replaced == new_node)
|
|
||||||
return;
|
|
||||||
replace_node(node_to_be_replaced, tree_algorithms::get_header(node_to_be_replaced), new_node);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node_to_be_replaced must be inserted in a tree
|
//! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&,const node_ptr&,const node_ptr&)
|
||||||
//! with header "header" and new_node must not be inserted in a tree.
|
static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2);
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Replaces node_to_be_replaced in its position in the
|
|
||||||
//! tree with new_node. The tree does not need to be rebalanced
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: This function will break container ordering invariants if
|
|
||||||
//! new_node is not equivalent to node_to_be_replaced according to the
|
|
||||||
//! ordering rules. This function is faster than erasing and inserting
|
|
||||||
//! the node, since no rebalancing or comparison is needed.
|
|
||||||
//!
|
|
||||||
//!Experimental function
|
|
||||||
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node)
|
|
||||||
{ tree_algorithms::replace_node(node_to_be_replaced, header, new_node); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a tree node but not the header.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&)
|
||||||
//!
|
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node);
|
||||||
//! <b>Effects</b>: Unlinks the node and rebalances the tree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity is constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static void unlink(const node_ptr & node)
|
|
||||||
{
|
|
||||||
node_ptr x = NodeTraits::get_parent(node);
|
|
||||||
if(x){
|
|
||||||
while(!is_header(x))
|
|
||||||
x = NodeTraits::get_parent(x);
|
|
||||||
tree_algorithms::erase(x, node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//! <b>Requires</b>: header is the header of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&,const node_ptr&)
|
||||||
//!
|
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node);
|
||||||
//! <b>Effects</b>: Unlinks the leftmost node from the tree, and
|
|
||||||
//! updates the header link to the new leftmost node.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity is constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Notes</b>: This function breaks the tree and the tree can
|
|
||||||
//! only be used for more unlink_leftmost_without_rebalance calls.
|
|
||||||
//! This function is normally used to achieve a step by step
|
|
||||||
//! controlled destruction of the tree.
|
|
||||||
static node_ptr unlink_leftmost_without_rebalance(const node_ptr & header)
|
|
||||||
{ return tree_algorithms::unlink_leftmost_without_rebalance(header); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree or an node initialized
|
//Unlink is not possible since tree metadata is needed to update the tree
|
||||||
//! by init(...).
|
//!static void unlink(const node_ptr & node);
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns true if the node is initialized by init().
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static bool unique(const const_node_ptr & node)
|
|
||||||
{ return tree_algorithms::unique(node); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node is a node of the tree but it's not the header.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::unlink_leftmost_without_rebalance
|
||||||
//!
|
static node_ptr unlink_leftmost_without_rebalance(const node_ptr & header);
|
||||||
//! <b>Effects</b>: Returns the number of nodes of the subtree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Linear time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static std::size_t count(const const_node_ptr & node)
|
|
||||||
{ return tree_algorithms::count(node); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: header is the header node of the tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::unique(const const_node_ptr&)
|
||||||
//!
|
static bool unique(const const_node_ptr & node);
|
||||||
//! <b>Effects</b>: Returns the number of nodes above the header.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Linear time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static std::size_t size(const const_node_ptr & header)
|
|
||||||
{ return tree_algorithms::size(header); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node from the tree except the header.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::size(const const_node_ptr&)
|
||||||
//!
|
static std::size_t size(const const_node_ptr & header);
|
||||||
//! <b>Effects</b>: Returns the next node of the tree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static node_ptr next_node(const node_ptr & p)
|
|
||||||
{ return tree_algorithms::next_node(p); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node from the tree except the leftmost node.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::next_node(const node_ptr&)
|
||||||
//!
|
static node_ptr next_node(const node_ptr & node);
|
||||||
//! <b>Effects</b>: Returns the previous node of the tree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static node_ptr prev_node(const node_ptr & p)
|
|
||||||
{ return tree_algorithms::prev_node(p); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node must not be part of any tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::prev_node(const node_ptr&)
|
||||||
//!
|
static node_ptr prev_node(const node_ptr & node);
|
||||||
//! <b>Effects</b>: After the function unique(node) == true.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
|
||||||
static void init(const node_ptr & node)
|
|
||||||
{ tree_algorithms::init(node); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: node must not be part of any tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::init(const node_ptr&)
|
||||||
//!
|
static void init(const node_ptr & node);
|
||||||
//! <b>Effects</b>: Initializes the header to represent an empty tree.
|
|
||||||
//! unique(header) == true.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
|
|
||||||
static void init_header(const node_ptr & header)
|
|
||||||
{ tree_algorithms::init_header(header); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: header must be the header of a tree, z a node
|
//! @copydoc ::boost::intrusive::bstree_algorithms::init_header(const node_ptr&)
|
||||||
//! of that tree and z != header.
|
static void init_header(const node_ptr & header);
|
||||||
//!
|
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//! <b>Effects</b>: Erases node "z" from the tree with header "header".
|
|
||||||
//!
|
//! @copydoc ::boost::intrusive::bstree_algorithms::erase(const node_ptr&,const node_ptr&)
|
||||||
//! <b>Complexity</b>: Amortized constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
template<class AlphaByMaxSize>
|
template<class AlphaByMaxSize>
|
||||||
static node_ptr erase(const node_ptr & header, const node_ptr & z, std::size_t tree_size, std::size_t &max_tree_size, AlphaByMaxSize alpha_by_maxsize)
|
static node_ptr erase(const node_ptr & header, const node_ptr & z, std::size_t tree_size, std::size_t &max_tree_size, AlphaByMaxSize alpha_by_maxsize)
|
||||||
{
|
{
|
||||||
//typename tree_algorithms::data_for_rebalance info;
|
//typename bstree_algorithms::data_for_rebalance info;
|
||||||
tree_algorithms::erase(header, z);
|
bstree_algorithms::erase(header, z);
|
||||||
--tree_size;
|
--tree_size;
|
||||||
if (tree_size > 0 &&
|
if (tree_size > 0 &&
|
||||||
tree_size < alpha_by_maxsize(max_tree_size)){
|
tree_size < alpha_by_maxsize(max_tree_size)){
|
||||||
tree_algorithms::rebalance(header);
|
bstree_algorithms::rebalance(header);
|
||||||
max_tree_size = tree_size;
|
max_tree_size = tree_size;
|
||||||
}
|
}
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "cloner" must be a function
|
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//! object taking a node_ptr and returning a new cloned node of it. "disposer" must
|
//! @copydoc ::boost::intrusive::bstree_algorithms::clone(const const_node_ptr&,const node_ptr&,Cloner,Disposer)
|
||||||
//! take a node_ptr and shouldn't throw.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: First empties target tree calling
|
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
|
||||||
//! except the header.
|
|
||||||
//!
|
|
||||||
//! Then, duplicates the entire tree pointed by "source_header" cloning each
|
|
||||||
//! source node with <tt>node_ptr Cloner::operator()(const node_ptr &)</tt> to obtain
|
|
||||||
//! the nodes of the target tree. If "cloner" throws, the cloned target nodes
|
|
||||||
//! are disposed using <tt>void disposer(const node_ptr &)</tt>.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
|
||||||
//! number of elements of tree target tree when calling this function.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
|
||||||
template <class Cloner, class Disposer>
|
template <class Cloner, class Disposer>
|
||||||
static void clone
|
static void clone
|
||||||
(const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer)
|
(const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer);
|
||||||
{
|
|
||||||
tree_algorithms::clone(source_header, target_header, cloner, disposer);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "disposer" must be an object function
|
//! @copydoc ::boost::intrusive::bstree_algorithms::clear_and_dispose(const node_ptr&,Disposer)
|
||||||
//! taking a node_ptr parameter and shouldn't throw.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Empties the target tree calling
|
|
||||||
//! <tt>void disposer::operator()(const node_ptr &)</tt> for every node of the tree
|
|
||||||
//! except the header.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Linear to the number of element of the source tree plus the.
|
|
||||||
//! number of elements of tree target tree when calling this function.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If cloner functor throws. If this happens target nodes are disposed.
|
|
||||||
template<class Disposer>
|
template<class Disposer>
|
||||||
static void clear_and_dispose(const node_ptr & header, Disposer disposer)
|
static void clear_and_dispose(const node_ptr & header, Disposer disposer);
|
||||||
{ tree_algorithms::clear_and_dispose(header, disposer); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::lower_bound(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns an node_ptr to the first element that is
|
|
||||||
//! not less than "key" according to "comp" or "header" if that element does
|
|
||||||
//! not exist.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr lower_bound
|
static node_ptr lower_bound
|
||||||
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
|
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp);
|
||||||
{ return tree_algorithms::lower_bound(header, key, comp); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::upper_bound(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns an node_ptr to the first element that is greater
|
|
||||||
//! than "key" according to "comp" or "header" if that element does not exist.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr upper_bound
|
static node_ptr upper_bound
|
||||||
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
|
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp);
|
||||||
{ return tree_algorithms::upper_bound(header, key, comp); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::find(const const_node_ptr&, const KeyType&,KeyNodePtrCompare)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns an node_ptr to the element that is equivalent to
|
|
||||||
//! "key" according to "comp" or "header" if that element does not exist.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static node_ptr find
|
static node_ptr find
|
||||||
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
|
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp);
|
||||||
{ return tree_algorithms::find(header, key, comp); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::equal_range(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns an a pair of node_ptr delimiting a range containing
|
|
||||||
//! all elements that are equivalent to "key" according to "comp" or an
|
|
||||||
//! empty range that indicates the position where those elements would be
|
|
||||||
//! if they there are no equivalent elements.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, node_ptr> equal_range
|
static std::pair<node_ptr, node_ptr> equal_range
|
||||||
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
|
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp);
|
||||||
{ return tree_algorithms::equal_range(header, key, comp); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::bounded_range(const const_node_ptr&,const KeyType&,const KeyType&,KeyNodePtrCompare,bool,bool)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.
|
|
||||||
//! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If
|
|
||||||
//! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns an a pair with the following criteria:
|
|
||||||
//!
|
|
||||||
//! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise
|
|
||||||
//!
|
|
||||||
//! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: This function can be more efficient than calling upper_bound
|
|
||||||
//! and lower_bound for lower_key and upper_key.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, node_ptr> bounded_range
|
static std::pair<node_ptr, node_ptr> bounded_range
|
||||||
(const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp
|
(const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp
|
||||||
, bool left_closed, bool right_closed)
|
, bool left_closed, bool right_closed);
|
||||||
{ return tree_algorithms::bounded_range(header, lower_key, upper_key, comp, left_closed, right_closed); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "h" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::count(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
|
||||||
//! NodePtrCompare is a function object that induces a strict weak
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
static std::size_t count(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp);
|
||||||
//! the tree. NodePtrCompare compares two node_ptrs.
|
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before the upper bound
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_upper_bound(const node_ptr&,const node_ptr&,NodePtrCompare)
|
||||||
//! according to "comp".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
|
||||||
//! most logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class NodePtrCompare, class H_Alpha>
|
template<class NodePtrCompare, class H_Alpha>
|
||||||
static node_ptr insert_equal_upper_bound
|
static node_ptr insert_equal_upper_bound
|
||||||
(const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp
|
(const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp
|
||||||
,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
|
,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
|
||||||
{
|
{
|
||||||
std::size_t depth;
|
std::size_t depth;
|
||||||
tree_algorithms::insert_equal_upper_bound(h, new_node, comp, &depth);
|
bstree_algorithms::insert_equal_upper_bound(h, new_node, comp, &depth);
|
||||||
rebalance_after_insertion(new_node, depth, tree_size+1, h_alpha, max_tree_size);
|
rebalance_after_insertion(new_node, depth, tree_size+1, h_alpha, max_tree_size);
|
||||||
return new_node;
|
return new_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "h" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_lower_bound(const node_ptr&,const node_ptr&,NodePtrCompare)
|
||||||
//! NodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. NodePtrCompare compares two node_ptrs.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before the lower bound
|
|
||||||
//! according to "comp".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity for insert element is at
|
|
||||||
//! most logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class NodePtrCompare, class H_Alpha>
|
template<class NodePtrCompare, class H_Alpha>
|
||||||
static node_ptr insert_equal_lower_bound
|
static node_ptr insert_equal_lower_bound
|
||||||
(const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp
|
(const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp
|
||||||
,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
|
,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
|
||||||
{
|
{
|
||||||
std::size_t depth;
|
std::size_t depth;
|
||||||
tree_algorithms::insert_equal_lower_bound(h, new_node, comp, &depth);
|
bstree_algorithms::insert_equal_lower_bound(h, new_node, comp, &depth);
|
||||||
rebalance_after_insertion(new_node, depth, tree_size+1, h_alpha, max_tree_size);
|
rebalance_after_insertion(new_node, depth, tree_size+1, h_alpha, max_tree_size);
|
||||||
return new_node;
|
return new_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal(const node_ptr&,const node_ptr&,const node_ptr&,NodePtrCompare)
|
||||||
//! NodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from
|
|
||||||
//! the "header"'s tree.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree, using "hint" as a hint to
|
|
||||||
//! where it will be inserted. If "hint" is the upper_bound
|
|
||||||
//! the insertion takes constant time (two comparisons in the worst case).
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic in general, but it is amortized
|
|
||||||
//! constant time if new_node is inserted immediately before "hint".
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
template<class NodePtrCompare, class H_Alpha>
|
template<class NodePtrCompare, class H_Alpha>
|
||||||
static node_ptr insert_equal
|
static node_ptr insert_equal
|
||||||
(const node_ptr & header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp
|
(const node_ptr & header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp
|
||||||
,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
|
,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
|
||||||
{
|
{
|
||||||
std::size_t depth;
|
std::size_t depth;
|
||||||
tree_algorithms::insert_equal(header, hint, new_node, comp, &depth);
|
bstree_algorithms::insert_equal(header, hint, new_node, comp, &depth);
|
||||||
rebalance_after_insertion(new_node, depth, tree_size+1, h_alpha, max_tree_size);
|
rebalance_after_insertion(new_node, depth, tree_size+1, h_alpha, max_tree_size);
|
||||||
return new_node;
|
return new_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_before(const node_ptr&,const node_ptr&,const node_ptr&)
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
template<class H_Alpha>
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
static node_ptr insert_before
|
||||||
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
(const node_ptr & header, const node_ptr & pos, const node_ptr & new_node
|
||||||
//!
|
,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
|
||||||
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
{
|
||||||
//! tree according to "comp" and obtains the needed information to realize
|
std::size_t depth;
|
||||||
//! a constant-time node insertion if there is no equivalent node.
|
bstree_algorithms::insert_before(header, pos, new_node, &depth);
|
||||||
//!
|
rebalance_after_insertion(new_node, depth, tree_size+1, h_alpha, max_tree_size);
|
||||||
//! <b>Returns</b>: If there is an equivalent value
|
return new_node;
|
||||||
//! returns a pair containing a node_ptr to the already present node
|
}
|
||||||
//! and false. If there is not equivalent key can be inserted returns true
|
|
||||||
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
//! @copydoc ::boost::intrusive::bstree_algorithms::push_back(const node_ptr&,const node_ptr&)
|
||||||
//! be used with the "insert_commit" function to achieve a constant-time
|
template<class H_Alpha>
|
||||||
//! insertion function.
|
static void push_back(const node_ptr & header, const node_ptr & new_node
|
||||||
//!
|
,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
|
||||||
//! <b>Complexity</b>: Average complexity is at most logarithmic.
|
{
|
||||||
//!
|
std::size_t depth;
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
bstree_algorithms::push_back(header, new_node, &depth);
|
||||||
//!
|
rebalance_after_insertion(new_node, depth, tree_size+1, h_alpha, max_tree_size);
|
||||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
}
|
||||||
//! a node is expensive and the user does not want to have two equivalent nodes
|
|
||||||
//! in the tree: if there is an equivalent value
|
//! @copydoc ::boost::intrusive::bstree_algorithms::push_front(const node_ptr&,const node_ptr&)
|
||||||
//! the constructed object must be discarded. Many times, the part of the
|
template<class H_Alpha>
|
||||||
//! node that is used to impose the order is much cheaper to construct
|
static void push_front(const node_ptr & header, const node_ptr & new_node
|
||||||
//! than the node and this function offers the possibility to use that part
|
,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
|
||||||
//! to check if the insertion will be successful.
|
{
|
||||||
//!
|
std::size_t depth;
|
||||||
//! If the check is successful, the user can construct the node and use
|
bstree_algorithms::push_front(header, new_node, &depth);
|
||||||
//! "insert_commit" to insert the node in constant-time. This gives a total
|
rebalance_after_insertion(new_node, depth, tree_size+1, h_alpha, max_tree_size);
|
||||||
//! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).
|
}
|
||||||
//!
|
|
||||||
//! "commit_data" remains valid for a subsequent "insert_unique_commit" only
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_check(const const_node_ptr&,const KeyType&,KeyNodePtrCompare,insert_commit_data&)
|
||||||
//! if no more objects are inserted or erased from the set.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, bool> insert_unique_check
|
static std::pair<node_ptr, bool> insert_unique_check
|
||||||
(const const_node_ptr & header, const KeyType &key
|
(const const_node_ptr & header, const KeyType &key
|
||||||
@ -558,120 +265,12 @@ class sgtree_algorithms
|
|||||||
{
|
{
|
||||||
std::size_t depth;
|
std::size_t depth;
|
||||||
std::pair<node_ptr, bool> ret =
|
std::pair<node_ptr, bool> ret =
|
||||||
tree_algorithms::insert_unique_check(header, key, comp, commit_data, &depth);
|
bstree_algorithms::insert_unique_check(header, key, comp, commit_data, &depth);
|
||||||
commit_data.depth = depth;
|
commit_data.depth = depth;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_check(const const_node_ptr&,const node_ptr&,const KeyType&,KeyNodePtrCompare,insert_commit_data&)
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
|
||||||
//! "pos" must be a valid iterator or header (end) node.
|
|
||||||
//! "pos" must be an iterator pointing to the successor to "new_node"
|
|
||||||
//! once inserted according to the order of already inserted nodes. This function does not
|
|
||||||
//! check "pos" and this precondition must be guaranteed by the caller.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant-time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: If "pos" is not the successor of the newly inserted "new_node"
|
|
||||||
//! tree invariants might be broken.
|
|
||||||
template<class H_Alpha>
|
|
||||||
static node_ptr insert_before
|
|
||||||
(const node_ptr & header, const node_ptr & pos, const node_ptr & new_node
|
|
||||||
,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
|
|
||||||
{
|
|
||||||
std::size_t depth;
|
|
||||||
tree_algorithms::insert_before(header, pos, new_node, &depth);
|
|
||||||
rebalance_after_insertion(new_node, depth, tree_size+1, h_alpha, max_tree_size);
|
|
||||||
return new_node;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
|
||||||
//! "new_node" must be, according to the used ordering no less than the
|
|
||||||
//! greatest inserted key.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant-time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: If "new_node" is less than the greatest inserted key
|
|
||||||
//! tree invariants are broken. This function is slightly faster than
|
|
||||||
//! using "insert_before".
|
|
||||||
template<class H_Alpha>
|
|
||||||
static void push_back(const node_ptr & header, const node_ptr & new_node
|
|
||||||
,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
|
|
||||||
{
|
|
||||||
std::size_t depth;
|
|
||||||
tree_algorithms::push_back(header, new_node, &depth);
|
|
||||||
rebalance_after_insertion(new_node, depth, tree_size+1, h_alpha, max_tree_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
|
||||||
//! "new_node" must be, according to the used ordering, no greater than the
|
|
||||||
//! lowest inserted key.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node into the tree before "pos".
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant-time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Note</b>: If "new_node" is greater than the lowest inserted key
|
|
||||||
//! tree invariants are broken. This function is slightly faster than
|
|
||||||
//! using "insert_before".
|
|
||||||
template<class H_Alpha>
|
|
||||||
static void push_front(const node_ptr & header, const node_ptr & new_node
|
|
||||||
,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
|
|
||||||
{
|
|
||||||
std::size_t depth;
|
|
||||||
tree_algorithms::push_front(header, new_node, &depth);
|
|
||||||
rebalance_after_insertion(new_node, depth, tree_size+1, h_alpha, max_tree_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
|
||||||
//! KeyNodePtrCompare is a function object that induces a strict weak
|
|
||||||
//! ordering compatible with the strict weak ordering used to create the
|
|
||||||
//! the tree. NodePtrCompare compares KeyType with a node_ptr.
|
|
||||||
//! "hint" is node from the "header"'s tree.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Checks if there is an equivalent node to "key" in the
|
|
||||||
//! tree according to "comp" using "hint" as a hint to where it should be
|
|
||||||
//! inserted and obtains the needed information to realize
|
|
||||||
//! a constant-time node insertion if there is no equivalent node.
|
|
||||||
//! If "hint" is the upper_bound the function has constant time
|
|
||||||
//! complexity (two comparisons in the worst case).
|
|
||||||
//!
|
|
||||||
//! <b>Returns</b>: If there is an equivalent value
|
|
||||||
//! returns a pair containing a node_ptr to the already present node
|
|
||||||
//! and false. If there is not equivalent key can be inserted returns true
|
|
||||||
//! in the returned pair's boolean and fills "commit_data" that is meant to
|
|
||||||
//! be used with the "insert_commit" function to achieve a constant-time
|
|
||||||
//! insertion function.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Average complexity is at most logarithmic, but it is
|
|
||||||
//! amortized constant time if new_node should be inserted immediately before "hint".
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: If "comp" throws.
|
|
||||||
//!
|
|
||||||
//! <b>Notes</b>: This function is used to improve performance when constructing
|
|
||||||
//! a node is expensive and the user does not want to have two equivalent nodes
|
|
||||||
//! in the tree: if there is an equivalent value
|
|
||||||
//! the constructed object must be discarded. Many times, the part of the
|
|
||||||
//! node that is used to impose the order is much cheaper to construct
|
|
||||||
//! than the node and this function offers the possibility to use that part
|
|
||||||
//! to check if the insertion will be successful.
|
|
||||||
//!
|
|
||||||
//! If the check is successful, the user can construct the node and use
|
|
||||||
//! "insert_commit" to insert the node in constant-time. This gives a total
|
|
||||||
//! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).
|
|
||||||
//!
|
|
||||||
//! "commit_data" remains valid for a subsequent "insert_unique_commit" only
|
|
||||||
//! if no more objects are inserted or erased from the set.
|
|
||||||
template<class KeyType, class KeyNodePtrCompare>
|
template<class KeyType, class KeyNodePtrCompare>
|
||||||
static std::pair<node_ptr, bool> insert_unique_check
|
static std::pair<node_ptr, bool> insert_unique_check
|
||||||
(const const_node_ptr & header, const node_ptr &hint, const KeyType &key
|
(const const_node_ptr & header, const node_ptr &hint, const KeyType &key
|
||||||
@ -679,83 +278,36 @@ class sgtree_algorithms
|
|||||||
{
|
{
|
||||||
std::size_t depth;
|
std::size_t depth;
|
||||||
std::pair<node_ptr, bool> ret =
|
std::pair<node_ptr, bool> ret =
|
||||||
tree_algorithms::insert_unique_check
|
bstree_algorithms::insert_unique_check
|
||||||
(header, hint, key, comp, commit_data, &depth);
|
(header, hint, key, comp, commit_data, &depth);
|
||||||
commit_data.depth = depth;
|
commit_data.depth = depth;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: "header" must be the header node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_commit(const node_ptr&,const node_ptr&,const insert_commit_data&)
|
||||||
//! "commit_data" must have been obtained from a previous call to
|
|
||||||
//! "insert_unique_check". No objects should have been inserted or erased
|
|
||||||
//! from the set between the "insert_unique_check" that filled "commit_data"
|
|
||||||
//! and the call to "insert_commit".
|
|
||||||
//!
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Inserts new_node in the set using the information obtained
|
|
||||||
//! from the "commit_data" that a previous "insert_check" filled.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant time.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Notes</b>: This function has only sense if a "insert_unique_check" has been
|
|
||||||
//! previously executed to fill "commit_data". No value should be inserted or
|
|
||||||
//! erased between the "insert_check" and "insert_commit" calls.
|
|
||||||
template<class H_Alpha>
|
template<class H_Alpha>
|
||||||
static void insert_unique_commit
|
static void insert_unique_commit
|
||||||
(const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data
|
(const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data
|
||||||
,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
|
,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
|
||||||
{
|
{
|
||||||
tree_algorithms::insert_unique_commit(header, new_value, commit_data);
|
bstree_algorithms::insert_unique_commit(header, new_value, commit_data);
|
||||||
rebalance_after_insertion(new_value, commit_data.depth, tree_size+1, h_alpha, max_tree_size);
|
rebalance_after_insertion(new_value, commit_data.depth, tree_size+1, h_alpha, max_tree_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: header must be the header of a tree.
|
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
//!
|
//! @copydoc ::boost::intrusive::bstree_algorithms::is_header
|
||||||
//! <b>Effects</b>: Rebalances the tree.
|
static bool is_header(const const_node_ptr & p);
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Linear.
|
|
||||||
static void rebalance(const node_ptr & header)
|
|
||||||
{ tree_algorithms::rebalance(header); }
|
|
||||||
|
|
||||||
//! <b>Requires</b>: old_root is a node of a tree.
|
//! @copydoc ::boost::intrusive::bstree_algorithms::is_header
|
||||||
//!
|
static void rebalance(const node_ptr & header);
|
||||||
//! <b>Effects</b>: Rebalances the subtree rooted at old_root.
|
|
||||||
//!
|
//! @copydoc ::boost::intrusive::bstree_algorithms::rebalance_subtree
|
||||||
//! <b>Returns</b>: The new root of the subtree.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Linear.
|
|
||||||
static node_ptr rebalance_subtree(const node_ptr & old_root)
|
static node_ptr rebalance_subtree(const node_ptr & old_root)
|
||||||
{ return tree_algorithms::rebalance_subtree(old_root); }
|
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||||
|
|
||||||
//! <b>Requires</b>: "n" must be a node inserted in a tree.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns a pointer to the header node of the tree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Logarithmic.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static node_ptr get_header(const node_ptr & n)
|
|
||||||
{ return tree_algorithms::get_header(n); }
|
|
||||||
|
|
||||||
/// @cond
|
/// @cond
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//! <b>Requires</b>: p is a node of a tree.
|
|
||||||
//!
|
|
||||||
//! <b>Effects</b>: Returns true if p is the header of the tree.
|
|
||||||
//!
|
|
||||||
//! <b>Complexity</b>: Constant.
|
|
||||||
//!
|
|
||||||
//! <b>Throws</b>: Nothing.
|
|
||||||
static bool is_header(const const_node_ptr & p)
|
|
||||||
{ return tree_algorithms::is_header(p); }
|
|
||||||
|
|
||||||
template<class H_Alpha>
|
template<class H_Alpha>
|
||||||
static void rebalance_after_insertion
|
static void rebalance_after_insertion
|
||||||
(const node_ptr &x, std::size_t depth
|
(const node_ptr &x, std::size_t depth
|
||||||
@ -764,7 +316,12 @@ class sgtree_algorithms
|
|||||||
if(tree_size > max_tree_size)
|
if(tree_size > max_tree_size)
|
||||||
max_tree_size = tree_size;
|
max_tree_size = tree_size;
|
||||||
|
|
||||||
if(tree_size != 1 && depth > h_alpha(tree_size)){
|
if(tree_size > 2 && //Nothing to do with only the root
|
||||||
|
//Check if the root node is unbalanced
|
||||||
|
//Scapegoat paper depth counts root depth as zero and "depth" counts root as 1,
|
||||||
|
//but since "depth" is the depth of the ancestor of x, i == depth
|
||||||
|
depth > h_alpha(tree_size)){
|
||||||
|
|
||||||
//Find the first non height-balanced node
|
//Find the first non height-balanced node
|
||||||
//as described in the section 4.2 of the paper.
|
//as described in the section 4.2 of the paper.
|
||||||
//This method is the alternative method described
|
//This method is the alternative method described
|
||||||
@ -773,32 +330,40 @@ class sgtree_algorithms
|
|||||||
//than the weight balanced method.
|
//than the weight balanced method.
|
||||||
node_ptr s = x;
|
node_ptr s = x;
|
||||||
std::size_t size = 1;
|
std::size_t size = 1;
|
||||||
|
for(std::size_t ancestor = 1; true; ++ancestor){
|
||||||
for(std::size_t i = 1; true; ++i){
|
if(ancestor == depth){ //Check if whole tree must be rebuilt
|
||||||
bool rebalance = false;
|
max_tree_size = tree_size;
|
||||||
if(i == depth){
|
bstree_algorithms::rebalance_subtree(NodeTraits::get_parent(s));
|
||||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(tree_size == count(s));
|
|
||||||
rebalance = true;
|
|
||||||
}
|
|
||||||
else if(i > h_alpha(size)){
|
|
||||||
node_ptr s_parent = NodeTraits::get_parent(s);
|
|
||||||
node_ptr s_parent_left = NodeTraits::get_left(s_parent);
|
|
||||||
size += 1 + tree_algorithms::count
|
|
||||||
( s_parent_left == s ? NodeTraits::get_right(s_parent) : s_parent_left );
|
|
||||||
s = s_parent;
|
|
||||||
rebalance = true;
|
|
||||||
}
|
|
||||||
if(rebalance){
|
|
||||||
rebalance_subtree(s);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else{ //Go to the next scapegoat candidate
|
||||||
|
const node_ptr s_parent = NodeTraits::get_parent(s);
|
||||||
|
const node_ptr s_parent_left = NodeTraits::get_left(s_parent);
|
||||||
|
//Obtain parent's size (previous size + parent + sibling tree)
|
||||||
|
const node_ptr s_sibling = s_parent_left == s ? NodeTraits::get_right(s_parent) : s_parent_left;
|
||||||
|
size += 1 + bstree_algorithms::subtree_size(s_sibling);
|
||||||
|
s = s_parent;
|
||||||
|
if(ancestor > h_alpha(size)){ //is 's' scapegoat?
|
||||||
|
bstree_algorithms::rebalance_subtree(s);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// @cond
|
||||||
|
|
||||||
|
template<class NodeTraits>
|
||||||
|
struct get_algo<SgTreeAlgorithms, NodeTraits>
|
||||||
|
{
|
||||||
|
typedef sgtree_algorithms<NodeTraits> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// @endcond
|
||||||
|
|
||||||
} //namespace intrusive
|
} //namespace intrusive
|
||||||
} //namespace boost
|
} //namespace boost
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -38,16 +38,6 @@ namespace intrusive {
|
|||||||
|
|
||||||
/// @cond
|
/// @cond
|
||||||
|
|
||||||
template <class ValueTraits, class SizeType, bool ConstantTimeSize, bool Linear, bool CacheLast>
|
|
||||||
struct slistopt
|
|
||||||
{
|
|
||||||
typedef ValueTraits value_traits;
|
|
||||||
typedef SizeType size_type;
|
|
||||||
static const bool constant_time_size = ConstantTimeSize;
|
|
||||||
static const bool linear = Linear;
|
|
||||||
static const bool cache_last = CacheLast;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class Node, class NodePtr, bool>
|
template<class Node, class NodePtr, bool>
|
||||||
struct root_plus_last
|
struct root_plus_last
|
||||||
{
|
{
|
||||||
@ -61,17 +51,22 @@ struct root_plus_last<Node, NodePtr, false>
|
|||||||
Node root_;
|
Node root_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
|
||||||
struct slist_defaults
|
struct slist_defaults
|
||||||
: pack_options
|
{
|
||||||
< none
|
typedef detail::default_slist_hook proto_value_traits;
|
||||||
, base_hook<detail::default_slist_hook>
|
static const bool constant_time_size = true;
|
||||||
, constant_time_size<true>
|
static const bool linear = false;
|
||||||
, linear<false>
|
typedef std::size_t size_type;
|
||||||
, size_type<std::size_t>
|
static const bool cache_last = false;
|
||||||
, cache_last<false>
|
};
|
||||||
>::type
|
|
||||||
{};
|
struct slist_bool_flags
|
||||||
|
{
|
||||||
|
static const std::size_t linear_pos = 1u;
|
||||||
|
static const std::size_t constant_time_size_pos = 2u;
|
||||||
|
static const std::size_t cache_last_pos = 4u;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
@ -101,23 +96,19 @@ struct slist_defaults
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class Config>
|
template<class ValueTraits, class SizeType, std::size_t BoolFlags>
|
||||||
#endif
|
#endif
|
||||||
class slist_impl
|
class slist_impl
|
||||||
: private detail::clear_on_destructor_base<slist_impl<Config> >
|
: private detail::clear_on_destructor_base<slist_impl<ValueTraits, SizeType, BoolFlags> >
|
||||||
{
|
{
|
||||||
template<class C> friend class detail::clear_on_destructor_base;
|
template<class C> friend class detail::clear_on_destructor_base;
|
||||||
//Public typedefs
|
//Public typedefs
|
||||||
public:
|
public:
|
||||||
typedef typename Config::value_traits value_traits;
|
typedef ValueTraits value_traits;
|
||||||
/// @cond
|
/// @cond
|
||||||
static const bool external_value_traits =
|
static const bool external_value_traits =
|
||||||
detail::external_value_traits_bool_is_true<value_traits>::value;
|
detail::external_value_traits_bool_is_true<value_traits>::value;
|
||||||
typedef typename detail::eval_if_c
|
typedef typename detail::get_real_value_traits<ValueTraits>::type real_value_traits;
|
||||||
< external_value_traits
|
|
||||||
, detail::eval_value_traits<value_traits>
|
|
||||||
, detail::identity<value_traits>
|
|
||||||
>::type real_value_traits;
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef typename real_value_traits::pointer pointer;
|
typedef typename real_value_traits::pointer pointer;
|
||||||
typedef typename real_value_traits::const_pointer const_pointer;
|
typedef typename real_value_traits::const_pointer const_pointer;
|
||||||
@ -125,25 +116,25 @@ class slist_impl
|
|||||||
typedef typename pointer_traits<pointer>::reference reference;
|
typedef typename pointer_traits<pointer>::reference reference;
|
||||||
typedef typename pointer_traits<const_pointer>::reference const_reference;
|
typedef typename pointer_traits<const_pointer>::reference const_reference;
|
||||||
typedef typename pointer_traits<pointer>::difference_type difference_type;
|
typedef typename pointer_traits<pointer>::difference_type difference_type;
|
||||||
typedef typename Config::size_type size_type;
|
typedef SizeType size_type;
|
||||||
typedef slist_iterator<slist_impl, false> iterator;
|
typedef slist_iterator<real_value_traits, false> iterator;
|
||||||
typedef slist_iterator<slist_impl, true> const_iterator;
|
typedef slist_iterator<real_value_traits, true> const_iterator;
|
||||||
typedef typename real_value_traits::node_traits node_traits;
|
typedef typename real_value_traits::node_traits node_traits;
|
||||||
typedef typename node_traits::node node;
|
typedef typename node_traits::node node;
|
||||||
typedef typename node_traits::node_ptr node_ptr;
|
typedef typename node_traits::node_ptr node_ptr;
|
||||||
typedef typename node_traits::const_node_ptr const_node_ptr;
|
typedef typename node_traits::const_node_ptr const_node_ptr;
|
||||||
|
|
||||||
|
static const bool constant_time_size = 0 != (BoolFlags & slist_bool_flags::constant_time_size_pos);
|
||||||
|
static const bool stateful_value_traits = detail::is_stateful_value_traits<real_value_traits>::value;
|
||||||
|
static const bool linear = 0 != (BoolFlags & slist_bool_flags::linear_pos);
|
||||||
|
static const bool cache_last = 0 != (BoolFlags & slist_bool_flags::cache_last_pos);
|
||||||
|
|
||||||
typedef typename detail::if_c
|
typedef typename detail::if_c
|
||||||
< Config::linear
|
< linear
|
||||||
, linear_slist_algorithms<node_traits>
|
, linear_slist_algorithms<node_traits>
|
||||||
, circular_slist_algorithms<node_traits>
|
, circular_slist_algorithms<node_traits>
|
||||||
>::type node_algorithms;
|
>::type node_algorithms;
|
||||||
|
|
||||||
static const bool constant_time_size = Config::constant_time_size;
|
|
||||||
static const bool stateful_value_traits = detail::is_stateful_value_traits<real_value_traits>::value;
|
|
||||||
static const bool linear = Config::linear;
|
|
||||||
static const bool cache_last = Config::cache_last;
|
|
||||||
|
|
||||||
/// @cond
|
/// @cond
|
||||||
private:
|
private:
|
||||||
typedef detail::size_holder<constant_time_size, size_type> size_traits;
|
typedef detail::size_holder<constant_time_size, size_type> size_traits;
|
||||||
@ -151,9 +142,7 @@ class slist_impl
|
|||||||
//noncopyable
|
//noncopyable
|
||||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(slist_impl)
|
BOOST_MOVABLE_BUT_NOT_COPYABLE(slist_impl)
|
||||||
|
|
||||||
enum { safemode_or_autounlink =
|
static const bool safemode_or_autounlink = is_safe_autounlink<real_value_traits::link_mode>::value;
|
||||||
(int)real_value_traits::link_mode == (int)auto_unlink ||
|
|
||||||
(int)real_value_traits::link_mode == (int)safe_link };
|
|
||||||
|
|
||||||
//Constant-time size is incompatible with auto-unlink hooks!
|
//Constant-time size is incompatible with auto-unlink hooks!
|
||||||
BOOST_STATIC_ASSERT(!(constant_time_size && ((int)real_value_traits::link_mode == (int)auto_unlink)));
|
BOOST_STATIC_ASSERT(!(constant_time_size && ((int)real_value_traits::link_mode == (int)auto_unlink)));
|
||||||
@ -207,9 +196,6 @@ class slist_impl
|
|||||||
void set_last_node(const node_ptr & n, detail::bool_<true>)
|
void set_last_node(const node_ptr & n, detail::bool_<true>)
|
||||||
{ data_.root_plus_size_.last_ = n; }
|
{ data_.root_plus_size_.last_ = n; }
|
||||||
|
|
||||||
static node_ptr uncast(const const_node_ptr & ptr)
|
|
||||||
{ return pointer_traits<node_ptr>::const_cast_from(ptr); }
|
|
||||||
|
|
||||||
void set_default_constructed_state()
|
void set_default_constructed_state()
|
||||||
{
|
{
|
||||||
node_algorithms::init_header(this->get_root_node());
|
node_algorithms::init_header(this->get_root_node());
|
||||||
@ -279,6 +265,11 @@ class slist_impl
|
|||||||
real_value_traits &get_real_value_traits()
|
real_value_traits &get_real_value_traits()
|
||||||
{ return this->get_real_value_traits(detail::bool_<external_value_traits>()); }
|
{ return this->get_real_value_traits(detail::bool_<external_value_traits>()); }
|
||||||
|
|
||||||
|
typedef typename pointer_traits<node_ptr>::template rebind_pointer<const real_value_traits>::type const_real_value_traits_ptr;
|
||||||
|
|
||||||
|
const_real_value_traits_ptr real_value_traits_ptr() const
|
||||||
|
{ return pointer_traits<const_real_value_traits_ptr>::pointer_to(this->get_real_value_traits()); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
///@cond
|
///@cond
|
||||||
@ -511,7 +502,7 @@ class slist_impl
|
|||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
const_reference front() const
|
const_reference front() const
|
||||||
{ return *this->get_real_value_traits().to_value_ptr(uncast(node_traits::get_next(this->get_root_node()))); }
|
{ return *this->get_real_value_traits().to_value_ptr(detail::uncast(node_traits::get_next(this->get_root_node()))); }
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns a reference to the last element of the list.
|
//! <b>Effects</b>: Returns a reference to the last element of the list.
|
||||||
//!
|
//!
|
||||||
@ -547,7 +538,7 @@ class slist_impl
|
|||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
iterator begin()
|
iterator begin()
|
||||||
{ return iterator (node_traits::get_next(this->get_root_node()), this); }
|
{ return iterator (node_traits::get_next(this->get_root_node()), this->real_value_traits_ptr()); }
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
|
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
|
||||||
//!
|
//!
|
||||||
@ -555,7 +546,7 @@ class slist_impl
|
|||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
const_iterator begin() const
|
const_iterator begin() const
|
||||||
{ return const_iterator (node_traits::get_next(this->get_root_node()), this); }
|
{ return const_iterator (node_traits::get_next(this->get_root_node()), this->real_value_traits_ptr()); }
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
|
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
|
||||||
//!
|
//!
|
||||||
@ -563,7 +554,7 @@ class slist_impl
|
|||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
const_iterator cbegin() const
|
const_iterator cbegin() const
|
||||||
{ return const_iterator(node_traits::get_next(this->get_root_node()), this); }
|
{ return const_iterator(node_traits::get_next(this->get_root_node()), this->real_value_traits_ptr()); }
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns an iterator to the end of the list.
|
//! <b>Effects</b>: Returns an iterator to the end of the list.
|
||||||
//!
|
//!
|
||||||
@ -571,7 +562,7 @@ class slist_impl
|
|||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
iterator end()
|
iterator end()
|
||||||
{ return iterator(this->get_end_node(), this); }
|
{ return iterator(this->get_end_node(), this->real_value_traits_ptr()); }
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
|
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
|
||||||
//!
|
//!
|
||||||
@ -579,7 +570,7 @@ class slist_impl
|
|||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
const_iterator end() const
|
const_iterator end() const
|
||||||
{ return const_iterator(uncast(this->get_end_node()), this); }
|
{ return const_iterator(detail::uncast(this->get_end_node()), this->real_value_traits_ptr()); }
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
|
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
|
||||||
//!
|
//!
|
||||||
@ -596,7 +587,7 @@ class slist_impl
|
|||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
iterator before_begin()
|
iterator before_begin()
|
||||||
{ return iterator(this->get_root_node(), this); }
|
{ return iterator(this->get_root_node(), this->real_value_traits_ptr()); }
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns an iterator that points to a position
|
//! <b>Effects</b>: Returns an iterator that points to a position
|
||||||
//! before the first element. Equivalent to "end()"
|
//! before the first element. Equivalent to "end()"
|
||||||
@ -605,7 +596,7 @@ class slist_impl
|
|||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Constant.
|
//! <b>Complexity</b>: Constant.
|
||||||
const_iterator before_begin() const
|
const_iterator before_begin() const
|
||||||
{ return const_iterator(uncast(this->get_root_node()), this); }
|
{ return const_iterator(detail::uncast(this->get_root_node()), this->real_value_traits_ptr()); }
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns an iterator that points to a position
|
//! <b>Effects</b>: Returns an iterator that points to a position
|
||||||
//! before the first element. Equivalent to "end()"
|
//! before the first element. Equivalent to "end()"
|
||||||
@ -627,7 +618,7 @@ class slist_impl
|
|||||||
{
|
{
|
||||||
//This function shall not be used if cache_last is not true
|
//This function shall not be used if cache_last is not true
|
||||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(cache_last);
|
BOOST_INTRUSIVE_INVARIANT_ASSERT(cache_last);
|
||||||
return iterator (this->get_last_node(), this);
|
return iterator (this->get_last_node(), this->real_value_traits_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns a const_iterator to the last element contained in the list.
|
//! <b>Effects</b>: Returns a const_iterator to the last element contained in the list.
|
||||||
@ -641,7 +632,7 @@ class slist_impl
|
|||||||
{
|
{
|
||||||
//This function shall not be used if cache_last is not true
|
//This function shall not be used if cache_last is not true
|
||||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(cache_last);
|
BOOST_INTRUSIVE_INVARIANT_ASSERT(cache_last);
|
||||||
return const_iterator (this->get_last_node(), this);
|
return const_iterator (this->get_last_node(), this->real_value_traits_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Effects</b>: Returns a const_iterator to the last element contained in the list.
|
//! <b>Effects</b>: Returns a const_iterator to the last element contained in the list.
|
||||||
@ -652,7 +643,7 @@ class slist_impl
|
|||||||
//!
|
//!
|
||||||
//! <b>Note</b>: This function is present only if cached_last<> option is true.
|
//! <b>Note</b>: This function is present only if cached_last<> option is true.
|
||||||
const_iterator clast() const
|
const_iterator clast() const
|
||||||
{ return const_iterator(this->get_last_node(), this); }
|
{ return const_iterator(this->get_last_node(), this->real_value_traits_ptr()); }
|
||||||
|
|
||||||
//! <b>Precondition</b>: end_iterator must be a valid end iterator
|
//! <b>Precondition</b>: end_iterator must be a valid end iterator
|
||||||
//! of slist.
|
//! of slist.
|
||||||
@ -801,7 +792,7 @@ class slist_impl
|
|||||||
this->set_last_node(n);
|
this->set_last_node(n);
|
||||||
}
|
}
|
||||||
this->priv_size_traits().increment();
|
this->priv_size_traits().increment();
|
||||||
return iterator (n, this);
|
return iterator (n, this->real_value_traits_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: Dereferencing iterator must yield
|
//! <b>Requires</b>: Dereferencing iterator must yield
|
||||||
@ -1696,7 +1687,7 @@ class slist_impl
|
|||||||
{
|
{
|
||||||
BOOST_STATIC_ASSERT((!stateful_value_traits));
|
BOOST_STATIC_ASSERT((!stateful_value_traits));
|
||||||
//BOOST_INTRUSIVE_INVARIANT_ASSERT (!node_algorithms::inited(value_traits::to_node_ptr(value)));
|
//BOOST_INTRUSIVE_INVARIANT_ASSERT (!node_algorithms::inited(value_traits::to_node_ptr(value)));
|
||||||
return iterator (value_traits::to_node_ptr(value), 0);
|
return iterator (value_traits::to_node_ptr(value), const_real_value_traits_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
|
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
|
||||||
@ -1714,7 +1705,7 @@ class slist_impl
|
|||||||
{
|
{
|
||||||
BOOST_STATIC_ASSERT((!stateful_value_traits));
|
BOOST_STATIC_ASSERT((!stateful_value_traits));
|
||||||
//BOOST_INTRUSIVE_INVARIANT_ASSERT (!node_algorithms::inited(value_traits::to_node_ptr(const_cast<reference> (value))));
|
//BOOST_INTRUSIVE_INVARIANT_ASSERT (!node_algorithms::inited(value_traits::to_node_ptr(const_cast<reference> (value))));
|
||||||
return const_iterator (value_traits::to_node_ptr(const_cast<reference> (value)), 0);
|
return const_iterator (value_traits::to_node_ptr(const_cast<reference> (value)), const_real_value_traits_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: value must be a reference to a value inserted in a list.
|
//! <b>Requires</b>: value must be a reference to a value inserted in a list.
|
||||||
@ -1729,7 +1720,7 @@ class slist_impl
|
|||||||
iterator iterator_to(reference value)
|
iterator iterator_to(reference value)
|
||||||
{
|
{
|
||||||
//BOOST_INTRUSIVE_INVARIANT_ASSERT (!node_algorithms::inited(value_traits::to_node_ptr(value)));
|
//BOOST_INTRUSIVE_INVARIANT_ASSERT (!node_algorithms::inited(value_traits::to_node_ptr(value)));
|
||||||
return iterator (value_traits::to_node_ptr(value), this);
|
return iterator (value_traits::to_node_ptr(value), this->real_value_traits_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
|
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
|
||||||
@ -1744,7 +1735,7 @@ class slist_impl
|
|||||||
const_iterator iterator_to(const_reference value) const
|
const_iterator iterator_to(const_reference value) const
|
||||||
{
|
{
|
||||||
//BOOST_INTRUSIVE_INVARIANT_ASSERT (!node_algorithms::inited(value_traits::to_node_ptr(const_cast<reference> (value))));
|
//BOOST_INTRUSIVE_INVARIANT_ASSERT (!node_algorithms::inited(value_traits::to_node_ptr(const_cast<reference> (value))));
|
||||||
return const_iterator (value_traits::to_node_ptr(const_cast<reference> (value)), this);
|
return const_iterator (value_traits::to_node_ptr(const_cast<reference> (value)), this->real_value_traits_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Returns</b>: The iterator to the element before i in the list.
|
//! <b>Returns</b>: The iterator to the element before i in the list.
|
||||||
@ -1793,11 +1784,11 @@ class slist_impl
|
|||||||
const_iterator previous(const_iterator prev_from, const_iterator i) const
|
const_iterator previous(const_iterator prev_from, const_iterator i) const
|
||||||
{
|
{
|
||||||
if(cache_last && (i.pointed_node() == this->get_end_node())){
|
if(cache_last && (i.pointed_node() == this->get_end_node())){
|
||||||
return const_iterator(uncast(this->get_last_node()), this);
|
return const_iterator(detail::uncast(this->get_last_node()), this->real_value_traits_ptr());
|
||||||
}
|
}
|
||||||
return const_iterator
|
return const_iterator
|
||||||
(node_algorithms::get_previous_node
|
(node_algorithms::get_previous_node
|
||||||
(prev_from.pointed_node(), i.pointed_node()), this);
|
(prev_from.pointed_node(), i.pointed_node()), this->real_value_traits_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
///@cond
|
///@cond
|
||||||
@ -1846,7 +1837,11 @@ class slist_impl
|
|||||||
{
|
{
|
||||||
if(n){
|
if(n){
|
||||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(n > 0);
|
BOOST_INTRUSIVE_INVARIANT_ASSERT(n > 0);
|
||||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(size_type(std::distance(iterator(f, this), iterator(before_l, this)))+1 == n);
|
BOOST_INTRUSIVE_INVARIANT_ASSERT
|
||||||
|
(size_type(std::distance
|
||||||
|
( iterator(f, this->real_value_traits_ptr())
|
||||||
|
, iterator(before_l, this->real_value_traits_ptr())))
|
||||||
|
+1 == n);
|
||||||
this->priv_incorporate_after(prev_pos.pointed_node(), f, before_l);
|
this->priv_incorporate_after(prev_pos.pointed_node(), f, before_l);
|
||||||
if(constant_time_size){
|
if(constant_time_size){
|
||||||
this->priv_size_traits().increase(n);
|
this->priv_size_traits().increase(n);
|
||||||
@ -1994,29 +1989,31 @@ class slist_impl
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class Config>
|
template<class ValueTraits, class SizeType, std::size_t BoolFlags>
|
||||||
#endif
|
#endif
|
||||||
inline bool operator<
|
inline bool operator<
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
|
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
|
||||||
#else
|
#else
|
||||||
(const slist_impl<Config> &x, const slist_impl<Config> &y)
|
( const slist_impl<ValueTraits, SizeType, BoolFlags> &x
|
||||||
|
, const slist_impl<ValueTraits, SizeType, BoolFlags> &y)
|
||||||
#endif
|
#endif
|
||||||
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
|
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
|
||||||
|
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class Config>
|
template<class ValueTraits, class SizeType, std::size_t BoolFlags>
|
||||||
#endif
|
#endif
|
||||||
bool operator==
|
bool operator==
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
|
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
|
||||||
#else
|
#else
|
||||||
(const slist_impl<Config> &x, const slist_impl<Config> &y)
|
( const slist_impl<ValueTraits, SizeType, BoolFlags> &x
|
||||||
|
, const slist_impl<ValueTraits, SizeType, BoolFlags> &y)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
typedef slist_impl<Config> slist_type;
|
typedef slist_impl<ValueTraits, SizeType, BoolFlags> slist_type;
|
||||||
typedef typename slist_type::const_iterator const_iterator;
|
typedef typename slist_type::const_iterator const_iterator;
|
||||||
const bool C = slist_type::constant_time_size;
|
const bool C = slist_type::constant_time_size;
|
||||||
if(C && x.size() != y.size()){
|
if(C && x.size() != y.size()){
|
||||||
@ -2046,65 +2043,70 @@ bool operator==
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class Config>
|
template<class ValueTraits, class SizeType, std::size_t BoolFlags>
|
||||||
#endif
|
#endif
|
||||||
inline bool operator!=
|
inline bool operator!=
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
|
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
|
||||||
#else
|
#else
|
||||||
(const slist_impl<Config> &x, const slist_impl<Config> &y)
|
( const slist_impl<ValueTraits, SizeType, BoolFlags> &x
|
||||||
|
, const slist_impl<ValueTraits, SizeType, BoolFlags> &y)
|
||||||
#endif
|
#endif
|
||||||
{ return !(x == y); }
|
{ return !(x == y); }
|
||||||
|
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class Config>
|
template<class ValueTraits, class SizeType, std::size_t BoolFlags>
|
||||||
#endif
|
#endif
|
||||||
inline bool operator>
|
inline bool operator>
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
|
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
|
||||||
#else
|
#else
|
||||||
(const slist_impl<Config> &x, const slist_impl<Config> &y)
|
( const slist_impl<ValueTraits, SizeType, BoolFlags> &x
|
||||||
|
, const slist_impl<ValueTraits, SizeType, BoolFlags> &y)
|
||||||
#endif
|
#endif
|
||||||
{ return y < x; }
|
{ return y < x; }
|
||||||
|
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class Config>
|
template<class ValueTraits, class SizeType, std::size_t BoolFlags>
|
||||||
#endif
|
#endif
|
||||||
inline bool operator<=
|
inline bool operator<=
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
|
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
|
||||||
#else
|
#else
|
||||||
(const slist_impl<Config> &x, const slist_impl<Config> &y)
|
( const slist_impl<ValueTraits, SizeType, BoolFlags> &x
|
||||||
|
, const slist_impl<ValueTraits, SizeType, BoolFlags> &y)
|
||||||
#endif
|
#endif
|
||||||
{ return !(y < x); }
|
{ return !(y < x); }
|
||||||
|
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class Config>
|
template<class ValueTraits, class SizeType, std::size_t BoolFlags>
|
||||||
#endif
|
#endif
|
||||||
inline bool operator>=
|
inline bool operator>=
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
|
(const slist_impl<T, Options...> &x, const slist_impl<T, Options...> &y)
|
||||||
#else
|
#else
|
||||||
(const slist_impl<Config> &x, const slist_impl<Config> &y)
|
( const slist_impl<ValueTraits, SizeType, BoolFlags> &x
|
||||||
|
, const slist_impl<ValueTraits, SizeType, BoolFlags> &y)
|
||||||
#endif
|
#endif
|
||||||
{ return !(x < y); }
|
{ return !(x < y); }
|
||||||
|
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class Config>
|
template<class ValueTraits, class SizeType, std::size_t BoolFlags>
|
||||||
#endif
|
#endif
|
||||||
inline void swap
|
inline void swap
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
(slist_impl<T, Options...> &x, slist_impl<T, Options...> &y)
|
(slist_impl<T, Options...> &x, slist_impl<T, Options...> &y)
|
||||||
#else
|
#else
|
||||||
(slist_impl<Config> &x, slist_impl<Config> &y)
|
( slist_impl<ValueTraits, SizeType, BoolFlags> &x
|
||||||
|
, slist_impl<ValueTraits, SizeType, BoolFlags> &y)
|
||||||
#endif
|
#endif
|
||||||
{ x.swap(y); }
|
{ x.swap(y); }
|
||||||
|
|
||||||
@ -2113,13 +2115,13 @@ inline void swap
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class T, class ...Options>
|
template<class T, class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class T, class O1 = none, class O2 = none, class O3 = none, class O4 = none, class O5 = none>
|
template<class T, class O1 = void, class O2 = void, class O3 = void, class O4 = void, class O5 = void>
|
||||||
#endif
|
#endif
|
||||||
struct make_slist
|
struct make_slist
|
||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef typename pack_options
|
typedef typename pack_options
|
||||||
< slist_defaults<T>,
|
< slist_defaults,
|
||||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
O1, O2, O3, O4, O5
|
O1, O2, O3, O4, O5
|
||||||
#else
|
#else
|
||||||
@ -2127,16 +2129,13 @@ struct make_slist
|
|||||||
#endif
|
#endif
|
||||||
>::type packed_options;
|
>::type packed_options;
|
||||||
typedef typename detail::get_value_traits
|
typedef typename detail::get_value_traits
|
||||||
<T, typename packed_options::value_traits>::type value_traits;
|
<T, typename packed_options::proto_value_traits>::type value_traits;
|
||||||
typedef slist_impl
|
typedef slist_impl
|
||||||
<
|
< value_traits
|
||||||
slistopt
|
, typename packed_options::size_type
|
||||||
< value_traits
|
, (std::size_t(packed_options::linear)*slist_bool_flags::linear_pos)
|
||||||
, typename packed_options::size_type
|
|(std::size_t(packed_options::constant_time_size)*slist_bool_flags::constant_time_size_pos)
|
||||||
, packed_options::constant_time_size
|
|(std::size_t(packed_options::cache_last)*slist_bool_flags::cache_last_pos)
|
||||||
, packed_options::linear
|
|
||||||
, packed_options::cache_last
|
|
||||||
>
|
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
@ -2200,7 +2199,7 @@ class slist
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
slist& operator=(BOOST_RV_REF(slist) x)
|
slist& operator=(BOOST_RV_REF(slist) x)
|
||||||
{ this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
|
{ return static_cast<slist &>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); }
|
||||||
|
|
||||||
static slist &container_from_end_iterator(iterator end_iterator)
|
static slist &container_from_end_iterator(iterator end_iterator)
|
||||||
{ return static_cast<slist &>(Base::container_from_end_iterator(end_iterator)); }
|
{ return static_cast<slist &>(Base::container_from_end_iterator(end_iterator)); }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -40,7 +40,7 @@ struct get_slist_node_algo
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class O1 = none, class O2 = none, class O3 = none>
|
template<class O1 = void, class O2 = void, class O3 = void>
|
||||||
#endif
|
#endif
|
||||||
struct make_slist_base_hook
|
struct make_slist_base_hook
|
||||||
{
|
{
|
||||||
@ -54,11 +54,11 @@ struct make_slist_base_hook
|
|||||||
#endif
|
#endif
|
||||||
>::type packed_options;
|
>::type packed_options;
|
||||||
|
|
||||||
typedef detail::generic_hook
|
typedef generic_hook
|
||||||
< get_slist_node_algo<typename packed_options::void_pointer>
|
< get_slist_node_algo<typename packed_options::void_pointer>
|
||||||
, typename packed_options::tag
|
, typename packed_options::tag
|
||||||
, packed_options::link_mode
|
, packed_options::link_mode
|
||||||
, detail::SlistBaseHook
|
, SlistBaseHookId
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
@ -168,7 +168,7 @@ class slist_base_hook
|
|||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class O1 = none, class O2 = none, class O3 = none>
|
template<class O1 = void, class O2 = void, class O3 = void>
|
||||||
#endif
|
#endif
|
||||||
struct make_slist_member_hook
|
struct make_slist_member_hook
|
||||||
{
|
{
|
||||||
@ -182,11 +182,11 @@ struct make_slist_member_hook
|
|||||||
#endif
|
#endif
|
||||||
>::type packed_options;
|
>::type packed_options;
|
||||||
|
|
||||||
typedef detail::generic_hook
|
typedef generic_hook
|
||||||
< get_slist_node_algo<typename packed_options::void_pointer>
|
< get_slist_node_algo<typename packed_options::void_pointer>
|
||||||
, member_tag
|
, member_tag
|
||||||
, packed_options::link_mode
|
, packed_options::link_mode
|
||||||
, detail::NoBaseHook
|
, NoBaseHookId
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||||
// (C) Copyright Ion Gaztanaga 2006-2012
|
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -14,49 +14,37 @@
|
|||||||
#define BOOST_INTRUSIVE_SPLAY_SET_HOOK_HPP
|
#define BOOST_INTRUSIVE_SPLAY_SET_HOOK_HPP
|
||||||
|
|
||||||
#include <boost/intrusive/detail/config_begin.hpp>
|
#include <boost/intrusive/detail/config_begin.hpp>
|
||||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
#include <boost/intrusive/bs_set_hook.hpp>
|
||||||
#include <boost/intrusive/detail/utilities.hpp>
|
|
||||||
#include <boost/intrusive/detail/tree_node.hpp>
|
|
||||||
#include <boost/intrusive/splaytree_algorithms.hpp>
|
|
||||||
#include <boost/intrusive/options.hpp>
|
|
||||||
#include <boost/intrusive/detail/generic_hook.hpp>
|
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace intrusive {
|
namespace intrusive {
|
||||||
|
|
||||||
/// @cond
|
|
||||||
template<class VoidPointer>
|
|
||||||
struct get_splay_set_node_algo
|
|
||||||
{
|
|
||||||
typedef splaytree_algorithms<tree_node_traits<VoidPointer> > type;
|
|
||||||
};
|
|
||||||
/// @endcond
|
|
||||||
|
|
||||||
//! Helper metafunction to define a \c splay_set_base_hook that yields to the same
|
//! Helper metafunction to define a \c splay_set_base_hook that yields to the same
|
||||||
//! type when the same options (either explicitly or implicitly) are used.
|
//! type when the same options (either explicitly or implicitly) are used.
|
||||||
|
//! <b>WARNING: </b> Deprecated class, use `make_bs_set_base_hook` instead.
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class O1 = none, class O2 = none, class O3 = none>
|
template<class O1 = void, class O2 = void, class O3 = void>
|
||||||
#endif
|
#endif
|
||||||
struct make_splay_set_base_hook
|
struct make_splay_set_base_hook
|
||||||
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
|
#if defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
|
: public make_bs_set_base_hook<Options...>
|
||||||
|
#else
|
||||||
|
: public make_bs_set_base_hook<O1, O2, O3>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef typename pack_options
|
typedef typename make_bs_set_base_hook
|
||||||
< hook_defaults,
|
<
|
||||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
O1, O2, O3
|
O1, O2, O3
|
||||||
#else
|
#else
|
||||||
Options...
|
Options...
|
||||||
#endif
|
#endif
|
||||||
>::type packed_options;
|
>::type implementation_defined;
|
||||||
|
|
||||||
typedef detail::generic_hook
|
|
||||||
< get_splay_set_node_algo<typename packed_options::void_pointer>
|
|
||||||
, typename packed_options::tag
|
|
||||||
, packed_options::link_mode
|
|
||||||
, detail::SplaySetBaseHook
|
|
||||||
> implementation_defined;
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
};
|
};
|
||||||
@ -78,6 +66,8 @@ struct make_splay_set_base_hook
|
|||||||
//!
|
//!
|
||||||
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
|
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
|
||||||
//! \c auto_unlink or \c safe_link).
|
//! \c auto_unlink or \c safe_link).
|
||||||
|
//!
|
||||||
|
//! <b>WARNING: </b> Deprecated class, use `bs_set_base_hook` instead.
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
#else
|
#else
|
||||||
@ -162,29 +152,31 @@ class splay_set_base_hook
|
|||||||
|
|
||||||
//! Helper metafunction to define a \c splay_set_member_hook that yields to the same
|
//! Helper metafunction to define a \c splay_set_member_hook that yields to the same
|
||||||
//! type when the same options (either explicitly or implicitly) are used.
|
//! type when the same options (either explicitly or implicitly) are used.
|
||||||
|
//!
|
||||||
|
//! <b>WARNING: </b> Deprecated class, use `make_bs_set_member_hook` instead.
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
#else
|
#else
|
||||||
template<class O1 = none, class O2 = none, class O3 = none>
|
template<class O1 = void, class O2 = void, class O3 = void>
|
||||||
#endif
|
#endif
|
||||||
struct make_splay_set_member_hook
|
struct make_splay_set_member_hook
|
||||||
|
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||||
|
#if defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
|
: public make_bs_set_member_hook<Options...>
|
||||||
|
#else
|
||||||
|
: public make_bs_set_member_hook<O1, O2, O3>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
/// @cond
|
/// @cond
|
||||||
typedef typename pack_options
|
typedef typename make_bs_set_member_hook
|
||||||
< hook_defaults,
|
<
|
||||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
O1, O2, O3
|
O1, O2, O3
|
||||||
#else
|
#else
|
||||||
Options...
|
Options...
|
||||||
#endif
|
#endif
|
||||||
>::type packed_options;
|
>::type implementation_defined;
|
||||||
|
|
||||||
typedef detail::generic_hook
|
|
||||||
< get_splay_set_node_algo<typename packed_options::void_pointer>
|
|
||||||
, member_tag
|
|
||||||
, packed_options::link_mode
|
|
||||||
, detail::NoBaseHook
|
|
||||||
> implementation_defined;
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
typedef implementation_defined type;
|
typedef implementation_defined type;
|
||||||
};
|
};
|
||||||
@ -202,6 +194,8 @@ struct make_splay_set_member_hook
|
|||||||
//!
|
//!
|
||||||
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
|
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
|
||||||
//! \c auto_unlink or \c safe_link).
|
//! \c auto_unlink or \c safe_link).
|
||||||
|
//!
|
||||||
|
//! <b>WARNING: </b> Deprecated class, use `bs_set_member_hook` instead.
|
||||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||||
template<class ...Options>
|
template<class ...Options>
|
||||||
#else
|
#else
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user