I hope this is understandable... I have:

class C {
        void A();
        void B();
        void C();
}

I'm iterating over a set of objects of class C like:

foreach(obj; my_selected_objs){
        ...
}

The iteration and code before/afterwards always looks the same, I need this iteration for many of the memember functions like C.A() and C.B(), etc.

foreach(obj; my_selected_objs){
        ...
        obj.A|B|C()
        ...
}

So, how can I write a generic handler that does the iteration, where I can specify which member function to call?

void do_A() {
        handler(C.A()); ???
}

void do_B() {
        handler(C.B()); ???
}

handler(???){
        foreach(obj: my_selected_objs){
                ???
        }
}

Viele Grüsse.

--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster

Reply via email to