Hi, all!
Try this:
--- snip ---
void remove(T)(out T[] array,T element) {
int r=0,w=0;
while (rarray.length) {
if (array[r]!=element)
array[w++]=array[r];
++r;
}
array.length=w;
}
void test() {
int[] array;
int element=2;
//
array=[1,3,2,2,1,3,1,1,2];
On Tue, 24 Aug 2010 11:18:35 -0400, 0ffh
fr...@youknow.what.todo.internetz wrote:
Hi, all!
Try this:
--- snip ---
void remove(T)(out T[] array,T element) {
int r=0,w=0;
while (rarray.length) {
if (array[r]!=element)
array[w++]=array[r];
++r;
}
array.length=w;
0ffh fr...@youknow.what.todo.internetz wrote:
So, my question is: Huh?
The answer to this should for symmetry be: Duh!
However, it is not quite that simple.
void remove(T)(out T[] array,T element) {
This is the line that gives you problems. You are expecting 'out' to
work like 'ref',