diff --git a/include/boost/unordered/detail/allocator_helpers.hpp b/include/boost/unordered/detail/allocator_helpers.hpp index 07fbba72..728c7f0e 100644 --- a/include/boost/unordered/detail/allocator_helpers.hpp +++ b/include/boost/unordered/detail/allocator_helpers.hpp @@ -85,21 +85,27 @@ namespace boost { namespace unordered { namespace detail { template convertible_from_anything(T const&); }; + typedef char (&no_type)[1]; + typedef char (&yes_type)[2]; + + template struct sfinae { + typedef yes_type type; + }; + // Infrastructure for providing a default type for Tp::tname if absent. #define BOOST_DEFAULT_TYPE_TMPLT(tname) \ template \ struct default_type_ ## tname { \ + template \ + static BOOST_DEDUCED_TYPENAME sfinae< \ + BOOST_DEDUCED_TYPENAME T::tname>::type test(int); \ + template \ + static no_type test(...); \ \ - template \ - static char test(int, BOOST_DEDUCED_TYPENAME X::tname*); \ - \ - template \ - static int test(convertible_from_anything, void*); \ + enum { value = sizeof(test(0)) == sizeof(yes_type) }; \ \ struct DefaultWrap { typedef Default tname; }; \ \ - static const bool value = (1 == sizeof(test(0, 0))); \ - \ typedef BOOST_DEDUCED_TYPENAME \ boost::detail::if_true:: \ BOOST_NESTED_TEMPLATE then \