Pointer to array allocation

Derek Parnell derek at nomail.afraid.org
Sun Jun 17 22:20:47 PDT 2007


On Sun, 17 Jun 2007 23:51:25 +0200, 0ffh wrote:

> So what is the D way of doing what I mean?

> /I really do mean a pointer to a dynamic array./

Does this do the trick for you?

alias int[] Lst;
struct LD
{
    Lst da;
}

void test()
{
 LD* l=new LD; // Structs can be new'd on heap.
 foo(&l.da);   // Use address of dynarr in struct.
}

void foo(Lst *p)
{
}


-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Justice for David Hicks!"
18/06/2007 3:19:35 PM


More information about the Digitalmars-d-learn mailing list