1
如何在模板約束中使用std.range.ElementType?模板約束中的ElementType
我以爲這樣,可是我錯了
import std.range;
auto f(T)(T x)
if (ElementType!(T) is uint) // adding this line causes lot of error messages
// first of which is: found ')' when expecting '.' following uint
{
return x;
}
f(map!"a"([1,2,3,4]));
它只發生在我認爲CTFE。 – Mehrdad