diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-03-21 15:45:20 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-03-21 15:46:37 +0900 |
commit | 733b5d5ae2c5d625211e2985ac25728ac3f54883 (patch) | |
tree | a5b214744b256f07e1dc2bd7273035a7808c659f /boost/intrusive/avltree_algorithms.hpp | |
parent | 08c1e93fa36a49f49325a07fe91ff92c964c2b6c (diff) | |
download | boost-733b5d5ae2c5d625211e2985ac25728ac3f54883.tar.gz boost-733b5d5ae2c5d625211e2985ac25728ac3f54883.tar.bz2 boost-733b5d5ae2c5d625211e2985ac25728ac3f54883.zip |
Imported Upstream version 1.58.0upstream/1.58.0
Change-Id: If0072143aa26874812e0db6872e1efb10a3e5e94
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/intrusive/avltree_algorithms.hpp')
-rw-r--r-- | boost/intrusive/avltree_algorithms.hpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/boost/intrusive/avltree_algorithms.hpp b/boost/intrusive/avltree_algorithms.hpp index e5bcfde160..60a981c381 100644 --- a/boost/intrusive/avltree_algorithms.hpp +++ b/boost/intrusive/avltree_algorithms.hpp @@ -14,10 +14,6 @@ #ifndef BOOST_INTRUSIVE_AVLTREE_ALGORITHMS_HPP #define BOOST_INTRUSIVE_AVLTREE_ALGORITHMS_HPP -#if defined(_MSC_VER) -# pragma once -#endif - #include <boost/intrusive/detail/config_begin.hpp> #include <boost/intrusive/intrusive_fwd.hpp> @@ -28,6 +24,11 @@ #include <boost/intrusive/detail/ebo_functor_holder.hpp> #include <boost/intrusive/bstree_algorithms.hpp> +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + + namespace boost { namespace intrusive { @@ -35,7 +36,8 @@ namespace intrusive { template<class NodeTraits, class F> struct avltree_node_cloner - : private detail::ebo_functor_holder<F> + //Use public inheritance to avoid MSVC bugs with closures + : public detail::ebo_functor_holder<F> { typedef typename NodeTraits::node_ptr node_ptr; typedef detail::ebo_functor_holder<F> base_t; @@ -50,6 +52,13 @@ struct avltree_node_cloner NodeTraits::set_balance(n, NodeTraits::get_balance(p)); return n; } + + node_ptr operator()(const node_ptr & p) const + { + node_ptr n = base_t::get()(p); + NodeTraits::set_balance(n, NodeTraits::get_balance(p)); + return n; + } }; namespace detail { @@ -168,7 +177,7 @@ class avltree_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::swap_tree static void swap_tree(const node_ptr & header1, const node_ptr & header2); - + #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&) @@ -604,7 +613,7 @@ class avltree_algorithms const node_ptr c = NodeTraits::get_right(a_oldleft); bstree_algo::rotate_left_no_parent_fix(a_oldleft, c); //No need to link c with a [NodeTraits::set_parent(c, a) + NodeTraits::set_left(a, c)] - //as c is not root and another rotation is coming + //as c is not root and another rotation is coming bstree_algo::rotate_right(a, c, NodeTraits::get_parent(a), hdr); left_right_balancing(a, a_oldleft, c); return c; |