36 template<
typename TYPE>
87 [[nodiscard]]
bool hasNext()
const override;
93 [[nodiscard]]
bool hasPrev()
const override;
112 void next()
const override;
118 void prev()
const override;
156 TYPE&
get()
override;
162 TYPE
get()
const override;
168 void set(
const TYPE& data)
override;
174 [[nodiscard]]
bool isValid()
const override;
180 [[nodiscard]] std::string
className()
const override;
184 template <
typename TYPE>
188 template <
typename TYPE>
194 while (s->isValid()){
195 if (s->_ptr == e->_ptr){
202 dis = std::numeric_limits<integer>::max();
207 template<
typename TYPE>
209 auto* other_it =
dynamic_cast<const stepIterator*
>(other);
210 return other_it !=
nullptr &&
_ptr == other_it->_ptr;
213 template <
typename TYPE>
220 template <
typename TYPE>
224 if (
this == &other) {
227 this->
_ptr = other._ptr;
231 template<
typename TYPE>
236 template <
typename TYPE>
242 template<
typename TYPE>
247 template <
typename TYPE>
253 template <
typename TYPE>
259 template <
typename TYPE>
263 this->
_ptr = this->
_ptr->getPNext();
266 template<
typename TYPE>
271 template <
typename TYPE>
279 for (
integer i = 0; i < steps; i++)
285 template <
typename TYPE>
293 for (
integer i = 0; i < steps; i++)
299 template <
typename TYPE>
302 auto* other_it =
dynamic_cast<const stepIterator*
>(&other);
303 if (other_it ==
nullptr)
304 return this > &other ?
305 std::numeric_limits<integer>::max() :
306 std::numeric_limits<integer>::min();
308 pos_dis != std::numeric_limits<integer>::max())
return pos_dis;
310 neg_dis != std::numeric_limits<integer>::max())
return -neg_dis;
311 return this->
_ptr > other_it->_ptr ?
312 std::numeric_limits<integer>::max() :
313 std::numeric_limits<integer>::min();
316 template <
typename TYPE>
321 template<
typename TYPE>
326 template <
typename TYPE>
330 return this->
_ptr->getVal();
333 template <
typename TYPE>
337 return this->
_ptr->getVal();
340 template <
typename TYPE>
344 this->
_ptr->setVal(data);
347 template <
typename TYPE>
350 return this->
_ptr !=
nullptr;
353 template <
typename TYPE>
356 return "stepIterator";
A base class for basic iterators.
Definition iterator.h:296
Base iterator interface that supports common operations for iteration.
Definition iterator.h:37
Exception for null pointer dereference attempts.
Definition error.h:110
Unique ownership smart pointer with move semantics.
Definition ownerPtr.h:30
iterator< TYPE > * getPrev() const override
Creates a new iterator pointing to the previous element.
Definition stepIterator.h:322
wrapper< TYPE > * _ptr
Pointer to the current wrapper.
Definition stepIterator.h:40
stepIterator * clone() const override
Creates a heap-allocated copy of the iterator.
Definition stepIterator.h:232
bool hasPrev() const override
Checks if the iterator can move backward.
Definition stepIterator.h:243
void set(const TYPE &data) override
Sets the value of the current element.
Definition stepIterator.h:341
bool equalPtr(const iterator< TYPE > *other) const override
Equality comparison for two iterators.
Definition stepIterator.h:208
integer operator-(const iterator< TYPE > &other) const override
Calculates the number of steps between the current iterator and another iterator.
Definition stepIterator.h:300
void next() const override
Advances to the next position in the container.
Definition stepIterator.h:260
std::string className() const override
Returns the class name of the iterator.
Definition stepIterator.h:354
TYPE & get() override
Gets the reference of current element in the container.
Definition stepIterator.h:327
void prev() const override
Retreats to the previous position in the container.
Definition stepIterator.h:267
stepIterator(wrapper< TYPE > *ptr)
Protected constructor for derived classes.
Definition stepIterator.h:185
bool atNext(const iterator< TYPE > *other) const override
Checks if the current iterator is at the next position relative to another iterator.
Definition stepIterator.h:254
bool hasNext() const override
Checks if the iterator can move forward.
Definition stepIterator.h:237
static integer ptrDistance(const stepIterator *start, const stepIterator *end)
Calculates the distance between two iterators.
Definition stepIterator.h:189
stepIterator & operator=(const stepIterator &other)
Copy assignment operator for stepIterator.
Definition stepIterator.h:221
void operator+=(integer steps) const override
Moves forward by a specified number of steps.
Definition stepIterator.h:272
bool isValid() const override
Checks if the iterator is valid.
Definition stepIterator.h:348
stepIterator * getNext() const override
Creates a new iterator pointing to the next element.
Definition stepIterator.h:317
bool atPrev(const iterator< TYPE > *other) const override
Checks if the current iterator is at the previous position relative to another iterator.
Definition stepIterator.h:248
void operator-=(integer steps) const override
Moves backward by a specified number of steps.
Definition stepIterator.h:286
Exception for unimplemented method calls.
Definition error.h:123
Base class for linked value containers with formatted output.
Definition wrapper.h:28
Custom exception classes and callback validation utilities.
Defines the iterator class for traversing and manipulating container elements.
Mathematical utilities and constants.
Main namespace for the project Original.
Definition algorithms.h:21
TYPE abs(TYPE a)
Returns the absolute value of a given number.
std::int64_t integer
64-bit signed integer type for arithmetic operations
Definition config.h:35
Exclusive-ownership smart pointer implementation.
Abstract polymorphic container with value encapsulation and navigation support.