On Monday 17 January 2011 15:13:42 spir wrote: > See range bug evoked above. opApply is the only workaround AFAIK. > Also, ranges cannot yet provide indexed iteration like > foreach(i, char ; text) {...}
While it would be nice at times to be able to have an index with foreach when using ranges, I would point out that it's trivial to just declare a variable which you increment each iteration, so it's easy to get an index even when using foreach with ranges. Certainly, I wouldn't consider the lack of index with foreach and ranges a good reason to use opApply instead of ranges. There may be other reasons which make it worthwhile, but it's so trivial to get an index that the loss of range abilities (particularly the ability to use such ranges with std.algorithm) dwarfs it in importance. - Jonathan M Davis