'each' can take static arrays

Ali Çehreli acehreli at yahoo.com
Fri Jun 10 16:59:04 UTC 2022


I know static arrays are not ranges but somehow they work with 'each'. 
With map, I need to slice as 'arr[]':

import std;

void main() {
   int[3] arr;

   arr.each!(e => e);    // Compiles
   // arr.map!(e => e);  // Fails to compile
   arr[].map!(e => e);   // Compiles
}

Why the inconsistency?

Ali



More information about the Digitalmars-d-learn mailing list