From ae93df82eab217ab4cb8f9c7cd734b70bed7201d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Fri, 13 Nov 2020 23:43:02 +0100 Subject: [PATCH] Fixes #164 ("Compile error when using `pmr::map` with a `std::pair`; works when using a `std::tuple`") --- doc/container.qbk | 1 + .../detail/dispatch_uses_allocator.hpp | 36 +++++++++---------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/doc/container.qbk b/doc/container.qbk index 9baf77a..187f62c 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -1343,6 +1343,7 @@ use [*Boost.Container]? There are several reasons for that: * Added [[no-discard]] attribute in all containers to catch bugs related to unused return values. * Fixed bugs/issues: * [@https://github.com/boostorg/container/issues/171 GitHub #171: ['"deque::clear() uses undefined behaviour"]]. + * [@https://github.com/boostorg/container/issues/164 GitHub #164: ['"Compile error when using `pmr::map` with a `std::pair`; works when using a `std::tuple`"]]. [endsect] diff --git a/include/boost/container/detail/dispatch_uses_allocator.hpp b/include/boost/container/detail/dispatch_uses_allocator.hpp index f9e761b..24f0316 100644 --- a/include/boost/container/detail/dispatch_uses_allocator.hpp +++ b/include/boost/container/detail/dispatch_uses_allocator.hpp @@ -225,9 +225,9 @@ BOOST_CONTAINER_DOC1ST(void, typename dtl::enable_if BOOST_MO , BOOST_FWD_REF(ArgAlloc) arg_alloc , Pair* p) { - (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->first)); + dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->first)); BOOST_TRY{ - (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->second)); + dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->second)); } BOOST_CATCH(...) { allocator_traits::destroy(construct_alloc, dtl::addressof(p->first)); @@ -246,9 +246,9 @@ BOOST_CONTAINER_DOC1ST(void, typename dtl::enable_if BOOST_MO , BOOST_FWD_REF(ArgAlloc) arg_alloc , Pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) { - (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward(x)); + dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward(x)); BOOST_TRY{ - (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->second), ::boost::forward(y)); + dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->second), ::boost::forward(y)); } BOOST_CATCH(...){ allocator_traits::destroy(construct_alloc, dtl::addressof(p->first)); @@ -265,7 +265,7 @@ BOOST_CONTAINER_DOC1ST(void, typename dtl::enable_if< dtl::is_pair BOOST_M (ConstructAlloc & construct_alloc , BOOST_FWD_REF(ArgAlloc) arg_alloc , Pair* p, Pair2& x) -{ (dispatch_uses_allocator)(construct_alloc, arg_alloc, p, x.first, x.second); } +{ dispatch_uses_allocator(construct_alloc, arg_alloc, p, x.first, x.second); } template < typename ConstructAlloc , typename ArgAlloc @@ -278,7 +278,7 @@ typename dtl::enable_if_and (ConstructAlloc & construct_alloc , BOOST_FWD_REF(ArgAlloc) arg_alloc , Pair* p, BOOST_RV_REF_BEG Pair2 BOOST_RV_REF_END x) -{ (dispatch_uses_allocator)(construct_alloc, arg_alloc, p, ::boost::move(x.first), ::boost::move(x.second)); } +{ dispatch_uses_allocator(construct_alloc, arg_alloc, p, ::boost::move(x.first), ::boost::move(x.second)); } //piecewise construction from boost::tuple @@ -292,10 +292,10 @@ typename dtl::enable_if< dtl::is_pair BOOST_MOVE_I void>::type\ , BoostTuple q)\ {\ (void)p; (void)q;\ - (dispatch_uses_allocator)\ + dispatch_uses_allocator\ (construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_TMPL_GET##N);\ BOOST_TRY{\ - (dispatch_uses_allocator)\ + dispatch_uses_allocator\ (construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_TMPL_GETQ##M);\ }\ BOOST_CATCH(...) {\ @@ -317,9 +317,9 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO , Tuple& t1, Tuple& t2, index_tuple, index_tuple) { (void)t1; (void)t2; - (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(pair->first), ::boost::forward(get(t1))...); + dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(pair->first), ::boost::forward(get(t1))...); BOOST_TRY{ - (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(pair->second), ::boost::forward(get(t2))...); + dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(pair->second), ::boost::forward(get(t2))...); } BOOST_CATCH(...){ allocator_traits::destroy(construct_alloc, dtl::addressof(pair->first)); @@ -352,10 +352,10 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO , StdTuple q)\ {\ (void)p; (void)q;\ - (dispatch_uses_allocator)\ + dispatch_uses_allocator\ (construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\ BOOST_TRY{\ - (dispatch_uses_allocator)\ + dispatch_uses_allocator\ (construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\ }\ BOOST_CATCH(...) {\ @@ -387,10 +387,10 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO , StdTuple q)\ {\ (void)p; (void)q;\ - (dispatch_uses_allocator)\ + dispatch_uses_allocator\ (construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\ BOOST_TRY{\ - (dispatch_uses_allocator)\ + dispatch_uses_allocator\ (construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\ }\ BOOST_CATCH(...) {\ @@ -415,9 +415,9 @@ typename dtl::enable_if< dtl::is_pair, void >::type dispatch_uses_allocator (ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* p, try_emplace_t, BOOST_FWD_REF(KeyType) k, BOOST_FWD_REF(Args) ...args) { - (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward(k)); + dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward(k)); BOOST_TRY{ - (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->second), ::boost::forward(args)...); + dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->second), ::boost::forward(args)...); } BOOST_CATCH(...) { allocator_traits::destroy(construct_alloc, dtl::addressof(p->first)); @@ -436,9 +436,9 @@ typename dtl::enable_if< dtl::is_pair, void >::type (ConstructAlloc &construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* p, try_emplace_t, \ BOOST_FWD_REF(KeyType) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ - (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward(k));\ + dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward(k));\ BOOST_TRY{\ - (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->second) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ + dispatch_uses_allocator(construct_alloc, arg_alloc, dtl::addressof(p->second) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ }\ BOOST_CATCH(...) {\ allocator_traits::destroy(construct_alloc, dtl::addressof(p->first));\