mirror of https://github.com/CGAL/cgal
use prefix increment
This commit is contained in:
parent
b3a654ebfe
commit
cf369920a5
|
|
@ -139,7 +139,7 @@ void chained_map<T, Allocator>::init_table(std::size_t n)
|
||||||
free = table + t;
|
free = table + t;
|
||||||
table_end = table + t + t/2;
|
table_end = table + t + t/2;
|
||||||
|
|
||||||
for (Item p = table; p < free; p++)
|
for (Item p = table; p < free; ++p)
|
||||||
{ p->succ = nullptr;
|
{ p->succ = nullptr;
|
||||||
p->k = nullkey;
|
p->k = nullkey;
|
||||||
}
|
}
|
||||||
|
|
@ -173,7 +173,7 @@ void chained_map<T, Allocator>::rehash()
|
||||||
|
|
||||||
Item p;
|
Item p;
|
||||||
|
|
||||||
for(p = old_table; p < old_table_mid; p++)
|
for(p = old_table; p < old_table_mid; ++p)
|
||||||
{ std::size_t x = p->k;
|
{ std::size_t x = p->k;
|
||||||
if ( x != nullkey ) // list p is non-empty
|
if ( x != nullkey ) // list p is non-empty
|
||||||
{ Item q = HASH(x);
|
{ Item q = HASH(x);
|
||||||
|
|
@ -185,7 +185,7 @@ void chained_map<T, Allocator>::rehash()
|
||||||
while (p < old_table_end)
|
while (p < old_table_end)
|
||||||
{ std::size_t x = p->k;
|
{ std::size_t x = p->k;
|
||||||
insert(x,p->i);
|
insert(x,p->i);
|
||||||
p++;
|
++p;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Item item = old_table ; item != old_table_end ; ++item)
|
for (Item item = old_table ; item != old_table_end ; ++item)
|
||||||
|
|
@ -238,7 +238,7 @@ chained_map<T, Allocator>::chained_map(const chained_map<T, Allocator>& D)
|
||||||
{
|
{
|
||||||
init_table(D.table_size);
|
init_table(D.table_size);
|
||||||
|
|
||||||
for(Item p = D.table; p < D.free; p++)
|
for(Item p = D.table; p < D.free; ++p)
|
||||||
{ if (p->k != nullkey || p >= D.table + D.table_size)
|
{ if (p->k != nullkey || p >= D.table + D.table_size)
|
||||||
{ insert(p->k,p->i);
|
{ insert(p->k,p->i);
|
||||||
//D.copy_inf(p->i); // see chapter Implementation
|
//D.copy_inf(p->i); // see chapter Implementation
|
||||||
|
|
@ -253,7 +253,7 @@ chained_map<T, Allocator>& chained_map<T, Allocator>::operator=(const chained_ma
|
||||||
|
|
||||||
init_table(D.table_size);
|
init_table(D.table_size);
|
||||||
|
|
||||||
for(Item p = D.table; p < D.free; p++)
|
for(Item p = D.table; p < D.free; ++p)
|
||||||
{ if (p->k != nullkey || p >= D.table + D.table_size)
|
{ if (p->k != nullkey || p >= D.table + D.table_size)
|
||||||
{ insert(p->k,p->i);
|
{ insert(p->k,p->i);
|
||||||
//copy_inf(p->i); // see chapter Implementation
|
//copy_inf(p->i); // see chapter Implementation
|
||||||
|
|
@ -299,8 +299,8 @@ template <typename T, typename Allocator>
|
||||||
void chained_map<T, Allocator>::statistics() const
|
void chained_map<T, Allocator>::statistics() const
|
||||||
{ std::cout << "table_size: " << table_size <<"\n";
|
{ std::cout << "table_size: " << table_size <<"\n";
|
||||||
std::size_t n = 0;
|
std::size_t n = 0;
|
||||||
for (Item p = table; p < table + table_size; p++)
|
for (Item p = table; p < table + table_size; ++p)
|
||||||
if (p ->k != nullkey) n++;
|
if (p ->k != nullkey) ++n;
|
||||||
std::size_t used_in_overflow = free - (table + table_size );
|
std::size_t used_in_overflow = free - (table + table_size );
|
||||||
n += used_in_overflow;
|
n += used_in_overflow;
|
||||||
std::cout << "number of entries: " << n << "\n";
|
std::cout << "number of entries: " << n << "\n";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue