diff --git a/include/boost/unordered/detail/foa.hpp b/include/boost/unordered/detail/foa.hpp index 3e0399b1..8342e57c 100644 --- a/include/boost/unordered/detail/foa.hpp +++ b/include/boost/unordered/detail/foa.hpp @@ -1084,43 +1084,6 @@ private: static constexpr bool has_mutable_iterator= !std::is_same::value; - template< - typename T, - typename RawT=typename std::remove_cv< - typename std::remove_reference::type>::type - > - using value_from_return_type=typename std::conditional< - std::is_same::value||std::is_same::value, - T, - typename std::conditional< - std::is_convertible::value, - init_type, - typename std::conditional< - std::is_convertible::value, - value_type, - typename std::conditional< - std::is_convertible::value, - const init_type&, - typename std::conditional< - std::is_convertible::value, - const value_type&, - void - >::type - >::type - >::type - >::type - >::type; - - template< - typename T, - typename std::enable_if< - !std::is_void>::value>::type* =nullptr - > - static inline value_from_return_type value_from(T&& x) - { - return std::forward(x); - } - public: using hasher=Hash; using key_equal=Pred; @@ -1306,17 +1269,21 @@ public: std::forward_as_tuple(std::forward(args)...)); } - template - BOOST_FORCEINLINE auto insert(T&& x) - ->decltype(value_from(std::forward(x)),std::pair()) - { - return emplace_impl(value_from(std::forward(x))); - } + BOOST_FORCEINLINE std::pair + insert(const init_type& x){return emplace_impl(x);} - BOOST_FORCEINLINE std::pair insert(init_type&& x) - { - return emplace_impl(std::move(x)); - } + BOOST_FORCEINLINE std::pair + insert(init_type&& x){return emplace_impl(std::move(x));} + + /* template tilts call ambiguities in favor of init_type */ + + template + BOOST_FORCEINLINE std::pair + insert(const value_type& x){return emplace_impl(x);} + + template + BOOST_FORCEINLINE std::pair + insert(value_type&& x){return emplace_impl(std::move(x));} template< bool dependent_value=false,