2 # ifndef TPL_DYNARRAY_SET_H
3 # define TPL_DYNARRAY_SET_H
5 # include <tpl_dynArray.H>
6 # include <tpl_sort_utils.H>
28 template <
typename T,
class Equal = Aleph::equal_to<T>>
60 :
DynArray<T>(pow_dir, pow_seg, pow_block)
66 T &
put(
const T & item) {
return this->
append(item); }
73 Aleph::sequential_search<T, Equal>(*
this, item, 0, this->
size() - 1);
75 return (i >= 0 and i < this->
size()) ? &this->
access(i) : NULL;
82 std::swap(item, this->
access(this->
size() - 1));
87 void erase(T & item) {
remove(item); }
96 : array(_array), curr(0)
101 bool has_current()
const
103 return curr < array.
size();
106 bool has_curr()
const
108 return has_current();
113 if (not has_current())
114 throw std::overflow_error(
"Iterator is at the end of array");
121 return get_current();
126 if (not has_current())
127 throw std::overflow_error(
"Iterator is at the end of array");
134 throw std::underflow_error(
"Iterator is at the begin of array");
145 curr = array.
size() - 1;
150 # endif // TPL_DYNARRAY_SET_H
Definition: tpl_dynarray_set.H:89
void erase(T &item)
Definition: tpl_dynarray_set.H:87
void cut(const size_t new_dim=0)
Definition: tpl_dynArray.H:1040
size_t size() const
Retorna dimensión actual (más lejano índice escrito)
Definition: tpl_dynArray.H:523
DynArray_Set(const size_t &dim=0)
Constructor por omisión.
Definition: tpl_dynarray_set.H:34
T & put(const T &item)
Inserción de item.
Definition: tpl_dynarray_set.H:66
T & append()
Definition: tpl_dynArray.H:1115
DynArray_Set(size_t pow_dir, size_t pow_seg, size_t pow_block)
Definition: tpl_dynarray_set.H:59
Definition: tpl_dynArray.H:70
T & access(const size_t i)
Definition: tpl_dynArray.H:793
Definition: tpl_dynarray_set.H:29
T * search(const T &item)
Definition: tpl_dynarray_set.H:70