Commit 15dd0ae3 authored by Dan Melnic's avatar Dan Melnic Committed by Facebook GitHub Bot

Workaround for -Werror,-Wambiguous-reversed-operator

Summary: Workaround for -Werror,-Wambiguous-reversed-operator

Reviewed By: yfeldblum, mpark

Differential Revision: D31615526

fbshipit-source-id: 23f72e7b0aaea65d1e0cc294beef3b33d7aa985e
parent 17388729
......@@ -79,30 +79,9 @@ class IteratorFacade {
using difference_type = ssize_t;
using iterator_category = Tag;
bool operator==(D const& rhs) const { return asDerivedConst().equal(rhs); }
bool operator!=(D const& rhs) const { return !operator==(rhs); }
/*
* Allow for comparisons between this and an iterator of some other class.
* (e.g. a const_iterator version of this, the probable use case).
* Does a conversion of D (or D reference) to D2, if one exists (otherwise
* this is disabled). Disabled if D and D2 are the same, to disambiguate
* this and the `operator==(D const&) const` method above.
*/
template <
class D2,
std::enable_if_t<!std::is_same<D, D2>::value, int> = 0,
std::enable_if_t<std::is_convertible<D, D2>::value, int> = 0>
bool operator==(D2 const& rhs) const {
return D2(asDerivedConst()) == rhs;
}
friend bool operator==(D const& lhs, D const& rhs) { return equal(lhs, rhs); }
template <class D2>
bool operator!=(D2 const& rhs) const {
return !operator==(rhs);
}
friend bool operator!=(D const& lhs, D const& rhs) { return !(lhs == rhs); }
V& operator*() const { return asDerivedConst().dereference(); }
......@@ -134,6 +113,8 @@ class IteratorFacade {
D& asDerived() { return static_cast<D&>(*this); }
D const& asDerivedConst() const { return static_cast<D const&>(*this); }
static bool equal(D const& lhs, D const& rhs) { return lhs.equal(rhs); }
};
/**
......
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