Array remove 1 item? (std.container)

Damian damianday at hotmail.co.uk
Wed Jan 9 07:29:49 PST 2013


On Wednesday, 9 January 2013 at 15:20:40 UTC, Robert wrote:
> On Wednesday, 9 January 2013 at 15:06:01 UTC, Damian wrote:
>> Hi, I've got the jist of using most of std.container.Array, but
>> I can't seem to remove a single item, I understand I must 
>> remove
>> a range.
>>
>> Array!int arr;
>> arr.insert([1, 2, 3, 4, 5]);
>>
>> So now how would I remove lets say the number 3 from my array 
>> in the most efficient way? which would leave me with [1, 2, 4, 
>> 5] ??
>>
>> For reference I'm using an Array to replace a C++ std::vector..
>
> Hi, you can do arr.linearRemove(arr[2..3]);
>
> but i dont know if its the best way...

Ah yes this I've been doing and its working as expected, I was 
not sure if i was doing it the correct way though.


More information about the Digitalmars-d-learn mailing list