Formatted output of range of tuples

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Oct 12 23:15:20 PDT 2014


On 10/08/2014 02:31 PM, bearophile wrote:

 > For indexes now there is also "enumerate".
 >
 > Bye,
 > bearophile

Thanks for the tip. std.range.enumerate makes a big difference:

     foreach (i, element; MyRange(42).enumerate) {
         // ...
     }

versus sequence!"n" and zip:

     foreach (i, element; zip(sequence!"n", MyRange(42))) {
         // ...
     }

Ali



More information about the Digitalmars-d-learn mailing list