Update iterator range insert to use emplace() vs insert() to avoid copies in certain cases

This commit is contained in:
Christian Mazakas
2023-06-15 22:15:57 -07:00
parent f604efe866
commit c51c06492a
7 changed files with 144 additions and 60 deletions
@@ -369,7 +369,7 @@ namespace boost {
void insert(InputIterator begin, InputIterator end)
{
for (auto pos = begin; pos != end; ++pos) {
table_.insert(*pos);
table_.emplace(*pos);
}
}
@@ -421,7 +421,7 @@ namespace boost {
{
BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F)
for (; first != last; ++first) {
table_.insert_or_visit(*first, f);
table_.emplace_or_visit(*first, f);
}
}
@@ -452,7 +452,7 @@ namespace boost {
{
BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F)
for (; first != last; ++first) {
table_.insert_or_cvisit(*first, f);
table_.emplace_or_cvisit(*first, f);
}
}