38 template <
typename T>
class Array_Container;
59 T * get_base() noexcept {
return ptr; }
64 : ptr(p), dim(sz), num_items(n), last(n - 1)
68 throw std::domain_error(
"Array_Iterator(): num_items greater tan dim");
72 : ptr(p), dim(sz), num_items(n), last(n - 1)
76 throw std::domain_error(
"Array_Iterator(): num_items greater tan dim");
80 : ptr(p), dim(sz), num_items(n), idx(f), first(f), last(l)
84 throw std::domain_error(
"Array_Iterator(): num_items greater tan dim");
86 throw std::domain_error(
"Array_Iterator(): first >= dim");
88 throw std::domain_error(
"Array_Iterator(): last >= dim");
97 : ptr(p), dim(sz), num_items(n), idx(f), first(f), last(l)
105 bool has_curr()
const noexcept {
return pos >= 0 and pos < num_items; }
107 bool is_last()
const noexcept {
return pos == num_items - 1; }
109 long get_pos()
const noexcept {
return pos; }
111 T & get_curr_ne()
const noexcept
119 throw std::underflow_error(
"MemArray::Iterator::get_curr(): has not current");
121 if (pos >= num_items)
122 throw std::overflow_error(
"MemArray::Iterator::get_curr(): has not current");
127 void next_ne() noexcept
136 if (num_items == 0 or pos >= num_items)
137 throw std::overflow_error(
"MemArray::Iterator::next(): has not current");
141 void prev_ne() noexcept
150 if (num_items == 0 or pos < 0)
151 throw std::underflow_error(
"MemArray::Iterator::prev(): has not current");
155 void reset() noexcept
161 void reset_first() noexcept { reset(); }
163 void reset_last() noexcept
171 put_itor_at_the_end(*
this);
175 template <
typename T>
inline 181 template <
typename T>
inline 182 Array_Container<T> get_array_it(
const T * array,
size_t n)
188 template <
typename T>
189 class Array_Container
195 public StlAlephIterator<Array_Container<T>>
202 T * get_base()
const noexcept {
return base; }
204 Array_Container(T * base_ptr,
const size_t d) : base(base_ptr), n(d)
209 bool is_empty()
const noexcept {
return n == 0; }
211 size_t size()
const noexcept {
return n; }
213 size_t capacity()
const noexcept {
return n; }
215 T & get_first()
const 218 throw std::underflow_error(
"Array_Container::get_first(): n == 0");
225 throw std::underflow_error(
"Array_Container::get_first(): n == 0");
234 Iterator get_it()
const {
return Iterator(*
this); }
243 # endif // ARRAY_IT_H
Definition: htlist.H:1290
Definition: array_it.H:45
Array_Iterator(NoExceptionCtor, T *p, size_t sz, size_t n, long f, long l)
Definition: array_it.H:96
Definition: htlist.H:1323