mirror of
https://github.com/boostorg/unordered.git
synced 2025-11-12 21:49:51 +01:00
Update insert(Iterator, Iterator) overloads to use emplace internally instead of insert()'ing
This commit is contained in:
@@ -1256,7 +1256,14 @@ public:
|
||||
template<typename... Args>
|
||||
BOOST_FORCEINLINE std::pair<iterator,bool> emplace(Args&&... args)
|
||||
{
|
||||
return emplace_impl(init_type(std::forward<Args>(args)...));
|
||||
using emplace_type = typename std::conditional<
|
||||
std::is_constructible<
|
||||
init_type, Args...
|
||||
>::value,
|
||||
init_type,
|
||||
value_type
|
||||
>::type;
|
||||
return emplace_impl(emplace_type(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
template<typename Key,typename... Args>
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace boost {
|
||||
void insert(InputIterator first, InputIterator last)
|
||||
{
|
||||
for (auto pos = first; pos != last; ++pos) {
|
||||
table_.insert(*pos);
|
||||
table_.emplace(*pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace boost {
|
||||
void insert(InputIterator first, InputIterator last)
|
||||
{
|
||||
for (auto pos = first; pos != last; ++pos) {
|
||||
table_.insert(*pos);
|
||||
table_.emplace(*pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user