On Wed, 22 Jul 2020, Niall Douglas via Boost wrote:
On 22/07/2020 17:39, Andrey Semashev via Boost wrote:
On 2020-07-22 19:25, Niall Douglas via Boost wrote:
So Peter, seeing as you're the closest person to an expert in C++ 20 operator rewriting that I know of (and there is absolutely nothing about this on the internet),
FWIW, I found this article helpful to understand the new operators behavior:
https://brevzin.github.io/c++/2019/07/28/comparisons-cpp20/
TL;DR version is in the summary:
https://brevzin.github.io/c++/2019/07/28/comparisons-cpp20/#summary-of-rules
That was very useful.
It turns out that for operator== only, C++ 20 will auto reverse it. So, in Outcome, I need to disable free function reversed operator== only, for C++ 20 and later. I must leave free function reversed operator!= alone.
Because operator== rewriting broke quite a bit of code, some committee people are trying to revert this change (make it opt-in or something) via DR. So it may be safer for now to write code in a way that works for both C++17 and C++20 rules without #ifdefs, where possible (or fully use <=> where that makes sense, which counts as opt-in). -- Marc Glisse