diff --git a/include/boost/intrusive/avltree.hpp b/include/boost/intrusive/avltree.hpp index e294d58..51ff0cd 100644 --- a/include/boost/intrusive/avltree.hpp +++ b/include/boost/intrusive/avltree.hpp @@ -1274,6 +1274,8 @@ class avltree_impl node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this) , node_ptr(&priv_header()) , get_real_value_traits().to_node_ptr(with_this)); + if(safemode_or_autounlink) + node_algorithms::init(replace_this.pointed_node()); } //! Requires: value must be an lvalue and shall be in a set of diff --git a/include/boost/intrusive/detail/mpl.hpp b/include/boost/intrusive/detail/mpl.hpp index 5f57e37..075381c 100644 --- a/include/boost/intrusive/detail/mpl.hpp +++ b/include/boost/intrusive/detail/mpl.hpp @@ -138,6 +138,10 @@ template struct is_unary_or_binary_function_impl { static const bool value = false; }; +// see boost ticket #4094 +// avoid duplicate definitions of is_unary_or_binary_function_impl +#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + template struct is_unary_or_binary_function_impl { static const bool value = true; }; @@ -145,29 +149,17 @@ struct is_unary_or_binary_function_impl template struct is_unary_or_binary_function_impl { static const bool value = true; }; -/* -#ifdef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS template struct is_unary_or_binary_function_impl { static const bool value = true; }; -template -struct is_unary_or_binary_function_impl -{ static const bool value = true; }; - -template -struct is_unary_or_binary_function_impl -{ static const bool value = true; }; - template struct is_unary_or_binary_function_impl { static const bool value = true; }; -template -struct is_unary_or_binary_function_impl -{ static const bool value = true; }; - template struct is_unary_or_binary_function_impl { static const bool value = true; }; @@ -175,8 +167,13 @@ struct is_unary_or_binary_function_impl template struct is_unary_or_binary_function_impl { static const bool value = true; }; + #endif -*/ + +// see boost ticket #4094 +// avoid duplicate definitions of is_unary_or_binary_function_impl +#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + template struct is_unary_or_binary_function_impl { static const bool value = true; }; @@ -185,24 +182,16 @@ template struct is_unary_or_binary_function_impl { static const bool value = true; }; -#ifdef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS +#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS template struct is_unary_or_binary_function_impl { static const bool value = true; }; -/* -template -struct is_unary_or_binary_function_impl -{ static const bool value = true; }; template struct is_unary_or_binary_function_impl { static const bool value = true; }; -template -struct is_unary_or_binary_function_impl -{ static const bool value = true; }; - template struct is_unary_or_binary_function_impl { static const bool value = true; }; @@ -210,9 +199,13 @@ struct is_unary_or_binary_function_impl template struct is_unary_or_binary_function_impl { static const bool value = true; }; -*/ + #endif +// see boost ticket #4094 +// avoid duplicate definitions of is_unary_or_binary_function_impl +#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + template struct is_unary_or_binary_function_impl { static const bool value = true; }; @@ -220,25 +213,17 @@ struct is_unary_or_binary_function_impl template struct is_unary_or_binary_function_impl { static const bool value = true; }; -/* -#ifdef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS template struct is_unary_or_binary_function_impl { static const bool value = true; }; -template -struct is_unary_or_binary_function_impl -{ static const bool value = true; }; - template struct is_unary_or_binary_function_impl { static const bool value = true; }; -template -struct is_unary_or_binary_function_impl -{ static const bool value = true; }; - template struct is_unary_or_binary_function_impl { static const bool value = true; }; @@ -247,7 +232,7 @@ template struct is_unary_or_binary_function_impl { static const bool value = true; }; #endif -*/ + template struct is_unary_or_binary_function_impl { static const bool value = false; }; diff --git a/include/boost/intrusive/hashtable.hpp b/include/boost/intrusive/hashtable.hpp index 1493eac..30f0472 100644 --- a/include/boost/intrusive/hashtable.hpp +++ b/include/boost/intrusive/hashtable.hpp @@ -37,6 +37,7 @@ #include #include #include +#include namespace boost { namespace intrusive { @@ -123,7 +124,7 @@ struct get_slist_impl < typename NodeTraits::node , boost::intrusive::value_traits , boost::intrusive::constant_time_size - , boost::intrusive::size_type + , boost::intrusive::size_type::difference_type>::type> >::type {}; }; @@ -1677,7 +1678,8 @@ class hashtable_impl //! Throws: If the internal hash function throws. const_iterator iterator_to(const_reference value) const { - return const_iterator(bucket_type::s_iterator_to(priv_value_to_node(const_cast(value))), this); + siterator sit = bucket_type::s_iterator_to(const_cast(this->priv_value_to_node(value))); + return const_iterator(sit, this); } //! Requires: value must be an lvalue and shall be in a unordered_set of @@ -2147,7 +2149,7 @@ class hashtable_impl { const std::size_t *primes = &detail::prime_list_holder<0>::prime_list[0]; const std::size_t *primes_end = primes + detail::prime_list_holder<0>::prime_list_size; - size_type const* bound = std::lower_bound(primes, primes_end, n); + std::size_t const* bound = std::lower_bound(primes, primes_end, n); if(bound == primes_end) --bound; return size_type(*bound); diff --git a/include/boost/intrusive/options.hpp b/include/boost/intrusive/options.hpp index 9731651..4cdeccd 100644 --- a/include/boost/intrusive/options.hpp +++ b/include/boost/intrusive/options.hpp @@ -775,7 +775,7 @@ template struct do_pack > { typedef typename Prev::template pack - >::type> type; + >::type> type; }; diff --git a/include/boost/intrusive/rbtree.hpp b/include/boost/intrusive/rbtree.hpp index d2b5fe8..84937b9 100644 --- a/include/boost/intrusive/rbtree.hpp +++ b/include/boost/intrusive/rbtree.hpp @@ -1286,6 +1286,8 @@ class rbtree_impl node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this) , node_ptr(&priv_header()) , get_real_value_traits().to_node_ptr(with_this)); + if(safemode_or_autounlink) + node_algorithms::init(replace_this.pointed_node()); } //! Requires: value must be an lvalue and shall be in a set of diff --git a/include/boost/intrusive/sgtree.hpp b/include/boost/intrusive/sgtree.hpp index 2018d0a..85689bb 100644 --- a/include/boost/intrusive/sgtree.hpp +++ b/include/boost/intrusive/sgtree.hpp @@ -1453,6 +1453,8 @@ class sgtree_impl node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this) , node_ptr(&priv_header()) , get_real_value_traits().to_node_ptr(with_this)); + if(safemode_or_autounlink) + node_algorithms::init(replace_this.pointed_node()); } //! Requires: value must be an lvalue and shall be in a set of diff --git a/include/boost/intrusive/splaytree.hpp b/include/boost/intrusive/splaytree.hpp index 244cb0e..d378d41 100644 --- a/include/boost/intrusive/splaytree.hpp +++ b/include/boost/intrusive/splaytree.hpp @@ -1261,6 +1261,8 @@ class splaytree_impl node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this) , node_ptr(&priv_header()) , get_real_value_traits().to_node_ptr(with_this)); + if(safemode_or_autounlink) + node_algorithms::init(replace_this.pointed_node()); } //! Requires: value must be an lvalue and shall be in a set of diff --git a/include/boost/intrusive/treap.hpp b/include/boost/intrusive/treap.hpp index 9330b35..f2952ae 100644 --- a/include/boost/intrusive/treap.hpp +++ b/include/boost/intrusive/treap.hpp @@ -1387,6 +1387,8 @@ class treap_impl node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this) , node_ptr(&priv_header()) , get_real_value_traits().to_node_ptr(with_this)); + if(safemode_or_autounlink) + node_algorithms::init(replace_this.pointed_node()); } //! Requires: value must be an lvalue and shall be in a set of diff --git a/include/boost/intrusive/unordered_set.hpp b/include/boost/intrusive/unordered_set.hpp index 2b40f61..4f47b5f 100644 --- a/include/boost/intrusive/unordered_set.hpp +++ b/include/boost/intrusive/unordered_set.hpp @@ -39,7 +39,7 @@ namespace intrusive { //! The container supports the following options: //! \c base_hook<>/member_hook<>/value_traits<>, //! \c constant_time_size<>, \c size_type<>, \c hash<> and \c equal<> -//! \c bucket_traits<>, power_2_buckets<> and cache_begin<>. +//! \c bucket_traits<>, \c power_2_buckets<> and \c cache_begin<>. //! //! unordered_set only provides forward iterators but it provides 4 iterator types: //! iterator and const_iterator to navigate through the whole container and @@ -1096,7 +1096,7 @@ class unordered_set //! The container supports the following options: //! \c base_hook<>/member_hook<>/value_traits<>, //! \c constant_time_size<>, \c size_type<>, \c hash<> and \c equal<> -//! \c bucket_traits<>, power_2_buckets<> and cache_begin<>. +//! \c bucket_traits<>, \c power_2_buckets<> and \c cache_begin<>. //! //! unordered_multiset only provides forward iterators but it provides 4 iterator types: //! iterator and const_iterator to navigate through the whole container and