forked from boostorg/unordered
Implement insert_or_assign.
This commit is contained in:
@@ -342,6 +342,37 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
return this->emplace_hint(hint, boost::move(x));
|
||||
}
|
||||
|
||||
template <class M>
|
||||
std::pair<iterator, bool> insert_or_assign(
|
||||
key_type const& k, BOOST_FWD_REF(M) obj)
|
||||
{
|
||||
return table_.insert_or_assign_impl(k, boost::forward<M>(obj));
|
||||
}
|
||||
|
||||
template <class M>
|
||||
iterator insert_or_assign(
|
||||
const_iterator, key_type const& k, BOOST_FWD_REF(M) obj)
|
||||
{
|
||||
return table_.insert_or_assign_impl(k, boost::forward<M>(obj)).first;
|
||||
}
|
||||
|
||||
template <class M>
|
||||
std::pair<iterator, bool> insert_or_assign(
|
||||
BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
|
||||
{
|
||||
return table_.insert_or_assign_impl(
|
||||
boost::move(k), boost::forward<M>(obj));
|
||||
}
|
||||
|
||||
template <class M>
|
||||
iterator insert_or_assign(
|
||||
const_iterator, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
|
||||
{
|
||||
return table_
|
||||
.insert_or_assign_impl(boost::move(k), boost::forward<M>(obj))
|
||||
.first;
|
||||
}
|
||||
|
||||
template <class InputIt> void insert(InputIt, InputIt);
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
|
||||
Reference in New Issue
Block a user