fix compilation with VS2019, preview of 16.7 version

Compiler tells something about argument-dependent lookup. I do not
understand how that ADL works. But I know that such operators should
be free functions, instead of methods:
http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Ro-symmetric

Such syntax defines 'friend' free functions.
This commit is contained in:
Eugene Kosov 2020-06-05 23:33:24 +03:00
parent a8c200c73c
commit 7a695d8a82

View file

@ -99,8 +99,14 @@ public:
reference operator*() { return *static_cast<pointer>(node_); }
pointer operator->() { return static_cast<pointer>(node_); }
bool operator==(const Iterator &rhs) { return node_ == rhs.node_; }
bool operator!=(const Iterator &rhs) { return !(*this == rhs); }
friend bool operator==(const Iterator &lhs, const Iterator &rhs)
{
return lhs.node_ == rhs.node_;
}
friend bool operator!=(const Iterator &lhs, const Iterator &rhs)
{
return !(lhs == rhs);
}
private:
ListNode *node_;