diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp index 8ef037ae..5c941f75 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -489,18 +489,28 @@ template class unordered_map #else + // In order to make this a template, this handles both: + // try_emplace(key const&) + // try_emplace(key&&) + template std::pair try_emplace(BOOST_FWD_REF(Key) k) { return table_.try_emplace_unique(boost::forward(k)); } + // In order to make this a template, this handles both: + // try_emplace(const_iterator hint, key const&) + // try_emplace(const_iterator hint, key&&) + template iterator try_emplace(const_iterator hint, BOOST_FWD_REF(Key) k) { return table_.try_emplace_hint_unique(hint, boost::forward(k)); } + // try_emplace(key const&, Args&&...) + template std::pair try_emplace( key_type const& k, BOOST_FWD_REF(A0) a0) @@ -510,33 +520,6 @@ template class unordered_map boost::forward(a0))); } - template - iterator try_emplace( - const_iterator hint, key_type const& k, BOOST_FWD_REF(A0) a0) - { - return table_.try_emplace_hint_unique( - hint, k, boost::unordered::detail::create_emplace_args( - boost::forward(a0))); - } - - template - std::pair try_emplace( - BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0) - { - return table_.try_emplace_unique( - boost::move(k), boost::unordered::detail::create_emplace_args( - boost::forward(a0))); - } - - template - iterator try_emplace( - const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0) - { - return table_.try_emplace_hint_unique( - hint, boost::move(k), boost::unordered::detail::create_emplace_args( - boost::forward(a0))); - } - template std::pair try_emplace( key_type const& k, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1) @@ -546,35 +529,6 @@ template class unordered_map boost::forward(a0), boost::forward(a1))); } - template - iterator try_emplace(const_iterator hint, key_type const& k, - BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1) - { - return table_.try_emplace_hint_unique( - hint, k, boost::unordered::detail::create_emplace_args( - boost::forward(a0), boost::forward(a1))); - } - - template - std::pair try_emplace( - BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1) - { - return table_.try_emplace_unique( - boost::move(k), - boost::unordered::detail::create_emplace_args( - boost::forward(a0), boost::forward(a1))); - } - - template - iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k, - BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1) - { - return table_.try_emplace_hint_unique( - hint, boost::move(k), - boost::unordered::detail::create_emplace_args( - boost::forward(a0), boost::forward(a1))); - } - template std::pair try_emplace(key_type const& k, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) @@ -585,6 +539,26 @@ template class unordered_map boost::forward(a2))); } + // try_emplace(const_iterator hint, key const&, Args&&...) + + template + iterator try_emplace( + const_iterator hint, key_type const& k, BOOST_FWD_REF(A0) a0) + { + return table_.try_emplace_hint_unique( + hint, k, boost::unordered::detail::create_emplace_args( + boost::forward(a0))); + } + + template + iterator try_emplace(const_iterator hint, key_type const& k, + BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1) + { + return table_.try_emplace_hint_unique( + hint, k, boost::unordered::detail::create_emplace_args( + boost::forward(a0), boost::forward(a1))); + } + template iterator try_emplace(const_iterator hint, key_type const& k, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) @@ -597,6 +571,27 @@ template class unordered_map .first; } + // try_emplace(key&&, Args&&...) + + template + std::pair try_emplace( + BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0) + { + return table_.try_emplace_unique( + boost::move(k), boost::unordered::detail::create_emplace_args( + boost::forward(a0))); + } + + template + std::pair try_emplace( + BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1) + { + return table_.try_emplace_unique( + boost::move(k), + boost::unordered::detail::create_emplace_args( + boost::forward(a0), boost::forward(a1))); + } + template std::pair try_emplace(BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) @@ -607,6 +602,27 @@ template class unordered_map boost::forward(a2))); } + // try_emplace(const_iterator hint, key&&, Args&&...) + + template + iterator try_emplace( + const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0) + { + return table_.try_emplace_hint_unique( + hint, boost::move(k), boost::unordered::detail::create_emplace_args( + boost::forward(a0))); + } + + template + iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k, + BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1) + { + return table_.try_emplace_hint_unique( + hint, boost::move(k), + boost::unordered::detail::create_emplace_args( + boost::forward(a0), boost::forward(a1))); + } + template iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)