I am planning to implement "Iterator" class. But looking at "foreach" statement, it takes a range only.

So is there any way other than returning an array from a function that is to be passed foreach statement? So I could write like that:

Iterator iter = new MyList();

foreach(item; iter){
}


Otherwise I will need to write like that:

foreach(item; iter.getArrayOfAvailableItems()){
}

Reply via email to