On Wednesday, 6 June 2018 at 14:46:56 UTC, ag0aep6g wrote:
On 06/06/2018 04:20 PM, Flaze07 wrote:
hmm, and sorry for asking more, what about removing an element from it ? I found no remove operation that can remove from the middle ( removeAny and removeBack both removes the latest element, linearRemove receive Array!uint...which  don't know how to provide )

I think removeKey would be the container primitive for that. I don't know if there's a reason why it isn't implemented for Array. Maybe it's just an oversight.

You can use linearRemove like this:

----
import std.container.array: Array;
import std.stdio: writeln;
void main()
{
    Array!int a = [1, 2, 100, 200, 300, 3, 4];
    a.linearRemove(a[2 .. 5]);
        /* Removes elements at indices 2, 3, and 4. */
    writeln(a[]); /* Prints "[1, 2, 3, 4]". */
}
----

ah...well thank you, well...I did finds another way, but it is probably better to use linearRemove
I used
arr = make!( Array!uint )( remove( arr[], 2 );
so linearRemove is probably better

Reply via email to