problem with array of delegates!

Lloyd Dupont ld-REMOVE at galador.net
Sun Jun 19 07:42:46 PDT 2011


the following code seem problematic to compile...

====
import std.algorithm;
private alias void delegate(int, int) SlotDelegate;

class A
{
    void DIT(int a, int b)
    {
    }
}

int main(string[] argv)
{
    A a;
    SlotDelegate x= &a.DIT;

    SlotDelegate[] _slotDg;
    _slotDg.remove(x);

    return 0;
}
====
I have some strange error:
Error: incompatible types for ((pos) < (from)): 'uint' and 'void 
delegate(int, int)' 
C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d    5609


I try a method like that as well (but similar problem! :( )
====
void removeAt(T)(ref T[] array, int index)
{
    if(index < 0 || index >= array.length)
        return;
    const T[] empty = null;
    array.replaceInPlace(index, index + 1, empty);
}
==== 



More information about the Digitalmars-d-learn mailing list