I'm trying to implement a opApply outside of struct scope
----
struct A{
int[] arr;
}
int opApply(ref A a,int delegate(ref int) dg){
return 0;
}
void main(){
A a;
foreach(i;a){//i just want it to compile
}
}
----
when i try compiling, the compiler errors:
test.d(9): Error: invalid foreach aggregate a
Is there any why i can put a opApply outside of a struct scope,if
so is there any why that the opApply can be templated
opApply outside of struct/class scope
Freddy via Digitalmars-d-learn Sun, 10 Aug 2014 11:46:33 -0700
- opApply outside of struct/class s... Freddy via Digitalmars-d-learn
- Re: opApply outside of struc... Jonathan M Davis via Digitalmars-d-learn
- Re: opApply outside of s... Era Scarecrow via Digitalmars-d-learn
- Re: opApply outside ... Jonathan M Davis via Digitalmars-d-learn
- Re: opApply outs... Era Scarecrow via Digitalmars-d-learn
- Re: opApply... Era Scarecrow via Digitalmars-d-learn
- Re: opApply... Jonathan M Davis via Digitalmars-d-learn
- Re: opA... Era Scarecrow via Digitalmars-d-learn
