forked from boostorg/unordered
Unordered: Merge slightly simpler implementation.
[SVN r80632]
This commit is contained in:
@ -444,10 +444,12 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
base(b.node_alloc()),
|
base(b.node_alloc()),
|
||||||
nodes_()
|
nodes_()
|
||||||
{
|
{
|
||||||
typename Table::previous_pointer prev = b.get_previous_start();
|
if (b.size_) {
|
||||||
nodes_ = static_cast<node_pointer>(prev->next_);
|
typename Table::previous_pointer prev = b.get_previous_start();
|
||||||
prev->next_ = link_pointer();
|
nodes_ = static_cast<node_pointer>(prev->next_);
|
||||||
b.size_ = 0;
|
prev->next_ = link_pointer();
|
||||||
|
b.size_ = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~node_holder();
|
~node_holder();
|
||||||
@ -508,7 +510,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator get_start() const
|
iterator begin() const
|
||||||
{
|
{
|
||||||
return iterator(nodes_);
|
return iterator(nodes_);
|
||||||
}
|
}
|
||||||
|
@ -234,11 +234,9 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
Key const& k,
|
Key const& k,
|
||||||
Pred const& eq) const
|
Pred const& eq) const
|
||||||
{
|
{
|
||||||
if (!this->size_) return iterator();
|
|
||||||
|
|
||||||
std::size_t bucket_index =
|
std::size_t bucket_index =
|
||||||
policy::to_bucket(this->bucket_count_, key_hash);
|
policy::to_bucket(this->bucket_count_, key_hash);
|
||||||
iterator n = this->get_start(bucket_index);
|
iterator n = this->begin(bucket_index);
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
@ -293,9 +291,8 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
bool equals(grouped_table_impl const& other) const
|
bool equals(grouped_table_impl const& other) const
|
||||||
{
|
{
|
||||||
if(this->size_ != other.size_) return false;
|
if(this->size_ != other.size_) return false;
|
||||||
if(!this->size_) return true;
|
|
||||||
|
|
||||||
for(iterator n1 = this->get_start(); n1.node_;)
|
for(iterator n1 = this->begin(); n1.node_;)
|
||||||
{
|
{
|
||||||
iterator n2 = other.find_matching_node(n1);
|
iterator n2 = other.find_matching_node(n1);
|
||||||
if (!n2.node_) return false;
|
if (!n2.node_) return false;
|
||||||
|
@ -187,7 +187,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
std::size_t bucket_count_;
|
std::size_t bucket_count_;
|
||||||
std::size_t size_;
|
std::size_t size_;
|
||||||
float mlf_;
|
float mlf_;
|
||||||
std::size_t max_load_; // Only use if buckets_.
|
std::size_t max_load_;
|
||||||
bucket_pointer buckets_;
|
bucket_pointer buckets_;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
@ -222,6 +222,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
|
|
||||||
bucket_pointer get_bucket(std::size_t bucket_index) const
|
bucket_pointer get_bucket(std::size_t bucket_index) const
|
||||||
{
|
{
|
||||||
|
BOOST_ASSERT(buckets_);
|
||||||
return buckets_ + static_cast<std::ptrdiff_t>(bucket_index);
|
return buckets_ + static_cast<std::ptrdiff_t>(bucket_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,14 +236,15 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
return get_bucket(bucket_index)->next_;
|
return get_bucket(bucket_index)->next_;
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator get_start() const
|
iterator begin() const
|
||||||
{
|
{
|
||||||
return iterator(static_cast<node_pointer>(
|
return size_ ? iterator(static_cast<node_pointer>(
|
||||||
get_previous_start()->next_));
|
get_previous_start()->next_)) : iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator get_start(std::size_t bucket_index) const
|
iterator begin(std::size_t bucket_index) const
|
||||||
{
|
{
|
||||||
|
if (!size_) return iterator();
|
||||||
previous_pointer prev = get_previous_start(bucket_index);
|
previous_pointer prev = get_previous_start(bucket_index);
|
||||||
return prev ? iterator(static_cast<node_pointer>(prev->next_)) :
|
return prev ? iterator(static_cast<node_pointer>(prev->next_)) :
|
||||||
iterator();
|
iterator();
|
||||||
@ -257,8 +259,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
|
|
||||||
std::size_t bucket_size(std::size_t index) const
|
std::size_t bucket_size(std::size_t index) const
|
||||||
{
|
{
|
||||||
if (!size_) return 0;
|
iterator it = begin(index);
|
||||||
iterator it = get_start(index);
|
|
||||||
if (!it.node_) return 0;
|
if (!it.node_) return 0;
|
||||||
|
|
||||||
std::size_t count = 0;
|
std::size_t count = 0;
|
||||||
@ -292,10 +293,10 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
|
|
||||||
// From 6.3.1/13:
|
// From 6.3.1/13:
|
||||||
// Only resize when size >= mlf_ * count
|
// Only resize when size >= mlf_ * count
|
||||||
max_load_ = boost::unordered::detail::double_to_size(ceil(
|
max_load_ = buckets_ ? boost::unordered::detail::double_to_size(ceil(
|
||||||
static_cast<double>(mlf_) *
|
static_cast<double>(mlf_) *
|
||||||
static_cast<double>(bucket_count_)
|
static_cast<double>(bucket_count_)
|
||||||
));
|
)) : 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,7 +304,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
{
|
{
|
||||||
BOOST_ASSERT(z > 0);
|
BOOST_ASSERT(z > 0);
|
||||||
mlf_ = (std::max)(z, minimum_max_load_factor);
|
mlf_ = (std::max)(z, minimum_max_load_factor);
|
||||||
if (buckets_) recalculate_max_load();
|
recalculate_max_load();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t min_buckets_for_size(std::size_t size) const
|
std::size_t min_buckets_for_size(std::size_t size) const
|
||||||
@ -362,6 +363,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
{
|
{
|
||||||
x.buckets_ = bucket_pointer();
|
x.buckets_ = bucket_pointer();
|
||||||
x.size_ = 0;
|
x.size_ = 0;
|
||||||
|
x.max_load_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
table(table& x, node_allocator const& a,
|
table(table& x, node_allocator const& a,
|
||||||
@ -383,7 +385,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
if (x.size_) {
|
if (x.size_) {
|
||||||
create_buckets(bucket_count_);
|
create_buckets(bucket_count_);
|
||||||
copy_nodes<node_allocator> copy(node_alloc());
|
copy_nodes<node_allocator> copy(node_alloc());
|
||||||
table_impl::fill_buckets(x.get_start(), *this, copy);
|
table_impl::fill_buckets(x.begin(), *this, copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,7 +400,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
|
|
||||||
move_nodes<node_allocator> move(node_alloc());
|
move_nodes<node_allocator> move(node_alloc());
|
||||||
node_holder<node_allocator> nodes(x);
|
node_holder<node_allocator> nodes(x);
|
||||||
table_impl::fill_buckets(nodes.get_start(), *this, move);
|
table_impl::fill_buckets(nodes.begin(), *this, move);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,6 +489,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
size_ = other.size_;
|
size_ = other.size_;
|
||||||
other.buckets_ = bucket_pointer();
|
other.buckets_ = bucket_pointer();
|
||||||
other.size_ = 0;
|
other.size_ = 0;
|
||||||
|
other.max_load_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
@ -524,7 +527,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
void delete_buckets()
|
void delete_buckets()
|
||||||
{
|
{
|
||||||
if(buckets_) {
|
if(buckets_) {
|
||||||
delete_nodes(get_start(), iterator());
|
delete_nodes(begin(), iterator());
|
||||||
|
|
||||||
if (bucket::extra_node) {
|
if (bucket::extra_node) {
|
||||||
node_pointer n = static_cast<node_pointer>(
|
node_pointer n = static_cast<node_pointer>(
|
||||||
@ -536,6 +539,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
|
|
||||||
destroy_buckets();
|
destroy_buckets();
|
||||||
buckets_ = bucket_pointer();
|
buckets_ = bucket_pointer();
|
||||||
|
max_load_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_ASSERT(!size_);
|
BOOST_ASSERT(!size_);
|
||||||
@ -545,7 +549,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
{
|
{
|
||||||
if(!size_) return;
|
if(!size_) return;
|
||||||
|
|
||||||
delete_nodes(get_start(), iterator());
|
delete_nodes(begin(), iterator());
|
||||||
get_previous_start()->next_ = link_pointer();
|
get_previous_start()->next_ = link_pointer();
|
||||||
clear_buckets();
|
clear_buckets();
|
||||||
|
|
||||||
@ -648,13 +652,6 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
// Iterators
|
|
||||||
|
|
||||||
iterator begin() const {
|
|
||||||
return !buckets_ ? iterator() : get_start();
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Assignment
|
// Assignment
|
||||||
|
|
||||||
@ -680,7 +677,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
|
|
||||||
if (!size_ && !x.size_) return;
|
if (!size_ && !x.size_) return;
|
||||||
|
|
||||||
if (!buckets_ || x.size_ >= max_load_) {
|
if (x.size_ >= max_load_) {
|
||||||
create_buckets(min_buckets_for_size(x.size_));
|
create_buckets(min_buckets_for_size(x.size_));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -691,10 +688,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
// assigning to them if possible, and deleting any that are
|
// assigning to them if possible, and deleting any that are
|
||||||
// left over.
|
// left over.
|
||||||
assign_nodes<table> assign(*this);
|
assign_nodes<table> assign(*this);
|
||||||
|
table_impl::fill_buckets(x.begin(), *this, assign);
|
||||||
if (x.size_) {
|
|
||||||
table_impl::fill_buckets(x.get_start(), *this, assign);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void assign(table const& x, true_type)
|
void assign(table const& x, true_type)
|
||||||
@ -709,7 +703,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
|
|
||||||
// Delete everything with current allocators before assigning
|
// Delete everything with current allocators before assigning
|
||||||
// the new ones.
|
// the new ones.
|
||||||
if (buckets_) delete_buckets();
|
delete_buckets();
|
||||||
allocators_.assign(x.allocators_);
|
allocators_.assign(x.allocators_);
|
||||||
|
|
||||||
// Copy over other data, all no throw.
|
// Copy over other data, all no throw.
|
||||||
@ -722,7 +716,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
if (x.size_) {
|
if (x.size_) {
|
||||||
create_buckets(bucket_count_);
|
create_buckets(bucket_count_);
|
||||||
copy_nodes<node_allocator> copy(node_alloc());
|
copy_nodes<node_allocator> copy(node_alloc());
|
||||||
table_impl::fill_buckets(x.get_start(), *this, copy);
|
table_impl::fill_buckets(x.begin(), *this, copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -740,7 +734,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
|
|
||||||
void move_assign(table& x, true_type)
|
void move_assign(table& x, true_type)
|
||||||
{
|
{
|
||||||
if(buckets_) delete_buckets();
|
delete_buckets();
|
||||||
allocators_.move_assign(x.allocators_);
|
allocators_.move_assign(x.allocators_);
|
||||||
move_assign_no_alloc(x);
|
move_assign_no_alloc(x);
|
||||||
}
|
}
|
||||||
@ -748,7 +742,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
void move_assign(table& x, false_type)
|
void move_assign(table& x, false_type)
|
||||||
{
|
{
|
||||||
if (node_alloc() == x.node_alloc()) {
|
if (node_alloc() == x.node_alloc()) {
|
||||||
if(buckets_) delete_buckets();
|
delete_buckets();
|
||||||
move_assign_no_alloc(x);
|
move_assign_no_alloc(x);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -760,7 +754,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
|
|
||||||
if (!size_ && !x.size_) return;
|
if (!size_ && !x.size_) return;
|
||||||
|
|
||||||
if (!buckets_ || x.size_ >= max_load_) {
|
if (x.size_ >= max_load_) {
|
||||||
create_buckets(min_buckets_for_size(x.size_));
|
create_buckets(min_buckets_for_size(x.size_));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -771,11 +765,8 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
// elements, assigning to them if possible, and deleting
|
// elements, assigning to them if possible, and deleting
|
||||||
// any that are left over.
|
// any that are left over.
|
||||||
move_assign_nodes<table> assign(*this);
|
move_assign_nodes<table> assign(*this);
|
||||||
|
node_holder<node_allocator> nodes(x);
|
||||||
if (x.size_) {
|
table_impl::fill_buckets(nodes.begin(), *this, assign);
|
||||||
node_holder<node_allocator> nodes(x);
|
|
||||||
table_impl::fill_buckets(nodes.get_start(), *this, assign);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -784,9 +775,9 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
boost::unordered::detail::set_hash_functions<hasher, key_equal>
|
boost::unordered::detail::set_hash_functions<hasher, key_equal>
|
||||||
new_func_this(*this, x);
|
new_func_this(*this, x);
|
||||||
// No throw from here.
|
// No throw from here.
|
||||||
move_buckets_from(x);
|
|
||||||
mlf_ = x.mlf_;
|
mlf_ = x.mlf_;
|
||||||
max_load_ = x.max_load_;
|
max_load_ = x.max_load_;
|
||||||
|
move_buckets_from(x);
|
||||||
new_func_this.commit();
|
new_func_this.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -878,7 +869,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
if(!size_) {
|
if(!size_) {
|
||||||
if(buckets_) delete_buckets();
|
delete_buckets();
|
||||||
bucket_count_ = policy::new_bucket_count(min_buckets);
|
bucket_count_ = policy::new_bucket_count(min_buckets);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -231,11 +231,9 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
Key const& k,
|
Key const& k,
|
||||||
Pred const& eq) const
|
Pred const& eq) const
|
||||||
{
|
{
|
||||||
if (!this->size_) return iterator();
|
|
||||||
|
|
||||||
std::size_t bucket_index =
|
std::size_t bucket_index =
|
||||||
policy::to_bucket(this->bucket_count_, key_hash);
|
policy::to_bucket(this->bucket_count_, key_hash);
|
||||||
iterator n = this->get_start(bucket_index);
|
iterator n = this->begin(bucket_index);
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
@ -288,9 +286,8 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
bool equals(table_impl const& other) const
|
bool equals(table_impl const& other) const
|
||||||
{
|
{
|
||||||
if(this->size_ != other.size_) return false;
|
if(this->size_ != other.size_) return false;
|
||||||
if(!this->size_) return true;
|
|
||||||
|
|
||||||
for(iterator n1 = this->get_start(); n1.node_; ++n1)
|
for(iterator n1 = this->begin(); n1.node_; ++n1)
|
||||||
{
|
{
|
||||||
iterator n2 = other.find_matching_node(n1);
|
iterator n2 = other.find_matching_node(n1);
|
||||||
|
|
||||||
@ -466,14 +463,9 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
{
|
{
|
||||||
node_constructor a(this->node_alloc());
|
node_constructor a(this->node_alloc());
|
||||||
|
|
||||||
// Special case for empty buckets so that we can use
|
insert_range_impl2(a, k, i, j);
|
||||||
// max_load_ (which isn't valid when buckets_ is null).
|
|
||||||
if (!this->buckets_) {
|
|
||||||
insert_range_empty(a, k, i, j);
|
|
||||||
if (++i == j) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
while(++i != j) {
|
||||||
// Note: can't use get_key as '*i' might not be value_type - it
|
// Note: can't use get_key as '*i' might not be value_type - it
|
||||||
// could be a pair with first_types as key_type without const or
|
// could be a pair with first_types as key_type without const or
|
||||||
// a different second_type.
|
// a different second_type.
|
||||||
@ -483,18 +475,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
// be less efficient if copying the full value_type is
|
// be less efficient if copying the full value_type is
|
||||||
// expensive.
|
// expensive.
|
||||||
insert_range_impl2(a, extractor::extract(*i), i, j);
|
insert_range_impl2(a, extractor::extract(*i), i, j);
|
||||||
} while(++i != j);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
template <class InputIt>
|
|
||||||
void insert_range_empty(node_constructor& a, key_type const& k,
|
|
||||||
InputIt i, InputIt j)
|
|
||||||
{
|
|
||||||
std::size_t key_hash = this->hash(k);
|
|
||||||
a.construct_with_value2(*i);
|
|
||||||
this->reserve_for_insert(this->size_ +
|
|
||||||
boost::unordered::detail::insert_size(i, j));
|
|
||||||
this->add_node(a, key_hash);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class InputIt>
|
template <class InputIt>
|
||||||
|
@ -469,16 +469,14 @@ namespace unordered
|
|||||||
|
|
||||||
local_iterator begin(size_type n)
|
local_iterator begin(size_type n)
|
||||||
{
|
{
|
||||||
return table_.size_ ? local_iterator(
|
return local_iterator(
|
||||||
table_.get_start(n), n, table_.bucket_count_) :
|
table_.begin(n), n, table_.bucket_count_);
|
||||||
local_iterator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const_local_iterator begin(size_type n) const
|
const_local_iterator begin(size_type n) const
|
||||||
{
|
{
|
||||||
return table_.size_ ? const_local_iterator(
|
return const_local_iterator(
|
||||||
table_.get_start(n), n, table_.bucket_count_) :
|
table_.begin(n), n, table_.bucket_count_);
|
||||||
const_local_iterator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local_iterator end(size_type)
|
local_iterator end(size_type)
|
||||||
@ -493,9 +491,8 @@ namespace unordered
|
|||||||
|
|
||||||
const_local_iterator cbegin(size_type n) const
|
const_local_iterator cbegin(size_type n) const
|
||||||
{
|
{
|
||||||
return table_.size_ ? const_local_iterator(
|
return const_local_iterator(
|
||||||
table_.get_start(n), n, table_.bucket_count_) :
|
table_.begin(n), n, table_.bucket_count_);
|
||||||
const_local_iterator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const_local_iterator cend(size_type) const
|
const_local_iterator cend(size_type) const
|
||||||
@ -951,16 +948,14 @@ namespace unordered
|
|||||||
|
|
||||||
local_iterator begin(size_type n)
|
local_iterator begin(size_type n)
|
||||||
{
|
{
|
||||||
return table_.size_ ? local_iterator(
|
return local_iterator(
|
||||||
table_.get_start(n), n, table_.bucket_count_) :
|
table_.begin(n), n, table_.bucket_count_);
|
||||||
local_iterator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const_local_iterator begin(size_type n) const
|
const_local_iterator begin(size_type n) const
|
||||||
{
|
{
|
||||||
return table_.size_ ? const_local_iterator(
|
return const_local_iterator(
|
||||||
table_.get_start(n), n, table_.bucket_count_) :
|
table_.begin(n), n, table_.bucket_count_);
|
||||||
const_local_iterator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local_iterator end(size_type)
|
local_iterator end(size_type)
|
||||||
@ -975,9 +970,8 @@ namespace unordered
|
|||||||
|
|
||||||
const_local_iterator cbegin(size_type n) const
|
const_local_iterator cbegin(size_type n) const
|
||||||
{
|
{
|
||||||
return table_.size_ ? const_local_iterator(
|
return const_local_iterator(
|
||||||
table_.get_start(n), n, table_.bucket_count_) :
|
table_.begin(n), n, table_.bucket_count_);
|
||||||
const_local_iterator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const_local_iterator cend(size_type) const
|
const_local_iterator cend(size_type) const
|
||||||
|
@ -454,16 +454,14 @@ namespace unordered
|
|||||||
|
|
||||||
local_iterator begin(size_type n)
|
local_iterator begin(size_type n)
|
||||||
{
|
{
|
||||||
return table_.size_ ? local_iterator(
|
return local_iterator(
|
||||||
table_.get_start(n), n, table_.bucket_count_) :
|
table_.begin(n), n, table_.bucket_count_);
|
||||||
local_iterator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const_local_iterator begin(size_type n) const
|
const_local_iterator begin(size_type n) const
|
||||||
{
|
{
|
||||||
return table_.size_ ? const_local_iterator(
|
return const_local_iterator(
|
||||||
table_.get_start(n), n, table_.bucket_count_) :
|
table_.begin(n), n, table_.bucket_count_);
|
||||||
const_local_iterator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local_iterator end(size_type)
|
local_iterator end(size_type)
|
||||||
@ -478,9 +476,8 @@ namespace unordered
|
|||||||
|
|
||||||
const_local_iterator cbegin(size_type n) const
|
const_local_iterator cbegin(size_type n) const
|
||||||
{
|
{
|
||||||
return table_.size_ ? const_local_iterator(
|
return const_local_iterator(
|
||||||
table_.get_start(n), n, table_.bucket_count_) :
|
table_.begin(n), n, table_.bucket_count_);
|
||||||
const_local_iterator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const_local_iterator cend(size_type) const
|
const_local_iterator cend(size_type) const
|
||||||
@ -926,16 +923,14 @@ namespace unordered
|
|||||||
|
|
||||||
local_iterator begin(size_type n)
|
local_iterator begin(size_type n)
|
||||||
{
|
{
|
||||||
return table_.size_ ? local_iterator(
|
return local_iterator(
|
||||||
table_.get_start(n), n, table_.bucket_count_) :
|
table_.begin(n), n, table_.bucket_count_);
|
||||||
local_iterator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const_local_iterator begin(size_type n) const
|
const_local_iterator begin(size_type n) const
|
||||||
{
|
{
|
||||||
return table_.size_ ? const_local_iterator(
|
return const_local_iterator(
|
||||||
table_.get_start(n), n, table_.bucket_count_) :
|
table_.begin(n), n, table_.bucket_count_);
|
||||||
const_local_iterator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local_iterator end(size_type)
|
local_iterator end(size_type)
|
||||||
@ -950,9 +945,8 @@ namespace unordered
|
|||||||
|
|
||||||
const_local_iterator cbegin(size_type n) const
|
const_local_iterator cbegin(size_type n) const
|
||||||
{
|
{
|
||||||
return table_.size_ ? const_local_iterator(
|
return const_local_iterator(
|
||||||
table_.get_start(n), n, table_.bucket_count_) :
|
table_.begin(n), n, table_.bucket_count_);
|
||||||
const_local_iterator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const_local_iterator cend(size_type) const
|
const_local_iterator cend(size_type) const
|
||||||
|
@ -276,6 +276,21 @@ void insert_tests2(X*, test::random_generator generator)
|
|||||||
|
|
||||||
test::check_equivalent_keys(x);
|
test::check_equivalent_keys(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cerr<<"insert copy iterator range test 2.\n";
|
||||||
|
|
||||||
|
{
|
||||||
|
test::check_instances check_;
|
||||||
|
|
||||||
|
X x;
|
||||||
|
|
||||||
|
test::random_values<X> v1(500, generator);
|
||||||
|
test::random_values<X> v2(500, generator);
|
||||||
|
x.insert(test::copy_iterator(v1.begin()), test::copy_iterator(v1.end()));
|
||||||
|
x.insert(test::copy_iterator(v2.begin()), test::copy_iterator(v2.end()));
|
||||||
|
|
||||||
|
test::check_equivalent_keys(x);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)
|
||||||
|
Reference in New Issue
Block a user