Thanks.
struct S { int a, b; } auto toStaticArray(alias array)() { struct S { int a, b; } immutable tab = { static enum S[] s = array; return cast(typeof(s[0])[s.length])s; }(); return tab; } enum a = toStaticArray!([{1,2},{3,4}]); // error
Erik Smith via Digitalmars-d-learn Mon, 02 May 2016 10:21:06 -0700
Thanks.
struct S { int a, b; } auto toStaticArray(alias array)() { struct S { int a, b; } immutable tab = { static enum S[] s = array; return cast(typeof(s[0])[s.length])s; }(); return tab; } enum a = toStaticArray!([{1,2},{3,4}]); // error