On Tuesday, 11 September 2018 at 14:58:21 UTC, jmh530 wrote:
Is there any reason why this is not sufficient?

[1] https://run.dlang.io/is/lu6nQ0

Overloads:

https://run.dlang.io/is/m5HGOh

The static asserts being in the constraint affects the template candidacy viability. Being in the function body/runtime contract does not so you'll end up with

onlineapp.d(17): Error: onlineapp.foo called with argument types (float) matches both:
onlineapp.d(1):     onlineapp.foo!float.foo(float x)
and:
onlineapp.d(7):     onlineapp.foo!float.foo(float x)

despite the fact only one of them is viable, whereas bar is fine.

Reply via email to