On Friday, 19 May 2017 at 21:23:11 UTC, Dominikus Dittes Scherkl
wrote:
On Friday, 19 May 2017 at 21:04:24 UTC, Stefan Koch wrote:
If a template does trigger a static assert,
that static assert is ignored if there is another template in
the overload set that could match.
Wow. Didn't know that.
Is this really part of the D grammar?
Sometimes D is soo cool.
Still - too cool for me to see this. I don't like templates
looking similar and even taking the same types but the compiler
does something too intelligent to avoid an ambiguity.
And it's not visible from the API or documentation - you need
to look into the source to disambiguate - I'm not convinced and
still consider this bad style.
If they take exactly the same parameters the compiler will flag
an error.
But if the parameters are merely compatible you can use static
assert, to shoot things out of the overload set.