summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-11-23 12:29:22 +0100
committerAndreas Kling <kling@serenityos.org>2020-11-23 14:08:50 +0100
commitdd43cf2657330812c7118c2c88040105fc92b835 (patch)
treea70c8f18691b2b20889dbf0483c179e357cde8f4
parenta89648e15988471f3854c99f41ab0e47f131032a (diff)
downloadserenity-dd43cf2657330812c7118c2c88040105fc92b835.zip
AK: Use ALWAYS_INLINE all over NonnullPtrVector
I saw NonnullOwnPtrVector::at() in a profile and that was silly, as we should definitely be inlining it.
-rw-r--r--AK/NonnullPtrVector.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/AK/NonnullPtrVector.h b/AK/NonnullPtrVector.h
index 31b42102a5..7abbc26829 100644
--- a/AK/NonnullPtrVector.h
+++ b/AK/NonnullPtrVector.h
@@ -54,23 +54,23 @@ public:
using ConstIterator = SimpleIterator<const NonnullPtrVector, const T>;
using Iterator = SimpleIterator<NonnullPtrVector, T>;
- constexpr ConstIterator begin() const { return ConstIterator::begin(*this); }
- constexpr Iterator begin() { return Iterator::begin(*this); }
+ ALWAYS_INLINE constexpr ConstIterator begin() const { return ConstIterator::begin(*this); }
+ ALWAYS_INLINE constexpr Iterator begin() { return Iterator::begin(*this); }
- constexpr ConstIterator end() const { return ConstIterator::end(*this); }
- constexpr Iterator end() { return Iterator::end(*this); }
+ ALWAYS_INLINE constexpr ConstIterator end() const { return ConstIterator::end(*this); }
+ ALWAYS_INLINE 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); }
+ ALWAYS_INLINE PtrType& ptr_at(int index) { return Base::at(index); }
+ ALWAYS_INLINE 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); }
- const T& operator[](int index) const { return at(index); }
- T& first() { return at(0); }
- const T& first() const { return at(0); }
- T& last() { return at(size() - 1); }
- const T& last() const { return at(size() - 1); }
+ ALWAYS_INLINE T& at(int index) { return *Base::at(index); }
+ ALWAYS_INLINE const T& at(int index) const { return *Base::at(index); }
+ ALWAYS_INLINE T& operator[](int index) { return at(index); }
+ ALWAYS_INLINE const T& operator[](int index) const { return at(index); }
+ ALWAYS_INLINE T& first() { return at(0); }
+ ALWAYS_INLINE const T& first() const { return at(0); }
+ ALWAYS_INLINE T& last() { return at(size() - 1); }
+ ALWAYS_INLINE const T& last() const { return at(size() - 1); }
private:
// NOTE: You can't use resize() on a NonnullFooPtrVector since making the vector