Commit 7eb6f941 authored by Michal Gallus's avatar Michal Gallus
Browse files

Windows debug iterators: improve comparison operators declarations

parent 39a95e60
...@@ -33,36 +33,43 @@ inline namespace MIGRAPHX_INLINE_NS { ...@@ -33,36 +33,43 @@ inline namespace MIGRAPHX_INLINE_NS {
struct instruction; struct instruction;
#if defined(_WIN32) && !defined(NDEBUG) #if defined(_WIN32) && !defined(NDEBUG)
class instruction_ref : public std::list<instruction>::iterator struct instruction_ref : public std::list<instruction>::iterator
{ {
public: using instruction_iter = std::list<instruction>::iterator;
using instruction_const_iter = std::list<instruction>::const_iterator;
instruction_ref() = default; instruction_ref() = default;
instruction_ref(const std::list<instruction>::iterator& other) instruction_ref(const instruction_iter& other)
{ {
_Ptr = other._Ptr; _Ptr = other._Ptr;
_Adopt(other._Getcont()); _Adopt(other._Getcont());
} }
bool operator==(const instruction_ref& other) const friend bool operator==(const instruction_ref& x, const instruction_ref& y);
{ friend bool operator==(const instruction_ref& x, const instruction_iter& y);
return this->_Unwrapped()._Ptr == other._Unwrapped()._Ptr; friend bool operator==(const instruction_ref& x, const instruction_const_iter& y);
} friend bool operator!=(const instruction_ref& x, const instruction_ref& y);
};
bool operator==(const std::list<instruction>::iterator& other) const bool operator==(const instruction_ref& x, const instruction_ref& y)
{ {
return this->_Unwrapped()._Ptr == other._Unwrapped()._Ptr; return x._Unwrapped()._Ptr == y._Unwrapped()._Ptr;
} }
bool operator==(const std::list<instruction>::const_iterator& other) const bool operator==(const instruction_ref& x, const instruction_iter& y)
{ {
return this->_Unwrapped()._Ptr == other._Unwrapped()._Ptr; return x._Unwrapped()._Ptr == y._Unwrapped()._Ptr;
} }
bool operator!=(const instruction_ref& other) const bool operator==(const instruction_ref& x, const instruction_const_iter& y)
{ {
return !(*this == other); return x._Unwrapped()._Ptr == y._Unwrapped()._Ptr;
} }
};
bool operator!=(const instruction_ref& x, const instruction_ref& y)
{
return !(x == y);
}
#else #else
using instruction_ref = std::list<instruction>::iterator; using instruction_ref = std::list<instruction>::iterator;
#endif #endif
......
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