The way I'd do the inBounds is to just use T size instead of size_t size.template inBounds(T, T size) { snip same stuff }thenwritefln("%s", inBounds!(int, 10).result); // true as expected
The problem with that though is that with size arguments > int.max will wrap when being cast to int (T)? i.e.:
import std.stdio; template inBounds(T, T size) { enum result = (size >= T.min && size <= T.max); } void main(string[] args) {writefln("%s", inBounds!(int, int.max + 1).result); //true, wrong!
}