Re: Constants?

2009-02-12 Thread Mike L.
Thanks, glad to have it all in one place.

Re: how to initialize an array of struct

2009-02-12 Thread torhu
On 12.02.2009 15:16, Frits van Bommel wrote: bearophile wrote: westcity Wrote: But, the compiler report "Error: array initializers as expressions are not allowed". Then, how do I initialize an array of struct ? Move the definition out of main (note that ; after the struct isn't required)

Re: how to initialize an array of struct

2009-02-12 Thread Frits van Bommel
bearophile wrote: westcity Wrote: But, the compiler report "Error: array initializers as expressions are not allowed". Then, how do I initialize an array of struct ? Move the definition out of main (note that ; after the struct isn't required): struct Point { float x, y, z; } Point[3]

nth_element implementation

2009-02-12 Thread Wade
Hi all, Does anybody have an efficient nth_element implementation (ala the STL) for D 1.0. I was using the version from algortihms.d in DMD 2.012 but that seems to be non-existent anymore and was quite buggy. thanks, wade

Re: Structuring a library project—best practices

2009-02-12 Thread bearophile
Zarathustra: >If you want to test yours classes then the best method are the unittests. But >if you only want to verify that library was correct installed then you just >should use any component of the library.< I think that it's better to put unit tests as close as possible to the things they

Re: how to initialize an array of struct

2009-02-12 Thread bearophile
westcity Wrote: > But, the compiler report "Error: array initializers as expressions are not > allowed". > Then, how do I initialize an array of struct ? Move the definition out of main (note that ; after the struct isn't required): struct Point { float x, y, z; } Point[3] pts = [{1.0, 0.0

Re: how to initialize an array of struct

2009-02-12 Thread westcity
Frits van Bommel дµ½: > westcity wrote: > > My code is as following: > > > > struct Point { > > float x, y, z ; > > }; > > > > int main () > > { > > Point[3] pts = [ > > {1.0, 0.0, 0.0} , > > {0.0, 1.0, 0.0} , > > {0.0, 0.0, 1.0} >

Re: how to initialize an array of struct

2009-02-12 Thread Frits van Bommel
westcity wrote: My code is as following: struct Point { float x, y, z ; }; int main () { Point[3] pts = [ {1.0, 0.0, 0.0} , {0.0, 1.0, 0.0} , {0.0, 0.0, 1.0} ]; return 0 ; } But, the compiler report "Error: array

how to initialize an array of struct

2009-02-12 Thread westcity
My code is as following: struct Point { float x, y, z ; }; int main () { Point[3] pts = [ {1.0, 0.0, 0.0} , {0.0, 1.0, 0.0} , {0.0, 0.0, 1.0} ]; return 0 ; } But, the compiler report "Error: array initializers as ex