Discussion Thread: DIP 1039--Static Arrays with Inferred Length--Community Review Round 1
    Nick Treleaven 
    nick at geany.org
       
    Wed Jan  6 18:34:31 UTC 2021
    
    
  
On Wednesday, 6 January 2021 at 18:29:05 UTC, Nick Treleaven 
wrote:
> Can be fixed (probably with another name):
>
> //import std.array;
Actually template overloading seems to work fine:
template staticArray(T) {
     T[n] staticArray(ulong n) (auto ref T[n] a) {return a;}
}
T[n] staticArray(T, ulong n) (auto ref T[n] a) {return a;}
void main(){
     auto a = [1,2,3].staticArray!float;
     pragma(msg, typeof(a)); // float[3]
     a.writeln();
     [1,2,3].staticArray.writeln();
}
    
    
More information about the Digitalmars-d-announce
mailing list