mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 01:41:59 -05:00
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:
parent
179158bc97
commit
a5cdd0afa5
1 changed files with 3 additions and 0 deletions
|
@ -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); }
|
||||
|
|
Loading…
Reference in a new issue