Re: sort error

2013-06-29 Thread Ali Çehreli
On 06/29/2013 07:52 AM, monarch_dodra wrote: > This is strange to me because ordering is (usually) tied to a norm, > where basically, opCmp returns whoever has the smallest norm. Yet this > ordering isn't really tied to any norm. Agreed. The opCmp that I have written makes sense when there is a

Re: sort error

2013-06-29 Thread monarch_dodra
On Saturday, 29 June 2013 at 14:54:13 UTC, snow wrote: On Saturday, 29 June 2013 at 14:20:05 UTC, Ali Çehreli wrote: Not knowing whether it applies to your case, the following is one almost correct way of writing opCmp: int opCmp(ref const Vector3D vec) { return cast(int)(x != vec.x

Re: sort error

2013-06-29 Thread monarch_dodra
On Saturday, 29 June 2013 at 14:20:05 UTC, Ali Çehreli wrote: Not knowing whether it applies to your case, the following is one almost correct way of writing opCmp: int opCmp(ref const Vector3D vec) { return cast(int)(x != vec.x ? x - vec.x

Re: sort error

2013-06-29 Thread snow
On Saturday, 29 June 2013 at 14:20:05 UTC, Ali Çehreli wrote: On 06/29/2013 05:46 AM, snow wrote: > On Friday, 28 June 2013 at 17:07:22 UTC, Ali Çehreli wrote: >> Your opCmp does not provide a complete ordering of objects: >> >> int opCmp(ref const Vector3D vec) { >> if (this.x > ve

Re: sort error

2013-06-29 Thread Ali Çehreli
On 06/29/2013 05:46 AM, snow wrote: > On Friday, 28 June 2013 at 17:07:22 UTC, Ali Çehreli wrote: >> Your opCmp does not provide a complete ordering of objects: >> >> int opCmp(ref const Vector3D vec) { >> if (this.x > vec.x && this.y > vec.y && this.z > vec.z) >> return

Re: sort error

2013-06-29 Thread snow
On Friday, 28 June 2013 at 17:07:22 UTC, Ali Çehreli wrote: On 06/28/2013 07:00 AM, snow wrote:> Hello there, > Ive got the following code > > http://dpaste.dzfl.pl/e391a268 > > This code throws me a "Range Exception" in Algorithm.d. > > If I use a lower number of random vectors, like 100, the co

Re: sort error

2013-06-28 Thread Ali Çehreli
On 06/28/2013 07:00 AM, snow wrote:> Hello there, > Ive got the following code > > http://dpaste.dzfl.pl/e391a268 > > This code throws me a "Range Exception" in Algorithm.d. > > If I use a lower number of random vectors, like 100, the code > terminates. Also, if I delete the template instruction l

Re: sort error

2013-06-28 Thread bearophile
snow: http://dpaste.dzfl.pl/e391a268 This code throws me a "Range Exception" in Algorithm.d. If I use a lower number of random vectors, like 100, the code terminates. Also, if I delete the template instruction like this : sort(individuals); I also don't get an exception. Does anybody know