From 597d93537d03e18d5deb5d7fe1798f173c3664ae Mon Sep 17 00:00:00 2001 From: Daniel James Date: Thu, 6 Oct 2011 21:06:35 +0000 Subject: [PATCH] Unordered: More cleaning up. Fix deprecated construct_impl and explicit namespaces in a few places. [SVN r74766] --- .../unordered/detail/allocator_helpers.hpp | 57 ++++++++++++------- .../boost/unordered/detail/emplace_args.hpp | 18 +++--- .../boost/unordered/detail/extract_key.hpp | 3 +- 3 files changed, 47 insertions(+), 31 deletions(-) diff --git a/include/boost/unordered/detail/allocator_helpers.hpp b/include/boost/unordered/detail/allocator_helpers.hpp index 366de1cc..6751a9ec 100644 --- a/include/boost/unordered/detail/allocator_helpers.hpp +++ b/include/boost/unordered/detail/allocator_helpers.hpp @@ -133,7 +133,8 @@ namespace boost { namespace unordered { namespace detail { #define BOOST_UNORDERED_HAS_FUNCTION(name, thing, args, _) \ struct BOOST_PP_CAT(has_, name) \ { \ - BOOST_UNORDERED_CHECK_EXPRESSION(1, 1, make< thing >().name args); \ + BOOST_UNORDERED_CHECK_EXPRESSION(1, 1, \ + boost::unordered::detail::make< thing >().name args); \ BOOST_UNORDERED_DEFAULT_EXPRESSION(2, 2); \ \ enum { value = sizeof(test(choose())) == sizeof(choice1::type) };\ @@ -149,7 +150,8 @@ namespace boost { namespace unordered { namespace detail { #define BOOST_UNORDERED_CHECK_MEMBER(count, result, name, member) \ \ - typedef typename identity::type BOOST_PP_CAT(check, count); \ + typedef typename boost::unordered::detail::identity::type \ + BOOST_PP_CAT(check, count); \ \ template \ struct BOOST_PP_CAT(test, count) { \ @@ -207,7 +209,8 @@ namespace boost { namespace unordered { namespace detail { { \ enum { value = sizeof( \ boost::unordered::detail::is_private_type(( \ - make >().name args \ + boost::unordered::detail::make >() \ + .name args \ , 0))) == sizeof(yes_type) }; \ }; \ \ @@ -329,12 +332,14 @@ namespace boost { namespace unordered { namespace detail { #if BOOST_UNORDERED_HAVE_CALL_N_DETECTION template BOOST_UNORDERED_HAS_FUNCTION( - construct, U, (make(), make()), 2 + construct, U, ( + boost::unordered::detail::make(), + boost::unordered::detail::make()), 2 ); template BOOST_UNORDERED_HAS_FUNCTION( - destroy, U, (make()), 1 + destroy, U, (boost::unordered::detail::make()), 1 ); #else template @@ -345,31 +350,35 @@ namespace boost { namespace unordered { namespace detail { #endif template - inline typename boost::enable_if< - has_select_on_container_copy_construction, Alloc + inline typename boost::enable_if_c< + boost::unordered::detail:: + has_select_on_container_copy_construction::value, Alloc >::type call_select_on_container_copy_construction(const Alloc& rhs) { return rhs.select_on_container_copy_construction(); } template - inline typename boost::disable_if< - has_select_on_container_copy_construction, Alloc + inline typename boost::disable_if_c< + boost::unordered::detail:: + has_select_on_container_copy_construction::value, Alloc >::type call_select_on_container_copy_construction(const Alloc& rhs) { return rhs; } template - SizeType call_max_size(const Alloc& a, - typename boost::enable_if, void*>::type = 0) + inline typename boost::enable_if_c< + boost::unordered::detail::has_max_size::value, SizeType + >::type call_max_size(const Alloc& a) { return a.max_size(); } template - SizeType call_max_size(const Alloc&, - typename boost::disable_if, void*>::type = 0) + inline typename boost::disable_if_c< + boost::unordered::detail::has_max_size::value, SizeType + >::type call_max_size(const Alloc&) { return std::numeric_limits::max(); } @@ -423,29 +432,33 @@ namespace boost { namespace unordered { namespace detail { // Only supporting the basic copy constructor for now. template - static void construct(Alloc& a, T* p, T const& x, typename - boost::enable_if, void*>::type = 0) + static typename boost::enable_if_c< + boost::unordered::detail::has_construct::value>::type + construct(Alloc& a, T* p, T const& x) { a.construct(p, x); } template - static void construct(Alloc&, T* p, T const& x, typename - boost::disable_if, void*>::type = 0) + static typename boost::disable_if_c< + boost::unordered::detail::has_construct::value>::type + construct(Alloc&, T* p, T const& x) { - new (p) T(x); + new ((void*) p) T(x); } template - static void destroy(Alloc& a, T* p, typename - boost::enable_if, void*>::type = 0) + static typename boost::enable_if_c< + boost::unordered::detail::has_destroy::value>::type + destroy(Alloc& a, T* p) { a.destroy(p); } template - static void destroy(Alloc&, T* p, typename - boost::disable_if, void*>::type = 0) + static typename boost::disable_if_c< + boost::unordered::detail::has_destroy::value>::type + destroy(Alloc&, T* p) { boost::unordered::detail::destroy(p); } diff --git a/include/boost/unordered/detail/emplace_args.hpp b/include/boost/unordered/detail/emplace_args.hpp index 10017468..f396066e 100644 --- a/include/boost/unordered/detail/emplace_args.hpp +++ b/include/boost/unordered/detail/emplace_args.hpp @@ -160,7 +160,7 @@ BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, BOOST_UNORDERED_EARGS, boost::detail::if_true< boost::is_class::value >::BOOST_NESTED_TEMPLATE then < - rv_ref_impl, + boost::unordered::detail::rv_ref_impl, please_ignore_this_overload >::type {}; @@ -227,7 +227,8 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std::tr1) static choice3::type check(choice3, ...); enum { value = - sizeof(check(choose(), make())) == sizeof(choice2::type) }; + sizeof(check(choose(), boost::unordered::detail::make())) == + sizeof(choice2::type) }; }; #endif @@ -242,7 +243,8 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std::tr1) static choice3::type check(choice3, ...); - enum { value = sizeof(check(choose(), make())) }; + enum { value = + sizeof(check(choose(), boost::unordered::detail::make())) }; }; template @@ -273,9 +275,9 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std::tr1) inline typename enable_if, void>::type construct_impl(std::pair* address, A0&&, A1&& a1, A2&& a2) { - construct_from_tuple( + boost::unordered::detail::construct_from_tuple( boost::addressof(address->first), a1); - construct_from_tuple( + boost::unordered::detail::construct_from_tuple( boost::addressof(address->second), a2); } @@ -291,7 +293,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std::tr1) template inline typename enable_if, void>::type - construct_impl(T* address, A0&& a0, A1&& a1, A2&& a2) + construct_impl(std::pair* address, A0&& a0, A1&& a1, A2&& a2) { new((void*) boost::addressof(address->first)) A(std::forward(a0)); new((void*) boost::addressof(address->second)) B( @@ -345,9 +347,9 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std::tr1) construct_impl(std::pair* address, boost::unordered::detail::emplace_args3 const& args) { - construct_from_tuple( + boost::unordered::detail::construct_from_tuple( boost::addressof(address->first), args.a1); - construct_from_tuple( + boost::unordered::detail::construct_from_tuple( boost::addressof(address->second), args.a2); } diff --git a/include/boost/unordered/detail/extract_key.hpp b/include/boost/unordered/detail/extract_key.hpp index 55fe61ed..3ac292f0 100644 --- a/include/boost/unordered/detail/extract_key.hpp +++ b/include/boost/unordered/detail/extract_key.hpp @@ -33,7 +33,8 @@ namespace detail { static choice1::type test(T2 const&); static choice2::type test(Key const&); - enum { value = sizeof(test(make())) == sizeof(choice2::type) }; + enum { value = sizeof(test(boost::unordered::detail::make())) == + sizeof(choice2::type) }; typedef typename boost::detail::if_true:: BOOST_NESTED_TEMPLATE then::type type;