opEquals() non-standard return type
Neia Neutuladh
neia at ikeran.org
Thu Jan 24 02:02:46 UTC 2019
On Wed, 23 Jan 2019 15:19:06 +0000, Jacob Shtokolov wrote:
> I'm wondering, is that possible to declare multiple versions of
> opEquals() and evaluate them in the different places depending on return
> type?
I looked at this a while ago for similar reasons. It didn't pan out.
When you override the comparison operator, you can't distinguish which
comparison is overloaded. It takes at least 2^n evaluations of the
function to determine all the comparisons, possibly more. (I *think* you
can observe the short-circuiting logic as you do those evaluations to
determine how each comparison is combined.)
More information about the Digitalmars-d-learn
mailing list