Short list with things to finish for D2
KennyTM~
kennytm at gmail.com
Wed Nov 18 20:47:06 PST 2009
On Nov 19, 09 07:48, bearophile wrote:
> Andrei Alexandrescu:
>
>> * Encode operators by compile-time strings. For example, instead of the
>> plethora of opAdd, opMul, ..., we'd have this:
>>
>> T opBinary(string op)(T rhs) { ... }
>>
>> The string is "+", "*", etc.
>
> Can you show an example of defining an operator, like a minus, with that?
>
> In my set data structure I'd like to define "<=" among two sets as "is subset". Can that design allow me to overload just<= and>= ? (opCmp is not enough here).
>
> Bye,
> bearophile
float opCmp(X other) {
if (this cannot compare with other)
return float.nan;
else
...
}
More information about the Digitalmars-d
mailing list