From 01d575bed41af77d0dd36069d75781b250f159f5 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 14 Dec 2018 18:46:28 +0300 Subject: [PATCH] Fix compilation in case if key is void*, again. This commit fixes a compilation error with gcc 8.2 about ambiguous function calls in tree_value_compare when the user specifies a key that has type void*. The fix take approach similar to https://github.com/boostorg/intrusive/pull/21. --- .../intrusive/detail/tree_value_compare.hpp | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/include/boost/intrusive/detail/tree_value_compare.hpp b/include/boost/intrusive/detail/tree_value_compare.hpp index c78da0a..6b05f22 100644 --- a/include/boost/intrusive/detail/tree_value_compare.hpp +++ b/include/boost/intrusive/detail/tree_value_compare.hpp @@ -27,7 +27,7 @@ namespace boost{ namespace intrusive{ //Needed to support smart references to value types -template +template struct disable_if_smartref_to : detail::disable_if_c < detail::is_same @@ -39,7 +39,8 @@ struct disable_if_smartref_to < typename pointer_rebind < ValuePtr , const typename boost::movelib::pointer_element::type>::type> - ::reference>::value + ::reference>::value, + R > {}; @@ -51,6 +52,10 @@ template< class ValuePtr, class KeyCompare, class KeyOfValue, class Ret = bool struct tree_value_compare : public boost::intrusive::detail::ebo_functor_holder { +private: + struct sfinae_type; + +public: typedef typename boost::movelib::pointer_element::type value_type; typedef KeyCompare key_compare; @@ -88,7 +93,7 @@ struct tree_value_compare template BOOST_INTRUSIVE_FORCEINLINE Ret operator()( const U &nonkey - , typename disable_if_smartref_to::type* = 0) const + , typename disable_if_smartref_to::type = 0) const { return this->key_comp()(nonkey); } BOOST_INTRUSIVE_FORCEINLINE Ret operator()(const key_type &key1, const key_type &key2) const @@ -105,22 +110,22 @@ struct tree_value_compare template BOOST_INTRUSIVE_FORCEINLINE Ret operator()( const key_type &key1, const U &nonkey2 - , typename disable_if_smartref_to::type* = 0) const + , typename disable_if_smartref_to::type = 0) const { return this->key_comp()(key1, nonkey2); } template BOOST_INTRUSIVE_FORCEINLINE Ret operator()( const U &nonkey1, const key_type &key2 - , typename disable_if_smartref_to::type* = 0) const + , typename disable_if_smartref_to::type = 0) const { return this->key_comp()(nonkey1, key2); } template BOOST_INTRUSIVE_FORCEINLINE Ret operator()( const value_type &value1, const U &nonvalue2 - , typename disable_if_smartref_to::type* = 0) const + , typename disable_if_smartref_to::type = 0) const { return this->key_comp()(KeyOfValue()(value1), nonvalue2); } template BOOST_INTRUSIVE_FORCEINLINE Ret operator()( const U &nonvalue1, const value_type &value2 - , typename disable_if_smartref_to::type* = 0) const + , typename disable_if_smartref_to::type = 0) const { return this->key_comp()(nonvalue1, KeyOfValue()(value2)); } }; @@ -128,6 +133,10 @@ template struct tree_value_compare : public boost::intrusive::detail::ebo_functor_holder { +private: + struct sfinae_type; + +public: typedef typename boost::movelib::pointer_element::type value_type; typedef KeyCompare key_compare; @@ -163,7 +172,7 @@ struct tree_value_compare template BOOST_INTRUSIVE_FORCEINLINE Ret operator()( const U &nonkey - , typename disable_if_smartref_to::type* = 0) const + , typename disable_if_smartref_to::type = 0) const { return this->key_comp()(nonkey); } BOOST_INTRUSIVE_FORCEINLINE Ret operator()(const key_type &key1, const key_type &key2) const @@ -171,12 +180,12 @@ struct tree_value_compare template BOOST_INTRUSIVE_FORCEINLINE Ret operator()( const key_type &key1, const U &nonkey2 - , typename disable_if_smartref_to::type* = 0) const + , typename disable_if_smartref_to::type = 0) const { return this->key_comp()(key1, nonkey2); } template BOOST_INTRUSIVE_FORCEINLINE Ret operator()(const U &nonkey1, const key_type &key2 - , typename disable_if_smartref_to::type* = 0) const + , typename disable_if_smartref_to::type = 0) const { return this->key_comp()(nonkey1, key2); } };