Re: safe method overloading with different refness of its arguments

2017-07-04 Thread drug via Digitalmars-d-learn
04.07.2017 15:06, Basile B. пишет: On Tuesday, 4 July 2017 at 10:40:42 UTC, drug wrote: ``` struct Foo { ubyte width, length; // by reference bool opEquals(ref const(Foo) other) const pure @safe { if (width != other.width) return false; if (length !=

Re: safe method overloading with different refness of its arguments

2017-07-04 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 4 July 2017 at 10:40:42 UTC, drug wrote: ``` struct Foo { ubyte width, length; // by reference bool opEquals(ref const(Foo) other) const pure @safe { if (width != other.width) return false; if (length != other.length) return fal

safe method overloading with different refness of its arguments

2017-07-04 Thread drug via Digitalmars-d-learn
``` struct Foo { ubyte width, length; // by reference bool opEquals(ref const(Foo) other) const pure @safe { if (width != other.width) return false; if (length != other.length) return false; return true; } // by value bo