Add support for operator== to Optional
This commit is contained in:
parent
2e2812b10f
commit
a36aed94f1
|
@ -52,6 +52,17 @@ public:
|
|||
|
||||
constexpr explicit operator bool() const noexcept { return m_valid; }
|
||||
|
||||
bool operator==(const Optional& other) const
|
||||
{
|
||||
if (m_valid == other.m_valid)
|
||||
{
|
||||
if (m_valid)
|
||||
return m_value == other.m_value;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
T& operator*()
|
||||
{
|
||||
kak_assert(m_valid);
|
||||
|
|
Loading…
Reference in New Issue
Block a user