Removing an array element in order?
Sean Kelly
sean at f4.ca
Sun Jul 2 14:59:56 PDT 2006
Assuming I want to remove an element in an array and preserve order,
does the D spec consider it legal to do this:
char[] str = "abc def";
int pos = 3;
str[pos .. $-1] = str[pos+1 .. $];
str.length = str.length - 1;
assert( memcmp( &str[0], "abcdef", str.length ) );
Or are slice copy semantics equivalent to memcpy where overlapping
regions are not allowed?
Sean
More information about the Digitalmars-d-learn
mailing list