On Thursday, 26 August 2021 at 18:07:48 UTC, Ali Çehreli wrote:
In some cases it's more useful to have a 'static if' inside a single function template instead of two separate function templates.

In most cases that's better. A template constraint is really a way to say "this template cannot accept this". When you use it to overload, the conditions get ugly fast since you need to make sure they're all mutually exclusive and the error messages get wrong since the compiler isn't sure if the thing can or can't be accepted.

What you generally want to do here is if the call - from the user's perspective - should work, make sure it gets through the constraint. Then do the details of branches inside.

Reply via email to