forked from boostorg/unordered
Simplify range-based insert() so it doesn't eagerly rehash so that insert_tests pass
This commit is contained in:
@ -92,24 +92,8 @@ namespace boost {
|
||||
return table_.insert(std::move(value)).first;
|
||||
}
|
||||
|
||||
template <class ForwardIterator>
|
||||
typename std::enable_if<
|
||||
std::is_base_of<std::forward_iterator_tag, ForwardIterator>::value,
|
||||
void>::type
|
||||
insert(ForwardIterator first, ForwardIterator last)
|
||||
{
|
||||
auto const len = std::distance(first, last);
|
||||
table_.reserve(len);
|
||||
for (auto pos = first; pos != last; ++pos) {
|
||||
table_.insert(*pos);
|
||||
}
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
typename std::enable_if<
|
||||
!std::is_base_of<std::forward_iterator_tag, InputIterator>::value,
|
||||
void>::type
|
||||
insert(InputIterator first, InputIterator last)
|
||||
void insert(InputIterator first, InputIterator last)
|
||||
{
|
||||
for (auto pos = first; pos != last; ++pos) {
|
||||
table_.insert(*pos);
|
||||
|
@ -91,24 +91,8 @@ namespace boost {
|
||||
return table_.insert(std::move(value)).first;
|
||||
}
|
||||
|
||||
template <class ForwardIterator>
|
||||
typename std::enable_if<
|
||||
std::is_base_of<std::forward_iterator_tag, ForwardIterator>::value,
|
||||
void>::type
|
||||
insert(ForwardIterator first, ForwardIterator last)
|
||||
{
|
||||
auto const len = std::distance(first, last);
|
||||
table_.reserve(len);
|
||||
for (auto pos = first; pos != last; ++pos) {
|
||||
table_.insert(*pos);
|
||||
}
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
typename std::enable_if<
|
||||
!std::is_base_of<std::forward_iterator_tag, InputIterator>::value,
|
||||
void>::type
|
||||
insert(InputIterator first, InputIterator last)
|
||||
void insert(InputIterator first, InputIterator last)
|
||||
{
|
||||
for (auto pos = first; pos != last; ++pos) {
|
||||
table_.insert(*pos);
|
||||
|
Reference in New Issue
Block a user