Re: On opCmp

2015-03-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/2/15 8:52 AM, "Nordlöw" wrote: On Friday, 27 February 2015 at 15:00:35 UTC, Steven Schveighoffer wrote: Hm... what about: return count < rhs.count ? -1 : count > rhs.count ? 1 : rank < rhs.rank ? -1 : rank > rhs.rank; Is this more efficient than my version? You said "more compact", not

Re: On opCmp

2015-03-02 Thread Nordlöw
On Friday, 27 February 2015 at 15:00:35 UTC, Steven Schveighoffer wrote: Hm... what about: return count < rhs.count ? -1 : count > rhs.count ? 1 : rank < rhs.rank ? -1 : rank > rhs.rank; Is this more efficient than my version?

Re: On opCmp

2015-02-27 Thread Ali Çehreli via Digitalmars-d-learn
On 02/27/2015 03:04 AM, "Nordlöw" wrote: Is there a more compact way to describe the opCmp function in the following struct Please see: http://forum.dlang.org/thread/lnr99a$vvd$1...@digitalmars.com#post-lnr99a:24vvd:241:40digitalmars.com Ali

Re: On opCmp

2015-02-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/27/15 6:04 AM, "Nordlöw" wrote: Is there a more compact way to describe the opCmp function in the following struct struct Hit { size_t count; // number of walkers that found this node NWeight rank; // rank (either minimum distance or maximum strength) auto opCmp(const Hit rh

Re: On opCmp

2015-02-27 Thread anonymous via Digitalmars-d-learn
On Friday, 27 February 2015 at 11:04:51 UTC, Nordlöw wrote: Is there a more compact way to describe the opCmp function in the following struct struct Hit { size_t count; // number of walkers that found this node NWeight rank; // rank (either minimum distance or maximum strength)

On opCmp

2015-02-27 Thread Nordlöw
Is there a more compact way to describe the opCmp function in the following struct struct Hit { size_t count; // number of walkers that found this node NWeight rank; // rank (either minimum distance or maximum strength) auto opCmp(const Hit rhs) const { if (this.c