From cf369920a5d5ad0fb1525ae413690466505ceb35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 7 Apr 2022 11:37:32 +0200 Subject: [PATCH] use prefix increment --- .../include/CGAL/Hash_map/internal/chained_map.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Hash_map/include/CGAL/Hash_map/internal/chained_map.h b/Hash_map/include/CGAL/Hash_map/internal/chained_map.h index 98b456deb9f..4aac2fb6474 100644 --- a/Hash_map/include/CGAL/Hash_map/internal/chained_map.h +++ b/Hash_map/include/CGAL/Hash_map/internal/chained_map.h @@ -139,7 +139,7 @@ void chained_map::init_table(std::size_t n) free = table + t; table_end = table + t + t/2; - for (Item p = table; p < free; p++) + for (Item p = table; p < free; ++p) { p->succ = nullptr; p->k = nullkey; } @@ -173,7 +173,7 @@ void chained_map::rehash() 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; if ( x != nullkey ) // list p is non-empty { Item q = HASH(x); @@ -185,7 +185,7 @@ void chained_map::rehash() while (p < old_table_end) { std::size_t x = p->k; insert(x,p->i); - p++; + ++p; } for (Item item = old_table ; item != old_table_end ; ++item) @@ -238,7 +238,7 @@ chained_map::chained_map(const chained_map& D) { 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) { insert(p->k,p->i); //D.copy_inf(p->i); // see chapter Implementation @@ -253,7 +253,7 @@ chained_map& chained_map::operator=(const chained_ma 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) { insert(p->k,p->i); //copy_inf(p->i); // see chapter Implementation @@ -299,8 +299,8 @@ template void chained_map::statistics() const { std::cout << "table_size: " << table_size <<"\n"; std::size_t n = 0; - for (Item p = table; p < table + table_size; p++) - if (p ->k != nullkey) n++; + for (Item p = table; p < table + table_size; ++p) + if (p ->k != nullkey) ++n; std::size_t used_in_overflow = free - (table + table_size ); n += used_in_overflow; std::cout << "number of entries: " << n << "\n";