mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
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:
parent
6484d42933
commit
4869dda79f
Notes:
sideshowbarker
2024-07-17 20:49:25 +09:00
Author: https://github.com/creator1creeper1 Commit: https://github.com/SerenityOS/serenity/commit/4869dda79f6 Pull-request: https://github.com/SerenityOS/serenity/pull/11771 Reviewed-by: https://github.com/alimpfard
1 changed files with 3 additions and 3 deletions
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue