changing in two arrays
%u
asmasm at hotmail.com
Sun Jun 26 04:59:39 PDT 2011
hi
I create two arrays and I want the change in one of them effects the other one.
i try
int[] array1 = [1, 2, 3, 4, 5];
int[] array2;
array2 = array1; // without .dup
assert(array1 == array2);
assert(array1 is array2); // here i am confused because 'is' mean thay have
the same address or what?
array2 ~= 6;
assert(array1 == [1, 2, 3, 4, 5]); // here is the problem
assert(array2 == [1, 2, 3, 4, 5, 6]);
More information about the Digitalmars-d-learn
mailing list