Add missing insert(P&&) methods to unordered_map/unordered_multimap

This commit is contained in:
Daniel James
2017-04-15 17:35:08 +01:00
parent 5d98f3d0f0
commit 972ac220f5

View File

@ -17,6 +17,7 @@
#include <boost/core/explicit_operator_bool.hpp>
#include <boost/functional/hash.hpp>
#include <boost/move/move.hpp>
#include <boost/type_traits/is_constructible.hpp>
#include <boost/unordered/detail/map.hpp>
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
@ -545,6 +546,15 @@ template <class K, class T, class H, class P, class A> class unordered_map
return this->emplace(boost::move(x));
}
template <class P2>
std::pair<iterator, bool> insert(BOOST_RV_REF(P2) obj,
typename boost::enable_if_c<
boost::is_constructible<value_type, BOOST_RV_REF(P2)>::value,
void*>::type = 0)
{
return this->emplace(boost::forward<P2>(obj));
}
iterator insert(const_iterator hint, value_type const& x)
{
return this->emplace_hint(hint, x);
@ -555,6 +565,15 @@ template <class K, class T, class H, class P, class A> class unordered_map
return this->emplace_hint(hint, boost::move(x));
}
template <class P2>
iterator insert(const_iterator hint, BOOST_RV_REF(P2) obj,
typename boost::enable_if_c<
boost::is_constructible<value_type, BOOST_RV_REF(P2)>::value,
void*>::type = 0)
{
return this->emplace_hint(hint, boost::forward<P2>(obj));
}
template <class M>
std::pair<iterator, bool> insert_or_assign(
key_type const& k, BOOST_FWD_REF(M) obj)
@ -1037,6 +1056,15 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
return this->emplace(boost::move(x));
}
template <class P2>
iterator insert(BOOST_RV_REF(P2) obj,
typename boost::enable_if_c<
boost::is_constructible<value_type, BOOST_RV_REF(P2)>::value,
void*>::type = 0)
{
return this->emplace(boost::forward<P2>(obj));
}
iterator insert(const_iterator hint, value_type const& x)
{
return this->emplace_hint(hint, x);
@ -1047,6 +1075,15 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
return this->emplace_hint(hint, boost::move(x));
}
template <class P2>
iterator insert(const_iterator hint, BOOST_RV_REF(P2) obj,
typename boost::enable_if_c<
boost::is_constructible<value_type, BOOST_RV_REF(P2)>::value,
void*>::type = 0)
{
return this->emplace_hint(hint, boost::forward<P2>(obj));
}
template <class InputIt> void insert(InputIt, InputIt);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)