Re: Dynamic array void initialization

2011-03-08 Thread Tom
El 08/03/2011 21:42, Kai Meyer escribió: On 03/08/2011 02:34 PM, Tom wrote: import std.stdio; struct S { int i; int j; } int main(string[] args) { S[] ss = void; ss.length = 5; foreach (ref s; ss) s = S(1, 2); return 0; } Is the above code correct? (it doesn't work... it blows away or just gi

Re: Dynamic array void initialization

2011-03-08 Thread Kai Meyer
On 03/08/2011 05:42 PM, Kai Meyer wrote: On 03/08/2011 02:34 PM, Tom wrote: import std.stdio; struct S { int i; int j; } int main(string[] args) { S[] ss = void; ss.length = 5; foreach (ref s; ss) s = S(1, 2); return 0; } Is the above code correct? (it doesn't work... it blows away or just gi

Re: Dynamic array void initialization

2011-03-08 Thread Kai Meyer
On 03/08/2011 02:34 PM, Tom wrote: import std.stdio; struct S { int i; int j; } int main(string[] args) { S[] ss = void; ss.length = 5; foreach (ref s; ss) s = S(1, 2); return 0; } Is the above code correct? (it doesn't work... it blows away or just give and access violation error). I need to

Re: Dynamic array void initialization

2011-03-08 Thread spir
On 03/08/2011 11:57 PM, Steven Schveighoffer wrote: On Tue, 08 Mar 2011 17:48:37 -0500, Tom wrote: http://d.puremagic.com/issues/show_bug.cgi?id=5603 This is really sad. This kind of stuff is a must for performance. D is disappointing me too much yet :( There is always c's malloc, or you c

Re: Dynamic array void initialization

2011-03-08 Thread Steven Schveighoffer
On Tue, 08 Mar 2011 17:48:37 -0500, Tom wrote: http://d.puremagic.com/issues/show_bug.cgi?id=5603 This is really sad. This kind of stuff is a must for performance. D is disappointing me too much yet :( There is always c's malloc, or you can try using the GC malloc directly. For applic

Re: Dynamic array void initialization

2011-03-08 Thread Tom
El 08/03/2011 19:03, Steven Schveighoffer escribió: On Tue, 08 Mar 2011 16:53:08 -0500, Ali Çehreli wrote: On 03/08/2011 01:34 PM, Tom wrote: import std.stdio; struct S { int i; int j; } int main(string[] args) { S[] ss = void; ss.length = 5; foreach (ref s; ss) s = S(1, 2); return 0; } Is

Re: Dynamic array void initialization

2011-03-08 Thread Ali Çehreli
On 03/08/2011 02:03 PM, Steven Schveighoffer wrote: > it's not std.array.reserve, it's object.reserve, always present, no need > to import. Thanks. The reserve that I found in array.d is std.array.Appender(T).reserve. Ali

Re: Dynamic array void initialization

2011-03-08 Thread Steven Schveighoffer
On Tue, 08 Mar 2011 16:53:08 -0500, Ali Çehreli wrote: On 03/08/2011 01:34 PM, Tom wrote: import std.stdio; struct S { int i; int j; } int main(string[] args) { S[] ss = void; ss.length = 5; foreach (ref s; ss) s = S(1, 2); return 0; } Is the above code correct? (it doesn't work... it blows

Re: Dynamic array void initialization

2011-03-08 Thread Ali Çehreli
On 03/08/2011 01:34 PM, Tom wrote: import std.stdio; struct S { int i; int j; } int main(string[] args) { S[] ss = void; ss.length = 5; foreach (ref s; ss) s = S(1, 2); return 0; } Is the above code correct? (it doesn't work... it blows away or just give and access violation error). I need to

Dynamic array void initialization

2011-03-08 Thread Tom
import std.stdio; struct S { int i; int j; } int main(string[] args) { S[] ss = void; ss.length = 5; foreach (ref s; ss) s = S(1, 2); return 0; } Is the above code correct? (it doesn't work... it blows away or just give and access