diff options
author | Eugene Kosov <eugene.kosov@mariadb.com> | 2020-06-05 23:33:24 +0300 |
---|---|---|
committer | Eugene Kosov <eugene.kosov@mariadb.com> | 2020-06-05 23:41:09 +0300 |
commit | 7a695d8a82eaaa7db0cf4484b22fc3db3d43ac49 (patch) | |
tree | bfa7d941ae1a51bd4cdade70b3db4c3995e0d93f /include | |
parent | a8c200c73c96d35b9e58fdcde0987f0ac5cb9b1a (diff) | |
download | mariadb-git-7a695d8a82eaaa7db0cf4484b22fc3db3d43ac49.tar.gz |
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.
Diffstat (limited to 'include')
-rw-r--r-- | include/ilist.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/ilist.h b/include/ilist.h index 5d0a425a9cc..722677f9057 100644 --- a/include/ilist.h +++ b/include/ilist.h @@ -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_; |