Re: Overloading comparison and Equality Operators

2011-09-07 Thread Timon Gehr
On 09/07/2011 05:28 AM, Brad Roberts wrote: On Tuesday, September 06, 2011 9:09:06 AM, Timon Gehr wrote: On 09/06/2011 04:13 PM, d coder wrote: Greetings It seems D assumes that these operators should return a bool value. For example a< b is re-written as a.​opCmp(b)< 0. In my application,

Re: Overloading comparison and Equality Operators

2011-09-06 Thread Brad Roberts
On Tuesday, September 06, 2011 9:09:06 AM, Timon Gehr wrote: > On 09/06/2011 04:13 PM, d coder wrote: >> Greetings >> >> It seems D assumes that these operators should return a bool value. >> For example a< b is re-written as a.​opCmp(b)< 0. >> In my application, I wanted to overload comparison a

Re: Overloading comparison and Equality Operators

2011-09-06 Thread d coder
> Actually not expression templates. I am porting a BDD (Binary decision > diagrams) library from C++ to D. The comparison operators are just > implemented as relations that return another BDD. A BDD would then > evaluate to 0 or 1 depending on many other factors and other BDDs. A > BDD actually re

Re: Overloading comparison and Equality Operators

2011-09-06 Thread d coder
>>> For example a < b is re-written as a.opCmp(b) < 0. >>> In my application, I wanted to overload comparison and equality >>> operators to return user defined values. Is that possible in D? If so >>> how? >> >> What are you trying to do? >> In the end opCmp can return any value or object that work

Re: Overloading comparison and Equality Operators

2011-09-06 Thread Timon Gehr
On 09/06/2011 07:21 PM, Trass3r wrote: For example a < b is re-written as a.​opCmp(b) < 0. In my application, I wanted to overload comparison and equality operators to return user defined values. Is that possible in D? If so how? What are you trying to do? In the end opCmp can return any value

Re: Overloading comparison and Equality Operators

2011-09-06 Thread Trass3r
For example a < b is re-written as a.​opCmp(b) < 0. In my application, I wanted to overload comparison and equality operators to return user defined values. Is that possible in D? If so how? What are you trying to do? In the end opCmp can return any value or object that works in the rewritten

Re: Overloading comparison and Equality Operators

2011-09-06 Thread Timon Gehr
On 09/06/2011 04:13 PM, d coder wrote: Greetings It seems D assumes that these operators should return a bool value. For example a< b is re-written as a.​opCmp(b)< 0. In my application, I wanted to overload comparison and equality operators to return user defined values. Is that possible in D?