2 # ifndef TPL_DYNARRAY_H 3 # define TPL_DYNARRAY_H 9 # include <ahIterator.H> 10 # include <array_utils.H> 12 # include <tpl_dynDlist.H> 13 # include <ah-args-ctor.H> 19 using namespace Aleph;
158 template <
typename T>
163 public StlAlephIterator<DynArray<T>>
179 static const size_t Max_Bits_Allowed;
188 static const size_t Max_Pow_Block;
190 mutable size_t pow_dir = Default_Pow_Dir;
191 mutable size_t pow_seg = Default_Pow_Seg;
192 mutable size_t pow_block =
193 std::min(Default_Pow_Block, Max_Pow_Block);
194 mutable size_t seg_plus_block_pow = pow_seg + pow_block;
195 mutable size_t mask_seg_plus_block = two_raised(seg_plus_block_pow) - 1;
196 mutable size_t dir_size = two_raised(pow_dir);
197 mutable size_t seg_size = two_raised(pow_seg);
198 mutable size_t block_size = two_raised(pow_block);
201 unsigned long long max_dim = two_raised(seg_plus_block_pow + pow_dir);
203 static size_t two_raised(
const size_t n) noexcept
205 assert(n < Max_Bits_Allowed);
209 static size_t compute_dim(
size_t d,
size_t s,
size_t b) noexcept
211 return two_raised(d)*two_raised(s)*two_raised(b);
224 static void compute_sizes(
const size_t n,
size_t & d,
size_t & s,
size_t & b)
229 b = Default_Pow_Block;
230 if (compute_dim(d, s, b) >= n)
235 if (compute_dim(++d, s, b) >= n)
238 if (compute_dim(d, ++s, b) >= n)
241 if (compute_dim(d, s, ++b) >= n)
256 compute_sizes(n, d, s, b);
257 return make_tuple(d, s, b);
262 size_t mask_seg = seg_size - 1;
263 size_t mask_block = block_size - 1;
265 size_t index_in_dir(
const size_t i)
const noexcept
267 assert( (pow_block + pow_seg) == seg_plus_block_pow );
268 assert( seg_size * block_size == two_raised(seg_plus_block_pow) );
269 assert( i >> seg_plus_block_pow == i/(seg_size*block_size) );
271 return i >> seg_plus_block_pow;
274 size_t modulus_from_index_in_dir(
const size_t i)
const noexcept
276 assert( mask_seg_plus_block == seg_size*block_size - 1 );
277 assert( (i & mask_seg_plus_block) == i%(seg_size*block_size) );
279 return (i & mask_seg_plus_block);
282 size_t index_in_seg(
const size_t & i)
const noexcept
284 assert( two_raised(pow_block) == block_size );
285 assert( (modulus_from_index_in_dir(i) >> pow_block) ==
286 (i%(seg_size*block_size))/block_size );
288 return modulus_from_index_in_dir(i) >> pow_block;
291 size_t index_in_block(
const size_t i)
const noexcept
293 assert( mask_block == block_size - 1 );
294 assert( (modulus_from_index_in_dir(i) & mask_block) ==
295 ((i%(seg_size*block_size))%block_size) );
297 return modulus_from_index_in_dir(i) & mask_block;
302 size_t num_blocks = 0;
305 void fill_dir_to_null() noexcept
307 assert(dir !=
nullptr);
309 for (
size_t i = 0; i < dir_size; ++i)
313 void fill_seg_to_null(T ** seg) noexcept
315 assert(seg !=
nullptr);
317 for (
size_t i = 0; i < seg_size; ++i)
323 dir = (T***) malloc(dir_size*
sizeof(T**));
325 throw std::bad_alloc();
330 void resize_dir(
const size_t i)
332 assert(i >= max_dim);
334 size_t new_pow_dir = pow_dir + 1;
335 while (compute_dim(new_pow_dir, pow_seg, pow_block) <= i)
338 const size_t new_dir_sz = two_raised(new_pow_dir);
339 T *** new_dir = (T***) realloc(dir, new_dir_sz*
sizeof(T**));
340 if (new_dir ==
nullptr)
341 throw std::bad_alloc();
344 for (
size_t k = dir_size; k < new_dir_sz; ++k)
347 pow_dir = new_pow_dir;
348 dir_size = new_dir_sz;
350 max_dim = compute_dim(pow_dir, pow_seg, pow_block);
353 void allocate_segment(T **& seg)
355 assert(seg ==
nullptr);
357 seg =
new T* [seg_size];
358 fill_seg_to_null(seg);
362 T default_initial_value = T();
363 T * default_initial_value_ptr = &default_initial_value;
365 void allocate_block(T *& block)
367 assert(block ==
nullptr);
369 block =
new T [block_size];
372 if (default_initial_value_ptr ==
nullptr)
375 for (
size_t i = 0; i < block_size; ++i)
376 block[i] = *default_initial_value_ptr;
379 void release_segment(T **& seg) noexcept
381 assert(seg !=
nullptr);
388 void release_block(T *& block) noexcept
390 assert(block !=
nullptr);
397 void release_blocks_and_segment(T ** & seg) noexcept
399 assert(seg !=
nullptr);
401 for(
size_t i = 0; i < seg_size ; ++i)
402 if (seg[i] !=
nullptr)
403 release_block(seg[i]);
405 release_segment(seg);
408 void release_all_segments_and_blocks() noexcept
410 assert(dir !=
nullptr);
412 for(
size_t i = 0; i < dir_size ; ++i)
413 if (dir[i] !=
nullptr)
414 release_blocks_and_segment(dir[i]);
419 void release_dir() noexcept
424 release_all_segments_and_blocks();
432 static size_t next2Pow(
const size_t number) noexcept
434 return (
size_t) ceil( log((
float) number)/ log(2.0) );
437 size_t divide_by_block_size(
const size_t number)
const noexcept
439 assert(number/block_size == number >> pow_block);
441 return number >> pow_block;
444 size_t modulus_by_block_size(
const size_t number)
const noexcept
446 assert((number%block_size) == (number & mask_block));
448 return number & mask_block;
451 void advance_block_index(
size_t block_index,
size_t seg_index,
452 const size_t len)
const noexcept
454 if (block_index + len < block_size)
460 seg_index += divide_by_block_size(len);
461 block_index = modulus_by_block_size(len);
464 void allocate_block(T *& block, T * src_block)
466 allocate_block(block);
467 for (
size_t i = 0; i < block_size; i++)
468 block[i] = src_block[i];
471 void allocate_segment(T **& seg, T ** src_seg)
473 allocate_segment(seg);
474 for (
size_t i = 0; i < seg_size; i++)
475 if (src_seg[i] !=
nullptr)
476 allocate_block(seg[i], src_seg[i]);
479 void allocate_dir(T *** src_dir)
482 for (
size_t i = 0; i < dir_size; i++)
483 if (src_dir[i] !=
nullptr)
484 allocate_segment(dir[i], src_dir[i]);
499 Proxy(
DynArray<T> & _array,
const size_t i) noexcept
500 : index(i), pos_in_dir(_array.index_in_dir(index)),
501 pos_in_seg(_array.index_in_seg(index)),
502 pos_in_block(_array.index_in_block(index)),
503 ref_seg(_array.dir[pos_in_dir]), block (
nullptr), array(_array)
505 if (ref_seg !=
nullptr)
506 block = ref_seg[pos_in_seg];
511 if (block ==
nullptr)
512 throw std::invalid_argument(
"accessed entry not been still written");
513 return block[pos_in_block];
518 bool seg_was_allocated_in_current_call =
false;
520 if (ref_seg ==
nullptr)
522 array.allocate_segment(ref_seg);
523 seg_was_allocated_in_current_call =
true;
526 if (block ==
nullptr)
530 array.allocate_block(block);
531 ref_seg[pos_in_seg] = block;
533 assert(array.dir[pos_in_dir] == ref_seg);
537 if (seg_was_allocated_in_current_call)
538 array.release_segment(ref_seg);
544 if (index >= array.current_dim)
545 array.current_dim = index + 1;
547 return &block[pos_in_block];
550 Proxy & operator = (
const T & data)
552 bool seg_was_allocated_in_current_call =
false;
553 if (ref_seg ==
nullptr)
555 array.allocate_segment(ref_seg);
556 seg_was_allocated_in_current_call =
true;
559 if (block ==
nullptr)
563 array.allocate_block(block);
564 ref_seg[pos_in_seg] = block;
566 assert(array.dir[pos_in_dir] == ref_seg);
570 if (seg_was_allocated_in_current_call)
571 array.release_segment(ref_seg);
577 if (index >= array.current_dim)
578 array.current_dim = index + 1;
580 block[pos_in_block] = data;
585 Proxy & operator = (
const Proxy & proxy)
587 if (proxy.block ==
nullptr)
588 throw std::domain_error(
"right entry has not been still written");
593 bool seg_was_allocated_in_current_call =
false;
594 if (ref_seg ==
nullptr)
596 array.allocate_segment(ref_seg);
597 seg_was_allocated_in_current_call =
true;
600 if (block ==
nullptr)
604 array.allocate_block(block);
605 ref_seg[pos_in_seg] = block;
607 assert(array.dir[pos_in_dir] == ref_seg);
611 if (seg_was_allocated_in_current_call)
612 array.release_segment(ref_seg);
618 if (index >= array.current_dim)
619 array.current_dim = index + 1;
621 block[pos_in_block] = proxy.block[proxy.pos_in_block];
641 size_t size() const noexcept {
return current_dim; }
647 size_t max_size() const noexcept {
return max_dim; }
661 default_initial_value = value;
662 default_initial_value_ptr = &default_initial_value;
667 noexcept(noexcept(
std::swap(default_initial_value, value)))
669 std::swap(default_initial_value, value);
670 default_initial_value_ptr = &default_initial_value;
688 DynArray(
size_t _pow_dir,
size_t _pow_seg,
size_t _pow_block)
689 : pow_dir ( _pow_dir ),
690 pow_seg ( _pow_seg ),
691 pow_block ( _pow_block ),
692 seg_plus_block_pow ( _pow_seg + _pow_block ),
693 mask_seg_plus_block ( two_raised(seg_plus_block_pow) - 1 ),
694 dir_size ( two_raised(pow_dir) ),
695 seg_size ( two_raised(pow_seg) ),
696 block_size ( two_raised(pow_block) ),
697 max_dim ( two_raised(seg_plus_block_pow + pow_dir) ),
698 mask_seg ( seg_size - 1 ),
699 mask_block ( block_size - 1 ),
704 static_assert(std::is_copy_constructible<T>::value,
705 "No copy constructor for T");
706 static_assert(std::is_move_constructible<T>::value,
707 "No move constructor for T");
708 static_assert(std::is_copy_assignable<T>::value,
709 "No copy assign for T");
710 static_assert(std::is_move_assignable<T>::value,
711 "No move assign for T");
712 assert(Max_Dim_Allowed > 0);
714 if (max_dim > Max_Dim_Allowed)
715 throw std::length_error (
"Dimension too large");
731 static_assert(std::is_default_constructible<T>::value,
732 "No default constructor for T");
733 static_assert(std::is_copy_constructible<T>::value,
734 "No copy constructor for T");
735 static_assert(std::is_move_constructible<T>::value,
736 "No move constructor for T");
737 static_assert(std::is_copy_assignable<T>::value,
738 "No copy assign for T");
739 static_assert(std::is_move_assignable<T>::value,
740 "No move assign for T");
741 assert(Max_Dim_Allowed > 0);
743 if (max_dim > Max_Dim_Allowed)
744 throw std::length_error (
"Dimension too large");
762 for (
size_t i = 0; i < src_array.current_dim; ++i)
763 if (src_array.
exist(i))
764 (*
this)[i] = src_array.
access(i);
773 : pow_dir (array.pow_dir),
774 pow_seg (array.pow_seg),
775 pow_block (array.pow_block),
776 seg_plus_block_pow (array.seg_plus_block_pow),
777 mask_seg_plus_block (array.mask_seg_plus_block),
778 dir_size (array.dir_size),
779 seg_size (array.seg_size),
780 block_size (array.block_size),
781 max_dim (array.max_dim),
782 mask_seg (array.mask_seg),
783 mask_block (array.mask_block),
788 default_initial_value_ptr (array.default_initial_value_ptr)
790 allocate_dir(array.dir);
806 if (array.current_dim < current_dim)
807 cut(array.current_dim);
809 current_dim = array.current_dim;
821 std::swap(dir, array.dir);
822 std::swap(pow_dir, array.pow_dir);
823 std::swap(pow_seg, array.pow_seg);
824 std::swap(pow_block, array.pow_block);
825 std::swap(seg_plus_block_pow, array.seg_plus_block_pow);
826 std::swap(mask_seg_plus_block, array.mask_seg_plus_block);
827 std::swap(dir_size, array.dir_size);
828 std::swap(seg_size, array.seg_size);
829 std::swap(block_size, array.block_size);
830 std::swap(mask_seg, array.mask_seg);
831 std::swap(mask_block, array.mask_block);
832 std::swap(max_dim, array.max_dim);
833 std::swap(current_dim, array.current_dim);
834 std::swap(num_segs, array.num_segs);
835 std::swap(num_blocks, array.num_blocks);
840 : pow_dir ( Default_Pow_Dir ),
841 pow_seg ( Default_Pow_Seg ),
842 pow_block (std::min(Default_Pow_Block, Max_Pow_Block)),
843 seg_plus_block_pow ( pow_seg + pow_block ),
844 mask_seg_plus_block ( two_raised(seg_plus_block_pow) - 1 ),
845 dir_size ( two_raised(pow_dir) ),
846 seg_size ( two_raised(pow_seg) ),
847 block_size ( two_raised(pow_block) ),
848 max_dim ( two_raised(seg_plus_block_pow + pow_dir) ),
849 mask_seg ( seg_size - 1 ),
850 mask_block ( block_size - 1 ),
874 T &
access(
const size_t i)
const noexcept
876 assert(dir[index_in_dir(i)] !=
nullptr);
877 assert(dir[index_in_dir(i)][index_in_seg(i)] !=
nullptr);
879 return dir[index_in_dir(i)][index_in_seg(i)][index_in_block(i)];
883 T & operator () (
const size_t i)
const noexcept
900 const size_t pos_in_dir = index_in_dir(i);
902 assert(pos_in_dir < dir_size);
904 if (dir[pos_in_dir] ==
nullptr)
907 const size_t pos_in_seg = index_in_seg(i);
909 assert(pos_in_seg < seg_size);
911 if (dir[pos_in_dir][pos_in_seg] ==
nullptr)
927 T *
test(
const size_t i)
const noexcept
932 const size_t pos_in_dir = index_in_dir(i);
933 if (dir[pos_in_dir] ==
nullptr)
936 const size_t pos_in_seg = index_in_seg(i);
937 if (dir[pos_in_dir][pos_in_seg] ==
nullptr)
940 return &dir[index_in_dir(i)][index_in_seg(i)][index_in_block(i)];
963 const size_t pos_in_dir = index_in_dir(i);
964 if (dir[pos_in_dir] ==
nullptr)
965 allocate_segment(dir[pos_in_dir]);
967 const size_t pos_in_seg = index_in_seg(i);
968 if (dir[pos_in_dir][pos_in_seg] ==
nullptr)
972 allocate_block(dir[pos_in_dir][pos_in_seg]);
976 release_segment(dir[pos_in_dir]);
981 if (i >= current_dim)
984 return dir[pos_in_dir][pos_in_seg][index_in_block(i)];
1001 throw std::domain_error(
"invalid range");
1006 const size_t first_seg = index_in_dir(l);
1007 const size_t last_seg = index_in_dir(r);
1008 const size_t first_block = index_in_seg(l);
1009 const size_t last_block = index_in_seg(r);
1013 for (
size_t seg_idx = first_seg; seg_idx <= last_seg; ++seg_idx)
1015 if (dir[seg_idx] ==
nullptr)
1016 allocate_segment(dir[seg_idx]);
1018 size_t block_idx = (seg_idx == first_seg) ? first_block : 0;
1019 const size_t final_block =
1020 (seg_idx == last_seg) ? last_block : seg_size - 1;
1022 while (block_idx <= final_block)
1024 if (dir[seg_idx][block_idx] ==
nullptr)
1025 allocate_block(dir[seg_idx][block_idx]);
1031 if (r + 1 > current_dim)
1032 current_dim = r + 1;
1036 if (r + 1 > current_dim)
1037 current_dim = r + 1;
1051 reserve(0, dim - 1);
1054 void cut_ne(
const size_t new_dim = 0)
1058 release_all_segments_and_blocks();
1063 const size_t old_dim = current_dim;
1066 const long idx_first_seg = index_in_dir(old_dim - 1);
1067 const long idx_first_block = index_in_seg(old_dim - 1);
1070 const long idx_last_seg = index_in_dir(new_dim - 1);
1071 const long idx_last_block = index_in_seg(new_dim - 1);
1072 for (
long idx_seg = index_in_dir(old_dim - 1); idx_seg >= idx_last_seg;
1075 if (dir[idx_seg] ==
nullptr)
1079 idx_seg == idx_first_seg ? idx_first_block : seg_size - 1;
1082 while ( (idx_seg > idx_last_seg and idx_block >= 0) or
1083 (idx_seg == idx_last_seg and idx_block > idx_last_block) )
1085 if (dir[idx_seg][idx_block] !=
nullptr)
1086 release_block(dir[idx_seg][idx_block]);
1092 release_segment(dir[idx_seg]);
1095 current_dim = new_dim;
1104 void cut(
const size_t new_dim = 0)
1106 if (new_dim > current_dim)
1107 throw std::length_error(
"new dimension greater that current dimension");
1121 if (dim > current_dim)
1131 Proxy operator [] (
const size_t i)
const 1134 throw std::out_of_range (
"index out of maximun range");
1136 return Proxy (
const_cast<DynArray<T>&
>(*
this), i);
1139 Proxy operator [] (
const size_t i)
1144 return Proxy (
const_cast<DynArray<T>&
>(*
this), i);
1151 return touch(this->size());
1158 T & ref = this->append();
1167 T & ref = this->append();
1168 ref = std::move(data);
1172 T & insert(
const T & item)
1175 Aleph::open_gap(*
this, current_dim);
1176 T & ret = access(0);
1181 T & insert(T && item)
1184 Aleph::open_gap(*
this, current_dim);
1185 T & ret = access(0);
1186 ret = std::forward<T>(item);
1191 void push(
const T & data) { this->append(data); }
1194 T &
push(T && data) {
return this->append(std::forward<T>(data)); }
1197 void put(
const T & data) { this->append(data); }
1200 T &
put(T && data) {
return this->append(std::forward<T>(data)); }
1207 void remove(T & item) noexcept
1209 std::swap(item, this->access(this->size() - 1));
1210 this->cut_ne(this->size() - 1);
1214 void erase(T & item) noexcept {
remove(item); }
1217 bool is_empty() const noexcept {
return this->size() == 0; }
1222 for (
size_t i = 0, j = current_dim - 1; i < j; ++i, --j)
1223 swap(touch(i), touch(j));
1231 T ret_val = std::move(this->access(this->size() - 1));
1238 T &
top()
const {
return (*
this)[size() - 1]; }
1271 : array_ptr(const_cast<DynArray*>(&array)), curr_idx(0)
1279 return curr_idx >= 0 and curr_idx < array_ptr->
size();
1282 bool is_last()
const noexcept {
return curr_idx == array_ptr->
size() - 1; }
1293 if (curr_idx == array_ptr->
size())
1294 throw std::overflow_error(
"not current item in iterator");
1295 return get_curr_ne();
1299 long get_pos() const noexcept {
return curr_idx; }
1309 if (curr_idx == array_ptr->
size())
1310 throw std::overflow_error(
"not current item in iterator");
1323 throw std::underflow_error(
"not current item in iterator");
1331 void end() noexcept { curr_idx = array_ptr->
size(); }
1340 template <
class Operation>
1341 bool __traverse(Operation & operation) noexcept(noexcept(operation))
1343 size_t dir_idx = 0, seg_idx = 0, block_idx = 0;
1344 for (
size_t i = 0; i < current_dim; ++i)
1346 if (not operation(dir[dir_idx][seg_idx][block_idx]))
1349 if (++block_idx == block_size)
1352 if (++seg_idx == seg_size)
1378 template <
class Operation>
1379 bool traverse(Operation & operation)
const noexcept(noexcept(operation))
1381 return const_cast<DynArray&
>(*this).__traverse(operation);
1385 template <
class Operation>
1386 bool traverse(Operation & operation) noexcept(noexcept(operation))
1388 return __traverse(operation);
1392 template <
class Operation>
1393 bool traverse(Operation && operation)
const noexcept(noexcept(operation))
1395 return traverse<Operation>(operation);
1399 template <
class Operation>
bool traverse(Operation && operation)
1400 noexcept(noexcept(operation))
1402 return traverse<Operation>(operation);
1406 template <
typename T>
1409 template <
typename T>
1412 template <
typename T>
1415 template <
typename T>
1418 template <
typename T>
1420 256*1024*1024*1024ull;
1422 template <
typename T>
1424 (Max_Bits_Allowed - Default_Pow_Dir - Default_Pow_Seg - 1);
T pop()
Remove the last item of array (as if this was a stack)
Definition: tpl_dynArray.H:1229
Definition: htlist.H:1290
void reserve(const size_t l, const size_t r)
Definition: tpl_dynArray.H:998
DynArray(const DynArray< T > &array)
Definition: tpl_dynArray.H:772
void cut(const size_t new_dim=0)
Definition: tpl_dynArray.H:1104
T & push(T &&data)
Definition: tpl_dynArray.H:1194
DynArray & reverse()
Reverse the order of items in array.
Definition: tpl_dynArray.H:1220
bool is_empty() const noexcept
Return true if the array is empty.
Definition: tpl_dynArray.H:1217
void empty() noexcept
Definition: tpl_dynArray.H:1129
Definition: bitArray.H:135
void next_ne() noexcept
Definition: tpl_dynArray.H:1303
T & append(const T &data)
Definition: tpl_dynArray.H:1156
T & access(const size_t i) const noexcept
Definition: tpl_dynArray.H:874
void end() noexcept
Put the iterator in the end state.
Definition: tpl_dynArray.H:1331
T & touch(const size_t i)
Definition: tpl_dynArray.H:958
bool traverse(Operation &operation) noexcept(noexcept(operation))
Definition: tpl_dynArray.H:1386
void copy_array(const DynArray< T > &src_array)
Definition: tpl_dynArray.H:760
static const unsigned long long Max_Dim_Allowed
Maximum dimension allowed.
Definition: tpl_dynArray.H:184
long get_pos() const noexcept
Return the ordinal position of current item.
Definition: tpl_dynArray.H:1299
size_t max_size() const noexcept
Definition: tpl_dynArray.H:647
T & get_last() const
Definition: tpl_dynArray.H:1246
Iterator(const DynArray &array) noexcept
Initializes an iterator on array
Definition: tpl_dynArray.H:1270
size_t get_num_blocks() const noexcept
Return the number of blocks consumed by the array.
Definition: tpl_dynArray.H:650
size_t get_block_size() const noexcept
Return the block size.
Definition: tpl_dynArray.H:636
T & top() const
Return a modifiable reference to the last item of stack.
Definition: tpl_dynArray.H:1238
static void compute_sizes(const size_t n, size_t &d, size_t &s, size_t &b) noexcept
Definition: tpl_dynArray.H:224
void swap(DynArray< T > &array) noexcept
Definition: tpl_dynArray.H:819
T & get_first() const
Definition: tpl_dynArray.H:1242
void next()
Definition: tpl_dynArray.H:1307
void set_default_initial_value(T &&value=T()) noexcept(noexcept(std::swap(default_initial_value, value)))
Definition: tpl_dynArray.H:666
void reserve(const size_t dim)
Definition: tpl_dynArray.H:1048
T & get_curr_ne() const noexcept
Return the current link guaranteeing no exception. Be careful.
Definition: tpl_dynArray.H:1285
bool exist(const size_t i) const
Definition: tpl_dynArray.H:895
void prev()
Definition: tpl_dynArray.H:1320
void put(const T &data)
Definition: tpl_dynArray.H:1197
void prev_ne() noexcept
exception. Be careful.
Definition: tpl_dynArray.H:1316
bool traverse(Operation &&operation) const noexcept(noexcept(operation))
Definition: tpl_dynArray.H:1393
static const size_t Default_Pow_Dir
The type of element stored in the array.
Definition: tpl_dynArray.H:173
bool traverse(Operation &operation) const noexcept(noexcept(operation))
Definition: tpl_dynArray.H:1379
T * test(const size_t i) const noexcept
Definition: tpl_dynArray.H:927
DynArray(DynArray &&other) noexcept
Move constructor.
Definition: tpl_dynArray.H:839
void adjust(const size_t dim)
Definition: tpl_dynArray.H:1119
Node_Type Key_Type
The type of element stored in the array.
Definition: tpl_dynArray.H:171
T & append()
Definition: tpl_dynArray.H:1149
T & get_curr() const
Definition: tpl_dynArray.H:1291
size_t size() const noexcept
Definition: tpl_dynArray.H:641
size_t get_seg_size() const noexcept
Return the segment size.
Definition: tpl_dynArray.H:633
void reset_last() noexcept
Reset the iterator to the last item.
Definition: tpl_dynArray.H:1328
Definition: tpl_dynArray.H:159
DynArray(size_t _pow_dir, size_t _pow_seg, size_t _pow_block)
Definition: tpl_dynArray.H:688
void set_default_initial_value(const T &value) noexcept
Definition: tpl_dynArray.H:659
bool traverse(Operation &&operation) noexcept(noexcept(operation))
Definition: tpl_dynArray.H:1399
void reset_first() noexcept
Reset the iterator to the first item.
Definition: tpl_dynArray.H:1334
static const size_t Default_Pow_Block
Default two power for segment size.
Definition: tpl_dynArray.H:175
Definition: tpl_dynArray.H:1258
DynArray(const size_t dim=0)
Definition: tpl_dynArray.H:728
void push(const T &data)
Definition: tpl_dynArray.H:1191
bool has_curr() const noexcept
Return true if there is current item.
Definition: tpl_dynArray.H:1277
static std::tuple< size_t, size_t, size_t > compute_sizes(const size_t n) noexcept
Definition: tpl_dynArray.H:252
size_t get_dir_size() const noexcept
Return the directory size.
Definition: tpl_dynArray.H:630
T & put(T &&data)
Definition: tpl_dynArray.H:1200
static const size_t Default_Pow_Seg
Default two power for directory size.
Definition: tpl_dynArray.H:174
void erase(T &item) noexcept
Definition: tpl_dynArray.H:1214
Definition: htlist.H:1323
T & append(T &&data)
Definition: tpl_dynArray.H:1165