Is "is" the same as ptr == ptr for arrays?

Simen kjaeraas simen.kjaras at gmail.com
Sat Aug 7 10:36:59 PDT 2010


simendsjo <simen.endsjo at pandavre.com> wrote:

> Ok, thanks. Does this mean this equivalent then?
>
> int[] a = [1,2,3];
> int[] b = a[0..1];
> assert(a !is b);
> assert(a.ptr == b.ptr && a.length == b.length);

Well, no. But what you probably mean, is.

( a is b ) == ( a.ptr == b.ptr && a.length == b.length )

-- 
Simen


More information about the Digitalmars-d-learn mailing list