On 12/10/2011 12:08 PM, bearophile wrote:
Timon Gehr:

No, popFront is mutating and const(int[]) cannot be mutated.

So, is it impossible by design to iterate immutable collections?


No, it is impossible to popFront an immutable array. Because it is, well, immutable. But you can always slice it and get a range back that can be used to iterate the array (btw thanks to the devs for fixing that, that did not work a few releases ago!).

Library defined immutable collection types can/should use the same pattern.

Reply via email to