opApply outside of struct/class scope
    Freddy via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Sun Aug 10 11:44:59 PDT 2014
    
    
  
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
    
    
More information about the Digitalmars-d-learn
mailing list