Daniel Keep wrote:
Tim Matthews wrote:
Kagamin wrote:
Tim Matthews Wrote:
I thought a slice would behave slighty different due to some sort of
meta data that is a separate area of memory so it doesn't effect D's
abi.
Current plan is to introduce new type - array - into the language.
Do yo
Hello Tim,
Sorry I misread (lacking sleep).
Been there, done that. :oz
Sorry I misread (lacking sleep). I can just re slice from the slice,
silly me.
import std.stdio;
void extendSlice(T)(ref T[] slice, uint extendCount)
{
slice = slice.ptr[0..slice.length+extendCount];
}
void main()
{
char[] a = "Hello".dup;
char[] b;
b = a[1..3]; //b is a view i
Hello Tim,
BCS wrote:
Hello Tim,
Anyway I like how you can get a slice of array that is just a view
into the original. If I modify the slice, it modifies the full
original array which can be very useful. If however I modify the
length of the slice which I was doing in an attempt to extend th
Tim Matthews wrote:
> Kagamin wrote:
>> Tim Matthews Wrote:
>>
>>> I thought a slice would behave slighty different due to some sort of
>>> meta data that is a separate area of memory so it doesn't effect D's
>>> abi.
>>>
>> Current plan is to introduce new type - array - into the language.
>
>
Kagamin wrote:
Tim Matthews Wrote:
I thought a slice would behave slighty different due to some sort of
meta data that is a separate area of memory so it doesn't effect D's abi.
Current plan is to introduce new type - array - into the language.
Do you know the ng posts or where ever that w
Tim Matthews Wrote:
> I thought a slice would behave slighty different due to some sort of
> meta data that is a separate area of memory so it doesn't effect D's abi.
>
Current plan is to introduce new type - array - into the language.
BCS wrote:
Hello Tim,
Anyway I like how you can get a slice of array that is just a view
into the original. If I modify the slice, it modifies the full
original array which can be very useful. If however I modify the
length of the slice which I was doing in an attempt to extend the
view, it bec
Hello Tim,
Anyway I like how you can get a slice of array that is just a view
into the original. If I modify the slice, it modifies the full
original array which can be very useful. If however I modify the
length of the slice which I was doing in an attempt to extend the
view, it becomes it's ow
Steven Schveighoffer wrote:
This is really not a good idea. You've removed one of the core features
of the array -- memory safety. Doing this is just asking for memory
corruption. You should either re-slice the original array, or create a
type that has a reference to the original array so it
On Wed, 08 Jul 2009 23:09:52 -0400, Tim Matthews
wrote:
Steven Schveighoffer wrote:
On Wed, 08 Jul 2009 02:48:31 -0400, Tim Matthews
wrote:
Was this a design choice, bug, undefined behavior, etc...?
design choice.
A slice *is* an array in the current design. Increasing the length
Steven Schveighoffer wrote:
On Wed, 08 Jul 2009 02:48:31 -0400, Tim Matthews
wrote:
Was this a design choice, bug, undefined behavior, etc...?
design choice.
A slice *is* an array in the current design. Increasing the length may
or may not make a copy of it. An array slice doesn't know
Kagamin wrote:
For this I use begin markers:
ubyte[] buff=new ubyte[100];
int half=buff.length/2;
ubyte[] buff1=buff[0..half];
ubyte[] buff2=buff[half..$];
I actually think this has nothing to do with my OP.
Kagamin Wrote:
> Tim Matthews Wrote:
>
> > Was this a design choice, bug, undefined behavior, etc...?
>
> Design choice. In order to widen slice to should recreate it from the
> original array.
For this I use begin markers:
ubyte[] buff=new ubyte[100];
int half=buff.length/2;
ubyte[] buff1=bu
Tim Matthews Wrote:
> Was this a design choice, bug, undefined behavior, etc...?
Design choice. In order to widen slice to should recreate it from the original
array.
First off if this has been asked so many times please just ignore this.
You should be able to collapse this whole subject in most good new
readers plus it is in d.learn out of the way so I expect no "ahh here we
go again" sort of replies.
Anyway I like how you can get a slice of array that is
16 matches
Mail list logo