Template constraints should introduce identifiers inside their scopes
HuskyNator
HuskyNator at protonmail.ch
Wed Sep 21 12:41:06 UTC 2022
On Wednesday, 21 September 2022 at 12:32:38 UTC, Paul Backus
wrote:
> `static if` already handles these cases. I don't know exactly
> what the rules are (needs better documentation), but presumably
> they would work the same way for constraints.
Apologies, I only read your comment now.
> As I'm sure you're aware, there are cases where the desired
> constraint cannot be expressed using template specializations.
> For example:
>
> ```d
> auto fun(R)(R r)
> if (isInputRange!R && is(ElementType!R == T[], T))
> ```
Thank you, this is indeed what I was aiming for :)
More information about the Digitalmars-d
mailing list