From cdd6d9ad8af0e057f5b3507757e754017ee4b114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Mon, 31 Aug 2020 22:21:41 +0200 Subject: [PATCH] Fixes #160 ("Usage of uses_allocator needs a remove_cvref_t") --- doc/container.qbk | 4 +++- .../container/detail/dispatch_uses_allocator.hpp | 12 ++++++------ include/boost/container/detail/type_traits.hpp | 1 + test/uses_allocator_test.cpp | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/container.qbk b/doc/container.qbk index ed389d1..be59adc 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -1342,7 +1342,9 @@ use [*Boost.Container]? There are several reasons for that: * New [classref boost::container::devector devector] container. * Fixed bugs/issues: - * [@https://github.com/boostorg/container/issues/157 GitHub #157: ['"Add missing include"]]. + * [@https://github.com/boostorg/container/pull/157 GitHub #157: ['"Add missing include"]]. + * [@https://github.com/boostorg/container/issues/160 GitHub #160: ['"Usage of uses_allocator needs a remove_cvref_t"]]. + * [@https://github.com/boostorg/container/issues/161 GitHub #161: ['"polymorphic_allocator(memory_resource*) non-standard extension causes headache"]]. [endsect] diff --git a/include/boost/container/detail/dispatch_uses_allocator.hpp b/include/boost/container/detail/dispatch_uses_allocator.hpp index e4ed7ab..f9e761b 100644 --- a/include/boost/container/detail/dispatch_uses_allocator.hpp +++ b/include/boost/container/detail/dispatch_uses_allocator.hpp @@ -113,7 +113,7 @@ template < typename ConstructAlloc BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and < void , dtl::is_not_pair - , dtl::not_< uses_allocator > + , dtl::not_< uses_allocator::type > > >::type dispatch_uses_allocator ( ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p, BOOST_FWD_REF(Args)...args) { @@ -130,7 +130,7 @@ template < typename ConstructAlloc BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and < void , dtl::is_not_pair - , uses_allocator + , uses_allocator::type> , is_constructible_with_allocator_prefix >::type dispatch_uses_allocator ( ConstructAlloc& construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p, BOOST_FWD_REF(Args) ...args) @@ -149,7 +149,7 @@ template < typename ConstructAlloc BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and < void , dtl::is_not_pair - , uses_allocator + , uses_allocator::type> , dtl::not_ > >::type dispatch_uses_allocator ( ConstructAlloc& construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p, BOOST_FWD_REF(Args)...args) @@ -165,7 +165,7 @@ BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and\ < void\ , dtl::is_not_pair\ - , dtl::not_ >\ + , dtl::not_::type> >\ >::type\ dispatch_uses_allocator\ (ConstructAlloc &construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ @@ -182,7 +182,7 @@ BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and\ < void\ , dtl::is_not_pair\ - , uses_allocator\ + , uses_allocator::type>\ , is_constructible_with_allocator_prefix\ >::type\ dispatch_uses_allocator\ @@ -200,7 +200,7 @@ BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and\ < void\ , dtl::is_not_pair\ - , uses_allocator\ + , uses_allocator::type>\ , dtl::not_ >\ >::type\ dispatch_uses_allocator\ diff --git a/include/boost/container/detail/type_traits.hpp b/include/boost/container/detail/type_traits.hpp index 5e90154..b5250d6 100644 --- a/include/boost/container/detail/type_traits.hpp +++ b/include/boost/container/detail/type_traits.hpp @@ -40,6 +40,7 @@ using ::boost::move_detail::add_const; using ::boost::move_detail::add_const_reference; using ::boost::move_detail::remove_const; using ::boost::move_detail::remove_reference; +using ::boost::move_detail::remove_cvref; using ::boost::move_detail::make_unsigned; using ::boost::move_detail::is_floating_point; using ::boost::move_detail::is_integral; diff --git a/test/uses_allocator_test.cpp b/test/uses_allocator_test.cpp index cb88a2b..16ab4cd 100644 --- a/test/uses_allocator_test.cpp +++ b/test/uses_allocator_test.cpp @@ -21,7 +21,7 @@ struct uses_allocator_and_not_convertible_to_int struct uses_allocator_and_convertible_to_int { - typedef char allocator_type; + typedef long allocator_type; }; struct uses_erased_type_allocator