July 17, 2013
Hi, I tried to compare two sets by opCmp, but I couldn't get correct outputs.

Does anyone help me?


I have same sets of set S1 = [1,2,3] and S2 = [1,2,3].

Output of S1<S2 should be false because S1 is not a proper subset.

However, S1<=S2 should be true because S1 is a subset of S1.


I can't make a difference between two sets by if statements, so I can't make different output.

Does any have a idea for it?

Thank you.
July 18, 2013
Jaehunt:

> Does any have a idea for it?

Unfortunately this is a design limitation of D operator overloading. I have shown this problem in the main D newsgroup lot of time ago. I don't remember the answer, but nothing changed. You can bring the problem again in the main D newsgroup...

In the meantime you have to define UFCS functions as:

s1.isSubset(s2)
s2.isStrictSubset(s2)

Bye,
bearophile