From b6e3f2303ff50d6474842dffc024bfde994993df Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 1 Mar 2017 00:13:02 +0000 Subject: [PATCH 1/4] Fix call to try_emplace_impl --- include/boost/unordered/unordered_map.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp index 0ff64fbf..64e5b1fd 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -343,7 +343,9 @@ template class unordered_map std::pair try_emplace( BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0) { - return table_.try_emplace_impl(boost::move(k), boost::forward(a0)); + return table_.try_emplace_impl( + boost::move(k), boost::unordered::detail::create_emplace_args( + boost::forward(a0))); } template @@ -351,7 +353,8 @@ template class unordered_map const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0) { return table_.try_emplace_hint_impl( - hint, boost::move(k), boost::forward(a0)); + hint, boost::move(k), boost::unordered::detail::create_emplace_args( + boost::forward(a0))); } template From 91bbd5fcb220302d04f01e2855b72f0ae826869c Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 1 Mar 2017 16:46:18 +0000 Subject: [PATCH 2/4] Make emplace_args1 constructor explicit --- include/boost/unordered/detail/implementation.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index a7a2d186..aa77aa39 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -492,7 +492,7 @@ template struct emplace_args1 { BOOST_UNORDERED_EARGS_MEMBER(1, 0, _) - emplace_args1(Arg0 b0) : a0(b0) {} + explicit emplace_args1(Arg0 b0) : a0(b0) {} }; template From 68fe365f5b096423b5e2fd8f6174476c4b5c0485 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 1 Mar 2017 16:50:05 +0000 Subject: [PATCH 3/4] Try to avoid Visual C++ warning C4800 --- test/unordered/extract_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unordered/extract_tests.cpp b/test/unordered/extract_tests.cpp index 9fcd1360..8e792793 100644 --- a/test/unordered/extract_tests.cpp +++ b/test/unordered/extract_tests.cpp @@ -44,7 +44,7 @@ void extract_tests1(Container*, test::random_generator generator) std::size_t new_size = count ? old_size - 1 : old_size; typename Container::node_type n = x.extract(test::get_key(*it)); - BOOST_TEST((bool)n == (bool)count); + BOOST_TEST((n ? true : false) == (count ? true : false)); BOOST_TEST(x.size() == new_size); BOOST_TEST(x.count(test::get_key(*it)) == new_count); if (!new_count) { From 0af2c732ab75eb2ca9afdb437d119cac1e20cb16 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 1 Mar 2017 16:52:43 +0000 Subject: [PATCH 4/4] Fix use of BOOST_STATIC_ASSERT for older preprocessors --- test/unordered/compile_tests.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unordered/compile_tests.hpp b/test/unordered/compile_tests.hpp index c84b04e9..fb908ffd 100644 --- a/test/unordered/compile_tests.hpp +++ b/test/unordered/compile_tests.hpp @@ -148,8 +148,8 @@ template void container_test(X& r, T const&) // node_type typedef BOOST_DEDUCED_TYPENAME X::node_type node_type; - BOOST_STATIC_ASSERT(boost::is_same::value); + BOOST_STATIC_ASSERT((boost::is_same::value)); node_type n1; node_type n2(rvalue_default());