On Wednesday, 6 January 2021 at 18:14:42 UTC, Luhrel wrote:
It works only for the `int` type and above (and other types as
structs).
example with short:
---
extern(C) void main()
{
import std.array;
auto a = [0, 1].staticArray!short; // error
}
Can be fixed (probably with another name):
//import std.array;
import std.stdio;
void main(){
auto a = [1,2,3].staticArray!float;
pragma(msg, typeof(a)); // float[3]
a.writeln();
}
template staticArray(T) {
T[n] staticArray(ulong n) (auto ref T[n] a) {return a;}
}