diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2016-07-04 19:19:40 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2016-07-04 19:19:40 +0100 |
| commit | ca7f647562ceb0d209def169b8743c24f202c2c6 (patch) | |
| tree | bb432fc1981869438998b8e8ef47a90b0f05104a /src/optional.hh | |
| parent | e262dc1257c1ca7b542ce4874ff899305ff9f144 (diff) | |
Refactor Optional::operator==
Diffstat (limited to 'src/optional.hh')
| -rw-r--r-- | src/optional.hh | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/optional.hh b/src/optional.hh index a4d15ff5..5aecf3b3 100644 --- a/src/optional.hh +++ b/src/optional.hh @@ -51,13 +51,8 @@ public: 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; + return m_valid == other.m_valid and + (not m_valid or m_value == other.m_value); } template<typename... Args> |
