On Thursday, 24 March 2016 at 22:52:20 UTC, Jack Stouffer wrote:
You just illustrated my point exactly. This doesn't scale, you can't create special rules for every type when you're writing a library. Nullable is aliased to the get function, which returns int in this case. YOU SHOULDN'T HAVE TO DO THIS.

This is the exact use case of alias this and it doesn't work.

Thing is, this is because of the constraint you use. Constraints that test capabilities would work, as well as constraints that check coercability.

If you want to check for something that convert to an integral, rather than check if it ACTUALLY IS an integral, just use is(T : int) in your case.

Reply via email to