array construction without heap alloc
Derek Parnell
derek at psych.ward
Sat Dec 22 14:05:36 PST 2007
On Fri, 21 Dec 2007 21:25:31 +0100, Frank Benoit wrote:
This below seems to work...
import std.stdio;
void func( int[] a )
{
writefln("a's address = %08p", a.ptr);
}
void bar( int a, int b ){
int c;
writefln("c's address = %08p", &c);
scope int[2]f = [a,b];
func(f);
}
void main()
{
bar(1,2);
}
However the syntax is not as neat as you'd like it I guess.
--
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell
More information about the Digitalmars-d-learn
mailing list