Arrays are sufficient for ArrayLists? Really??

Mehrdad wfunction at hotmail.com
Mon May 16 12:57:10 PDT 2011


On 5/16/2011 12:53 PM, Andrei Alexandrescu wrote:
> On 5/16/11 2:44 PM, Mehrdad wrote:
> The function as implemented first assigns a[1]=a[0] and then a[2]=a[1],
> leading to [0, 0, 0, 3, 4] which is not what's needed.

Oh yeah good point.

>> Is there any way to find out if an array is a slice of another array?
>
> No. If there would, it would be a rather advanced function. Allow me to
> reiterate my suggestion: it's likely you have a simple problem with a
> simple solution based on slices, which are a simple abstraction.
> Therefore I suggest you rethink a bit of your design, and it's possible
> you won't need assumeSafeAppend et al.
>
>
> Andrei

Yeah, seems like even if it was, it wouldn't solve the problem in all 
cases. I'll try going around the problem, thanks.


More information about the Digitalmars-d mailing list