On Wed, Aug 09, 2017 at 09:34:26PM +0000, Q. Schroll via Digitalmars-d-learn wrote: > On Friday, 4 August 2017 at 16:40:08 UTC, Stefan Koch wrote: > > [..] > > > > foreach(x;A .. B) > > it's lowerd to > > auto limit = B; > > auto key = A; > > for(auto x = key;key < limit;++key) > > { > > // use x > > } > > That's enough to know that the foreach loop does not reuse the space > for the iteration variable. That was what I cared about.
Note that using BigInt as iteration variable will probably cause a BigInt allocation per iteration, because operations on BigInt in general will allocate a new BigInt result. So `++key` will probably create a new instance of BigInt each time it's executed. T -- To provoke is to call someone stupid; to argue is to call each other stupid.