Commit 5929d5d5 authored by Matthias Vallentin's avatar Matthias Vallentin

Make expected<void> equality-comparable

parent 05bae436
...@@ -402,6 +402,16 @@ private: ...@@ -402,6 +402,16 @@ private:
caf::error error_; caf::error error_;
}; };
/// @relates expected
inline bool operator==(const expected<void>& x, const expected<void>& y) {
return (x && y) || (!x && !y && x.error() == y.error());
}
/// @relates expected
inline bool operator!=(const expected<void>& x, const expected<void>& y) {
return !(x == y);
}
template <> template <>
class expected<unit_t> : public expected<void> { class expected<unit_t> : public expected<void> {
public: public:
......
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