diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-08-19 18:55:36 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-08-19 18:55:36 +0100 |
| commit | a36aed94f17a93ac02f3efef35422ec3bcb5aaad (patch) | |
| tree | 368e82f066fcabcc03a17997bd71d71a7d15a81d | |
| parent | 2e2812b10f50a998ce1d4285b88ad96c31163021 (diff) | |
Add support for operator== to Optional
| -rw-r--r-- | src/optional.hh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/optional.hh b/src/optional.hh index 61dc9618..68277b1a 100644 --- a/src/optional.hh +++ b/src/optional.hh @@ -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); |
