Implement try_emplace

This commit is contained in:
Daniel James
2017-02-27 03:59:02 +00:00
parent 958d206bb6
commit 5f5f8ef1e4
5 changed files with 527 additions and 17 deletions

View File

@@ -309,10 +309,21 @@ void unordered_map_functions(X&, Key const& k, T const& v)
X a;
test::check_return_type<mapped_type>::equals_ref(a[k]);
test::check_return_type<mapped_type>::equals_ref(a.at(k));
test::check_return_type<std::pair<iterator, bool> >::equals(
a.try_emplace(k, v));
test::check_return_type<std::pair<iterator, bool> >::equals(
a.try_emplace(rvalue(k), v));
test::check_return_type<iterator>::equals(a.try_emplace(a.begin(), k, v));
test::check_return_type<iterator>::equals(
a.try_emplace(a.begin(), rvalue(k), v));
test::check_return_type<std::pair<iterator, bool> >::equals(
a.insert_or_assign(k, v));
test::check_return_type<std::pair<iterator, bool> >::equals(
a.insert_or_assign(rvalue(k), v));
test::check_return_type<iterator>::equals(
a.insert_or_assign(a.begin(), k, v));
test::check_return_type<iterator>::equals(
a.insert_or_assign(a.begin(), rvalue(k), v));
X const b = a;
test::check_return_type<mapped_type const>::equals_ref(b.at(k));