multiple opApply functions?
Jason House
jason.james.house at gmail.com
Sun May 20 21:23:47 PDT 2007
Is it possible to have multiple opApply calls for a single class? The
following code almost compiles. It appears gdc 0.23 (implementing dmd
1.007) tries to match against the first opApply instead of finding the
correct match (the 2nd opApply).
The compiler knows the first one is a bad match, gives an error, and
exits. How do I overcome this?
interface X(T,P){
int opApply(int delegate(P));
int opApply(int delegate(T));
int opApply(int delegate(P,T));
}
class Y(T,P) : public X(T,P){
...
}
int main(){
Y y = new Y!(int,float)(...);
foreach(int x; y){
...
}
}
More information about the Digitalmars-d-learn
mailing list