NonnullPtrVector: Add ptr_at() getters for accessing the NonnullPtr

Normally you want to access the T&, but sometimes you need to grab at
the NonnullPtr, for example when moving it out of the Vector before
a call to remove(). This is generally a weird pattern, but I don't have
a better solution at the moment.
This commit is contained in:
Andreas Kling 2019-08-19 19:04:52 +02:00
parent 179158bc97
commit a5cdd0afa5

View file

@ -33,6 +33,9 @@ public:
ConstIterator begin() const { return ConstIterator(*this, 0); }
ConstIterator end() const { return ConstIterator(*this, size()); }
PtrType& ptr_at(int index) { return Base::at(index); }
const PtrType& ptr_at(int index) const { return Base::at(index); }
T& at(int index) { return *Base::at(index); }
const T& at(int index) const { return *Base::at(index); }
T& operator[](int index) { return at(index); }