AK: Merge implementations of operator== for Optional

Instead of having a overload of the operator in each specialization of
Optional, use a free function as a common implementation.
This commit is contained in:
Lucas CHOLLET 2024-12-29 00:25:21 -05:00 committed by Andreas Kling
commit d6abd44522
Notes: github-actions[bot] 2025-01-03 16:12:15 +00:00
4 changed files with 13 additions and 74 deletions

View file

@ -593,18 +593,6 @@ public:
return *this;
}
template<typename O>
ALWAYS_INLINE bool operator==(Optional<O> const& other) const
{
return has_value() == other.has_value() && (!has_value() || value() == other.value());
}
template<typename O>
ALWAYS_INLINE bool operator==(O const& other) const
{
return has_value() && value() == other;
}
void clear()
{
m_value = {};