On Friday, 4 August 2017 at 12:49:30 UTC, Q. Schroll wrote:
One can do
  BigInt n = returnsBigInt();
  foreach (i; BigInt(0) .. n)
  { .. }
How is this implemented? The code for BigInt is very large and I didn't find it.
And is it more efficient than
  for (BigInt i = 0; i < n; ++i)
  { .. }
as incrementing is a costly operation?

you can see what the code is lowerd to with -vcg-ast
The hand-written for is as effective as foreach usually.

Reply via email to