Re: Array Slicing

2020-09-29 Thread DMon via Digitalmars-d-learn
On Sunday, 27 September 2020 at 14:25:34 UTC, H. S. Teoh wrote: On Sun, Sep 27, 2020 at 01:59:07PM +, DMon via Digitalmars-d-learn wrote: Are these in the Specification or Phobos? See: https://dlang.org/articles/d-array-article.html T Or in Articles? Thanks, Teoh.

Re: Array Slicing

2020-09-27 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Sep 27, 2020 at 01:59:07PM +, DMon via Digitalmars-d-learn wrote: > Are these in the Specification or Phobos? See: https://dlang.org/articles/d-array-article.html T -- Государство делает вид, что платит нам зарплату, а мы делаем вид, что работаем.

Array Slicing

2020-09-27 Thread DMon via Digitalmars-d-learn
Are these in the Specification or Phobos? I figured them out a few days ago. These are from my snippet journal on arrays and there may be more. void main() { int[5] a = [1, 2, 3, 4, 5]; int[5][3] b = [[6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]]; int[5] c; //

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

2016-03-31 Thread Ali Çehreli via Digitalmars-d-learn
On 03/30/2016 11:39 PM, Dsby wrote: > 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

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

2016-03-30 Thread Dsby via Digitalmars-d-learn
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 e