40 "Template argument must be an arithmetic type");
55 Range(T _first, T _last, T _step = T(1))
56 : first(_first), last(_last), step(_step)
59 throw std::range_error(
"First value cannot be greater than last value");
62 throw std::logic_error(
"Step cannot be zero");
66 :
Range(T(0), _last, T(1))
72 :
Range(std::numeric_limits<T>::
max())
94 return std::ceil(
double(last - first) / step);
105 return not (*
this == r);
124 : r(_r), c(r.
min()), p(0)
144 throw std::overflow_error(
"There is not current element");
163 p = std::min(p + n, r.size());
164 c = std::min(c + r.step_size() * n, r.size() * r.step_size());
178 if (n * r.step_size() > c - r.min())
182 c -= n * r.step_size();
221 template <
typename T>
227 template <
typename T>
235 # endif // DSGRANGE__H T step_size() const
Definition: range.H:87
long long ValueType
Definition: range.H:46
T get_current() const
Definition: range.H:141
Range(T _first, T _last, T _step=T(1))
Definition: range.H:55
Iterator(const Range &_r, T current_position)
Definition: range.H:129
Definition: iterator.H:132
bool num_equal(T, T)
Definition: math.H:99
bool has_current() const
Definition: range.H:136
Definition: iterator.H:36
Iterator end() const
Definition: range.H:197
bool operator==(const Range &r) const
Definition: range.H:97
nat_t size() const
Definition: range.H:92
long long ItemType
Definition: range.H:43
void prev_n(nat_t n)
Definition: range.H:176
nat_t SizeType
Definition: range.H:47
long long DataType
Definition: range.H:45
T min() const
Definition: range.H:77
Range(T _last)
Definition: range.H:65
Definition: containeralgorithms.H:33
Range()
Definition: range.H:71
nat_t get_location() const
Definition: range.H:117
void next_n(nat_t n)
Definition: range.H:158
Iterator(const Range &_r)
Definition: range.H:123
bool operator!=(const Range &r) const
Definition: range.H:103
unsigned long int nat_t
Definition: types.H:50
Range< T > range(T f, T l, T s=T(1))
Definition: range.H:222
void reset()
Definition: range.H:185
Iterator begin() const
Definition: range.H:192
Value & value(MapKey< Key, Value > &item)
Definition: map.H:77
long long KeyType
Definition: range.H:44
void next()
Definition: range.H:149
T max() const
Definition: range.H:82
void prev()
Definition: range.H:167