1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:04:59 +00:00

AK: Add generic SimpleIterator class to replace VectorIterator.

This commit is contained in:
asynts 2020-09-06 21:14:08 +02:00 committed by Andreas Kling
parent 9648bf4ada
commit 1b3ecb01a5
8 changed files with 152 additions and 90 deletions

View file

@ -51,13 +51,14 @@ public:
using Base::size;
using Iterator = VectorIterator<NonnullPtrVector, T>;
Iterator begin() { return Iterator(*this, 0); }
Iterator end() { return Iterator(*this, size()); }
using ConstIterator = SimpleIterator<const NonnullPtrVector, const T>;
using Iterator = SimpleIterator<NonnullPtrVector, T>;
using ConstIterator = VectorIterator<const NonnullPtrVector, const T>;
ConstIterator begin() const { return ConstIterator(*this, 0); }
ConstIterator end() const { return ConstIterator(*this, size()); }
constexpr ConstIterator begin() const { return ConstIterator::begin(*this); }
constexpr Iterator begin() { return Iterator::begin(*this); }
constexpr ConstIterator end() const { return ConstIterator::end(*this); }
constexpr Iterator end() { return Iterator::end(*this); }
PtrType& ptr_at(int index) { return Base::at(index); }
const PtrType& ptr_at(int index) const { return Base::at(index); }