1 struct OpApply 2 { 3 int opApply(scope int delegate(ref uint) dg) { assert(0); } 4 } 5 6 struct Range 7 { 8 @property uint front() { assert(0); } 9 void popFront() { assert(0); } 10 enum bool empty = false; 11 } 12 13 static assert( isIterable!(uint[])); 14 static assert( isIterable!OpApply); 15 static assert( isIterable!(uint[string])); 16 static assert( isIterable!Range); 17 18 static assert(!isIterable!uint);
Returns true if T can be iterated over using a foreach loop with a single loop variable of automatically inferred type, regardless of how the foreach loop is implemented. This includes ranges, structs/classes that define opApply with a single loop variable, and builtin dynamic, static and associative arrays.