Add equality operator for range

The operator== is needed when actually using a hash table - the hash
function is not enough.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
This commit is contained in:
Nadav Har'El
2015-07-27 15:41:10 +03:00
committed by Avi Kivity
parent afa3d8c2c8
commit cc64e46425

View File

@@ -24,6 +24,9 @@ public:
const T& value() const & { return _value; }
T&& value() && { return std::move(_value); }
bool is_inclusive() const { return _inclusive; }
bool operator==(const bound& other) const {
return (_value == other._value) && (_inclusive == other._inclusive);
}
};
private:
optional<bound> _start;
@@ -243,6 +246,10 @@ public:
return range(std::move(s), std::move(e), singular);
}
bool operator==(const range& other) const {
return (_start == other._start) && (_end == other._end) && (_singular == other._singular);
}
template<typename U>
friend std::ostream& operator<<(std::ostream& out, const range<U>& r);
};