On Friday, 24 March 2017 at 21:13:26 UTC, Yuxuan Shui wrote:
On Friday, 24 March 2017 at 20:43:18 UTC, Dmitry Olshansky

template A(alias str)
if(is(typeof(str) : Char[], Char)){
        alias Char = typeof(str[0]);
//      ...
}

One problem of this is that 'str' is not longer restricted to be a compile time value. Which is probably fine, but kind of makes me uncomfortable.

To test wether str is a compile time value just check if you can use it to assign to an enum if(is(typeof(str) : Char[], Char) && is(typeof({enum foo = str;})))

Reply via email to