Am Sun, 22 Apr 2012 23:47:20 +0200 schrieb "SomeDude" <lovelyd...@mailmetrash.com>:
> void main() { > auto array = new Foo[10]; > --> for(int i = array.length; i > 1; i--) { array[i].x = i; } > writeln(); > foreach(Foo f; array) { write(f.x);} > } > > throws core.exception.RangeError@bug(8): Range violation on the > line with the arrow. > > What am I doing wrong ? You could also try: foreach_reverse(i, ref f; array) { f.x = i; } -- Marco