confusion about structs

Christian Köstlin christian.koestlin at gmail.com
Mon Sep 26 11:05:28 PDT 2011


On 09/26/2011 12:04 AM, Andrej Mitrovic wrote:
> This should make things clearer for you:
>
> fittest
> {
>      auto h1 = get(1);
>      auto h2 = get(2);
>
>      assert(h1 is h2);  // both reference the same array
> }
>
> Field initialization is only done once (once per thread, or if a field
> is shared once on app start) and not each time you call the
> constructor.
Thanks for the explanation!

Coming from a java background I confused the possibility to initialize 
at compile-time with the java-style initialization.



More information about the Digitalmars-d-learn mailing list