problem with array of delegates!

Lloyd Dupont ld at galador.net
Sun Jun 19 19:56:09 PDT 2011


There is a remove() method in std.algorithm!I even got asked why I was 
reimplementing it!
(well, because I didn't know it existed hey!)

works fine with, say, int...

but not with delegate!

associative array will solve the problem indeed.. (I hope) but they use way 
more memory!
it would be nice to have remove working() :)


Further, as you can see in my post, even my (reasonable) implementation of 
removeAt() fail! :(
(but, again, it works for int!)




"Andrej Mitrovic"  wrote in message 
news:mailman.1010.1308495216.14074.digitalmars-d-learn at puremagic.com...

Remove takes an offset, not a value as far as I know.

If you need fast lookup and removal you could use hashes instead:

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

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

    return 0;
} 



More information about the Digitalmars-d-learn mailing list