Commit 93ba6b71 authored by Dominik Charousset's avatar Dominik Charousset

Fix operator== for invalid optionals, close #191

parent 4ff1d8b4
......@@ -271,15 +271,16 @@ class optional<T&> {
/** @relates optional */
template <class T, typename U>
bool operator==(const optional<T>& lhs, const optional<U>& rhs) {
if ((lhs) && (rhs)) return *lhs == *rhs;
return false;
if ((lhs) && (rhs)) {
return *lhs == *rhs;
}
return !lhs && !rhs;
}
/** @relates optional */
template <class T, typename U>
bool operator==(const optional<T>& lhs, const U& rhs) {
if (lhs) return *lhs == rhs;
return false;
return (lhs) ? *lhs == rhs : false;
}
/** @relates optional */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment