10 template<
typename TYPE>
13 virtual bool equalPtr(
const iterator* other)
const = 0;
16 TYPE operator*()
const;
17 void operator++()
const;
18 void operator++(
int)
const;
19 void operator--()
const;
20 void operator--(
int)
const;
21 virtual void operator+=(int64_t steps)
const = 0;
22 virtual void operator-=(int64_t steps)
const = 0;
23 int compareTo(
const iterator &other)
const override;
24 virtual int64_t operator-(
const iterator& other)
const = 0;
25 iterator* clone()
const override = 0;
26 explicit operator bool()
const;
27 [[nodiscard]]
virtual bool hasNext()
const = 0;
28 [[nodiscard]]
virtual bool hasPrev()
const = 0;
29 virtual bool atPrev(
const iterator* other)
const = 0;
30 virtual bool atNext(
const iterator* other)
const = 0;
31 bool atPrev(
const iterator& other)
const;
32 bool atNext(
const iterator& other)
const;
33 virtual void next()
const = 0;
34 virtual void prev()
const = 0;
36 virtual iterator* getPrev()
const = 0;
37 virtual TYPE& get() = 0;
38 virtual TYPE get()
const = 0;
39 virtual TYPE getElem()
const;
40 virtual void set(
const TYPE& data) = 0;
41 bool equal(
const iterator* other)
const;
42 bool equal(
const iterator& other)
const;
43 [[nodiscard]]
virtual bool isValid()
const = 0;
44 [[nodiscard]] std::string className()
const override;
45 [[nodiscard]] std::string toString(
bool enter)
const override;
54 template <
typename TYPE>
62 template<
typename TYPE>
64 template<
typename TYPE>
68 template<
typename TYPE>
69 auto original::iterator<TYPE>::operator*() -> TYPE& {
73 template<
typename TYPE>
74 auto original::iterator<TYPE>::operator*() const -> TYPE {
78 template<
typename TYPE>
79 auto original::iterator<TYPE>::operator++() const ->
void {
83 template<
typename TYPE>
84 auto original::iterator<TYPE>::operator++(
int)
const ->
void {
88 template<
typename TYPE>
89 auto original::iterator<TYPE>::operator--() const ->
void {
93 template<
typename TYPE>
94 auto original::iterator<TYPE>::operator--(
int)
const ->
void {
98 template<
typename TYPE>
99 auto original::iterator<TYPE>::compareTo(
const iterator &other)
const ->
int {
100 return this->operator-(other);
103 template<
typename TYPE>
105 return this->isValid();
108 template<
typename TYPE>
109 auto original::iterator<TYPE>::atPrev(
const iterator &other)
const ->
bool {
110 return this->atPrev(&other);
113 template<
typename TYPE>
114 auto original::iterator<TYPE>::atNext(
const iterator &other)
const ->
bool {
115 return this->atNext(&other);
118 template<
typename TYPE>
119 auto original::iterator<TYPE>::getNext() const -> iterator* {
120 if (!this->isValid())
throw outOfBoundError();
121 auto it = this->clone();
126 template <
typename TYPE>
127 auto original::iterator<TYPE>::getElem() const -> TYPE
132 template<
typename TYPE>
133 auto original::iterator<TYPE>::equal(
const iterator *other)
const ->
bool {
134 return this->equalPtr(other);
137 template<
typename TYPE>
138 auto original::iterator<TYPE>::equal(
const iterator &other)
const ->
bool {
139 return this->equal(&other);
142 template<
typename TYPE>
143 auto original::iterator<TYPE>::className() const -> std::
string {
147 template<
typename TYPE>
148 auto original::iterator<TYPE>::toString(
const bool enter)
const -> std::string {
149 std::stringstream ss;
150 ss << this->className() <<
"(";
151 if (this->isValid()) ss << formatString(this->get());
159 template <
typename TYPE>
160 auto original::operator+(
const iterator<TYPE>& it, int64_t steps) -> iterator<TYPE>*
162 auto* nit = it.clone();
163 nit->operator+=(steps);
167 template <
typename TYPE>
168 auto original::operator-(
const iterator<TYPE>& it, int64_t steps) -> iterator<TYPE>*
170 auto* nit = it.clone();
171 nit->operator-=(steps);
Definition comparable.h:6