Re: Overloading opEquals(T)(T y)

2011-02-08 Thread Steven Schveighoffer
On Tue, 08 Feb 2011 11:49:47 -0500, spir wrote: On 02/08/2011 05:17 PM, Steven Schveighoffer wrote: What is the difference between: bool opEquals(T)(T y) if (is(T == BigRational)) {...} and bool opEquals(T)(T y) { static if(is(T == BigRational)) {...} else static assert(0, "invalid type")

Re: Overloading opEquals(T)(T y)

2011-02-08 Thread spir
On 02/08/2011 05:17 PM, Steven Schveighoffer wrote: On Tue, 08 Feb 2011 10:52:35 -0500, spir wrote: On 02/08/2011 12:16 AM, bearophile wrote: Charles McAnany: Hi, all. So I'm trying to make a BigRational struct, to get more comfortable with D. I just thought at this alternative between

Re: Overloading opEquals(T)(T y)

2011-02-08 Thread Steven Schveighoffer
On Tue, 08 Feb 2011 10:52:35 -0500, spir wrote: On 02/08/2011 12:16 AM, bearophile wrote: Charles McAnany: Hi, all. So I'm trying to make a BigRational struct, to get more comfortable with D. I suggest to ask similar questions in the D.learn newsgroup. bool opEquals(Tdummy = void)(Big

Re: Overloading opEquals(T)(T y)

2011-02-08 Thread spir
On 02/08/2011 12:16 AM, bearophile wrote: Charles McAnany: Hi, all. So I'm trying to make a BigRational struct, to get more comfortable with D. I suggest to ask similar questions in the D.learn newsgroup. bool opEquals(Tdummy = void)(BigRational y){ auto temp = this-y; if (

Re: Overloading opEquals(T)(T y)

2011-02-07 Thread bearophile
Charles McAnany: > Hi, all. So I'm trying to make a BigRational struct, to get more comfortable > with D. I suggest to ask similar questions in the D.learn newsgroup. > bool opEquals(Tdummy = void)(BigRational y){ > auto temp = this-y; > if (temp.numerator == 0) > return true;

Overloading opEquals(T)(T y)

2011-02-07 Thread Charles McAnany
Hi, all. So I'm trying to make a BigRational struct, to get more comfortable with D. I'm working on the opEquals part now, and I'm having some difficulty. I'd like to write an equality checker for two BigRationals, and have all other comparisons make a BigRational of the rhs and then forward that t