AK: Explicitly name types in Iterator.h

In this particular case, auto is a footgun, because we are very
certain about the type that we want to return. const-correctness
could have been violated (as Vector did), because Iterator did not
enforce that the returned pointer was actually const if the Iterator
was an Iterator over a const container.
This commit is contained in:
creator1creeper1 2022-01-08 23:00:35 +01:00 committed by Ali Mohammad Pur
parent 6484d42933
commit 4869dda79f
Notes: sideshowbarker 2024-07-17 20:49:25 +09:00

View file

@ -52,11 +52,11 @@ public:
return SimpleIterator { m_container, m_index + 1 }; return SimpleIterator { m_container, m_index + 1 };
} }
ALWAYS_INLINE constexpr const ValueType& operator*() const { return m_container[m_index]; } ALWAYS_INLINE constexpr ValueType const& operator*() const { return m_container[m_index]; }
ALWAYS_INLINE constexpr ValueType& operator*() { return m_container[m_index]; } ALWAYS_INLINE constexpr ValueType& operator*() { return m_container[m_index]; }
constexpr auto operator->() const { return &m_container[m_index]; } ALWAYS_INLINE constexpr ValueType const* operator->() const { return &m_container[m_index]; }
constexpr auto operator->() { return &m_container[m_index]; } ALWAYS_INLINE constexpr ValueType* operator->() { return &m_container[m_index]; }
SimpleIterator& operator=(const SimpleIterator& other) SimpleIterator& operator=(const SimpleIterator& other)
{ {