From 12ee566796c24e967d0297d3fc7fd1d9896c0bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Wed, 17 Dec 2014 15:45:05 +0100 Subject: [PATCH] Workaround for bugs #10771 and #6720. --- doc/intrusive.qbk | 2 ++ include/boost/intrusive/avltree_algorithms.hpp | 3 ++- include/boost/intrusive/bstree.hpp | 1 + .../boost/intrusive/detail/key_nodeptr_comp.hpp | 3 ++- .../intrusive/detail/node_cloner_disposer.hpp | 6 ++++-- include/boost/intrusive/hashtable.hpp | 6 +++++- include/boost/intrusive/pointer_traits.hpp | 16 ++++++++-------- include/boost/intrusive/rbtree_algorithms.hpp | 3 ++- include/boost/intrusive/treap.hpp | 1 + 9 files changed, 27 insertions(+), 14 deletions(-) diff --git a/doc/intrusive.qbk b/doc/intrusive.qbk index 988313f..127eb9c 100644 --- a/doc/intrusive.qbk +++ b/doc/intrusive.qbk @@ -3765,6 +3765,8 @@ to be inserted in intrusive containers are allocated using `std::vector` or `std * Reduced compile-time dependencies, headers, and the use of Boost.Preprocessor, specially for hooks and iterators. * Fixed bugs: + * [@https://svn.boost.org/trac/boost/ticket/6720 Boost Trac #6720: ['intrusive::unordered_set::clear_and_dispose does not compile on VC11 Beta when passed a stateless lambda]] + * [@https://svn.boost.org/trac/boost/ticket/10771 Boost Trac #10771: ['remove_if is broken for slist]] * [@https://svn.boost.org/trac/boost/ticket/10853 Boost Trac #10853: ['problem with detection of const_cast_from]] [endsect] diff --git a/include/boost/intrusive/avltree_algorithms.hpp b/include/boost/intrusive/avltree_algorithms.hpp index a0bdd77..8109035 100644 --- a/include/boost/intrusive/avltree_algorithms.hpp +++ b/include/boost/intrusive/avltree_algorithms.hpp @@ -35,7 +35,8 @@ namespace intrusive { template struct avltree_node_cloner - : private detail::ebo_functor_holder + //Use public inheritance to avoid MSVC bugs with closures + : public detail::ebo_functor_holder { typedef typename NodeTraits::node_ptr node_ptr; typedef detail::ebo_functor_holder base_t; diff --git a/include/boost/intrusive/bstree.hpp b/include/boost/intrusive/bstree.hpp index 879dc01..5743078 100644 --- a/include/boost/intrusive/bstree.hpp +++ b/include/boost/intrusive/bstree.hpp @@ -243,6 +243,7 @@ struct get_compare template struct bstbase2 //Put the (possibly empty) functor in the first position to get EBO in MSVC + //Use public inheritance to avoid MSVC bugs with closures : public detail::ebo_functor_holder::type> diff --git a/include/boost/intrusive/detail/key_nodeptr_comp.hpp b/include/boost/intrusive/detail/key_nodeptr_comp.hpp index bf7810b..3121546 100644 --- a/include/boost/intrusive/detail/key_nodeptr_comp.hpp +++ b/include/boost/intrusive/detail/key_nodeptr_comp.hpp @@ -26,7 +26,8 @@ namespace detail { template struct key_nodeptr_comp - : private ebo_functor_holder + //Use public inheritance to avoid MSVC bugs with closures + : public ebo_functor_holder { typedef ValueTraits value_traits; typedef typename value_traits::value_type value_type; diff --git a/include/boost/intrusive/detail/node_cloner_disposer.hpp b/include/boost/intrusive/detail/node_cloner_disposer.hpp index 2a18100..0368a3c 100644 --- a/include/boost/intrusive/detail/node_cloner_disposer.hpp +++ b/include/boost/intrusive/detail/node_cloner_disposer.hpp @@ -28,7 +28,8 @@ namespace detail { template struct node_cloner - : private ebo_functor_holder + //Use public inheritance to avoid MSVC bugs with closures + : public ebo_functor_holder { typedef ValueTraits value_traits; typedef typename value_traits::node_traits node_traits; @@ -78,7 +79,8 @@ struct node_cloner template struct node_disposer - : private ebo_functor_holder + //Use public inheritance to avoid MSVC bugs with closures + : public ebo_functor_holder { typedef ValueTraits value_traits; typedef typename value_traits::node_traits node_traits; diff --git a/include/boost/intrusive/hashtable.hpp b/include/boost/intrusive/hashtable.hpp index fa45bf1..f01d816 100644 --- a/include/boost/intrusive/hashtable.hpp +++ b/include/boost/intrusive/hashtable.hpp @@ -555,7 +555,8 @@ struct downcast_node_to_value_t template struct node_cast_adaptor - : private detail::ebo_functor_holder + //Use public inheritance to avoid MSVC bugs with closures + : public detail::ebo_functor_holder { typedef detail::ebo_functor_holder base_t; @@ -805,6 +806,7 @@ struct get_hash //Stores bucket_plus_vtraits plust the hash function template struct bucket_hash_t + //Use public inheritance to avoid MSVC bugs with closures : public detail::ebo_functor_holder ::value_traits::value_type @@ -857,6 +859,7 @@ struct get_equal_to //non-empty bucket shall not be cached. template struct bucket_hash_equal_t + //Use public inheritance to avoid MSVC bugs with closures : public detail::ebo_functor_holder //equal ::value_traits::value_type @@ -934,6 +937,7 @@ struct bucket_hash_equal_t //non-empty bucket shall be cached. template //cache_begin == true version struct bucket_hash_equal_t + //Use public inheritance to avoid MSVC bugs with closures : public detail::ebo_functor_holder //equal ::value_traits::value_type diff --git a/include/boost/intrusive/pointer_traits.hpp b/include/boost/intrusive/pointer_traits.hpp index 9be509b..b531da1 100644 --- a/include/boost/intrusive/pointer_traits.hpp +++ b/include/boost/intrusive/pointer_traits.hpp @@ -34,15 +34,15 @@ namespace intrusive { namespace detail { #if !defined(BOOST_MSVC) || (BOOST_MSVC > 1310) -BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_member_function_callable_with_pointer_to, pointer_to); -BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_member_function_callable_with_dynamic_cast_from, dynamic_cast_from); -BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_member_function_callable_with_static_cast_from, static_cast_from); -BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_member_function_callable_with_const_cast_from, const_cast_from); +BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_member_function_callable_with_pointer_to, pointer_to) +BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_member_function_callable_with_dynamic_cast_from, dynamic_cast_from) +BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_member_function_callable_with_static_cast_from, static_cast_from) +BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_member_function_callable_with_const_cast_from, const_cast_from) #else -BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED_IGNORE_SIGNATURE(has_member_function_callable_with_pointer_to, pointer_to); -BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED_IGNORE_SIGNATURE(has_member_function_callable_with_dynamic_cast_from, dynamic_cast_from); -BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED_IGNORE_SIGNATURE(has_member_function_callable_with_static_cast_from, static_cast_from); -BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED_IGNORE_SIGNATURE(has_member_function_callable_with_const_cast_from, const_cast_from); +BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED_IGNORE_SIGNATURE(has_member_function_callable_with_pointer_to, pointer_to) +BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED_IGNORE_SIGNATURE(has_member_function_callable_with_dynamic_cast_from, dynamic_cast_from) +BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED_IGNORE_SIGNATURE(has_member_function_callable_with_static_cast_from, static_cast_from) +BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED_IGNORE_SIGNATURE(has_member_function_callable_with_const_cast_from, const_cast_from) #endif BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(element_type) diff --git a/include/boost/intrusive/rbtree_algorithms.hpp b/include/boost/intrusive/rbtree_algorithms.hpp index 376deaf..63e4d12 100644 --- a/include/boost/intrusive/rbtree_algorithms.hpp +++ b/include/boost/intrusive/rbtree_algorithms.hpp @@ -44,7 +44,8 @@ namespace intrusive { template struct rbtree_node_cloner - : private detail::ebo_functor_holder + //Use public inheritance to avoid MSVC bugs with closures + : public detail::ebo_functor_holder { typedef typename NodeTraits::node_ptr node_ptr; typedef detail::ebo_functor_holder base_t; diff --git a/include/boost/intrusive/treap.hpp b/include/boost/intrusive/treap.hpp index 0438f98..77cd77f 100644 --- a/include/boost/intrusive/treap.hpp +++ b/include/boost/intrusive/treap.hpp @@ -80,6 +80,7 @@ template + //Use public inheritance to avoid MSVC bugs with closures , public detail::ebo_functor_holder < typename get_prio < VoidOrPrioComp