diff --git a/include/boost/unordered/detail/allocator_helpers.hpp b/include/boost/unordered/detail/allocator_helpers.hpp index e1caf87c..88dfde6f 100644 --- a/include/boost/unordered/detail/allocator_helpers.hpp +++ b/include/boost/unordered/detail/allocator_helpers.hpp @@ -97,20 +97,7 @@ namespace boost { namespace unordered { namespace detail { struct choice1 : choice2 { typedef char (&type)[1]; }; choice1 choose(); -#if !defined(__IBMCPP__) - -#define BOOST_UNORDERED_MEMBER_CHECK(tname) BOOST_DEDUCED_TYPENAME X::tname* - -#else - - template struct wrap { typedef void* type; }; - -#define BOOST_UNORDERED_MEMBER_CHECK(tname) \ - BOOST_DEDUCED_TYPENAME wrap< \ - BOOST_DEDUCED_TYPENAME X::tname \ - >::type - -#endif +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1400 #define BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(tname) \ template \ @@ -118,7 +105,7 @@ namespace boost { namespace unordered { namespace detail { \ template \ static choice1::type test(choice1, \ - BOOST_UNORDERED_MEMBER_CHECK(tname) = 0); \ + BOOST_DEDUCED_TYPENAME X::tname* = 0); \ \ template \ static choice2::type test(choice2, void* = 0); \ @@ -133,6 +120,35 @@ namespace boost { namespace unordered { namespace detail { ::type::tname type; \ } +#else + + template + struct sfinae : T2 {}; + + #define BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(tname) \ + template \ + struct default_type_ ## tname { \ + \ + template \ + static BOOST_DEDUCED_TYPENAME sfinae< \ + BOOST_DEDUCED_TYPENAME X::tname, choice1>::type \ + test(choice1); \ + \ + template \ + static choice2::type test(choice2); \ + \ + struct DefaultWrap { typedef Default tname; }; \ + \ + enum { value = (1 == sizeof(test(choose()))) }; \ + \ + typedef BOOST_DEDUCED_TYPENAME \ + boost::detail::if_true:: \ + BOOST_NESTED_TEMPLATE then \ + ::type::tname type; \ + } + +#endif + #define BOOST_UNORDERED_DEFAULT_TYPE(T,tname, arg) \ BOOST_DEDUCED_TYPENAME default_type_ ## tname::type