Can i get a array Slicing where the top from?and how?

Dsby via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 30 23:39:19 PDT 2016


Like this:

ubyte[] fun()
{
     ubyte[] str = cast(ubyte[])"hello world";
     ubyte[] by = Mallocator.instance.allocate(str.length);
     by[] = str[];
     return by[5..$];
}

void mian()
{
     ubyte[] aa = fun();
    // i want free the aa's momeny.
    //Mallocator.instance.deallocate(aa);// it is erro, aa.ptr != 
by.ptr?
  // can I get the by's ptr and length?
}


can I get "by" in main function by aa?
i can get the way?is it possible ?


More information about the Digitalmars-d-learn mailing list