On 24.10.2011 23:55, maarten van damme wrote:
I've stumbled in an annoying error while trying to remove an item from a
dynamic array.
It's an array of Loc and a Loc is a simple struct of two integers.
when I used remove from std.algorithm I get
C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(5948): Error:
incompatible types for ((pos) <= (from)): 'uint' and 'Loc'
C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(5949): Error:
incompatible types for ((pos) < (from)): 'uint' and 'Loc'

is it suposed to do this?

Could you add some sample code?
I think remove wants indexes, not values:

import std.stdio, std.algorithm;
struct S {
    int a, b;
}
void main() {
    auto arr = [S(0,1), S(2,3), S(4,5)];
    writeln(arr);
    arr = arr.remove(0, 2);
    writeln(arr);
}

prints:
[S(0, 1), S(2, 3), S(4, 5)]
[S(4, 5)]

Reply via email to