Operator overloading for size_t

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Mar 14 18:25:17 UTC 2019


On Thu, Mar 14, 2019 at 06:07:46PM +0000, Alec Stewart via Digitalmars-d-learn wrote:
[...]
>     bool opEquals(ref const Interval i) const {
>         // probably would be a bit more than just this, but for this issue
>         // let's just stick with this.
>         return d_start.opEquals(other.d_start) && d_end.opEquals(other.d_end);
>     }

There's no need to call opEquals explicitly like that. All you need to
do is to use <, ==, and > as you normally would:

     bool opEquals(ref const Interval i) const {
         return d_start == other.d_start) && d_end == d_end;
     }


T

-- 
Без труда не выловишь и рыбку из пруда. 


More information about the Digitalmars-d-learn mailing list