simplified the const iterators
This commit is contained in:
parent
23fac82112
commit
3eabc872d4
44
src/list.hh
44
src/list.hh
@ -24,9 +24,11 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
class iterator;
|
class iterator;
|
||||||
class const_iterator;
|
// class const_iterator;
|
||||||
|
using const_iterator = const iterator;
|
||||||
class reverse_iterator;
|
class reverse_iterator;
|
||||||
class const_reverse_iterator;
|
// class const_reverse_iterator;
|
||||||
|
using const_reverse_iterator = const reverse_iterator;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Member functions //
|
// Member functions //
|
||||||
@ -337,25 +339,6 @@ public:
|
|||||||
T operator*() { return it->x; }
|
T operator*() { return it->x; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class const_iterator : protected iterator {
|
|
||||||
public:
|
|
||||||
const_iterator() : iterator() {}
|
|
||||||
explicit const_iterator(T *point) : iterator(point) {}
|
|
||||||
|
|
||||||
explicit const_iterator(const iterator &other) : iterator(other) {}
|
|
||||||
const_iterator(const const_iterator &other) : iterator(other) {}
|
|
||||||
|
|
||||||
explicit const_iterator(iterator &&other) : iterator(std::move(other)) {}
|
|
||||||
const_iterator(const_iterator &&other) : iterator(std::move(other)) {}
|
|
||||||
|
|
||||||
const_iterator &operator++() = delete;
|
|
||||||
const_iterator operator++(int) = delete;
|
|
||||||
const_iterator &operator--() = delete;
|
|
||||||
const_iterator operator--(int) = delete;
|
|
||||||
|
|
||||||
~const_iterator() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
class reverse_iterator : protected iterator {
|
class reverse_iterator : protected iterator {
|
||||||
public:
|
public:
|
||||||
reverse_iterator() : iterator() {}
|
reverse_iterator() : iterator() {}
|
||||||
@ -389,25 +372,6 @@ public:
|
|||||||
|
|
||||||
~reverse_iterator() {}
|
~reverse_iterator() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class const_reverse_iterator : protected iterator {
|
|
||||||
public:
|
|
||||||
const_reverse_iterator() : iterator() {}
|
|
||||||
explicit const_reverse_iterator(T *point) : iterator(point) {}
|
|
||||||
|
|
||||||
const_reverse_iterator(const const_reverse_iterator &other)
|
|
||||||
: iterator(other) {}
|
|
||||||
|
|
||||||
const_reverse_iterator(const_reverse_iterator &&other)
|
|
||||||
: iterator(std::move(other)) {}
|
|
||||||
|
|
||||||
const_reverse_iterator &operator++() = delete;
|
|
||||||
const_reverse_iterator &operator++(int) = delete;
|
|
||||||
const_reverse_iterator &operator--() = delete;
|
|
||||||
const_reverse_iterator &operator--(int) = delete;
|
|
||||||
|
|
||||||
~const_reverse_iterator() {}
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace phundrak
|
} // namespace phundrak
|
||||||
|
Loading…
Reference in New Issue
Block a user