Template constraints should introduce identifiers inside their scopes
HuskyNator
HuskyNator at protonmail.ch
Wed Sep 21 12:36:35 UTC 2022
On Wednesday, 21 September 2022 at 12:18:19 UTC, Quirin Schroll
wrote:
> They are not semantically the same. The first can be
> instantiated with any type and conditionally makes an output
> (it is empty otherwise), the other says it cannot be
> instantiated unless the arguments have specific properties.
I am aware of the differences when the if statement fails, though
the intent remains the same.
> There are better ways than a string `mixin` to do this.
I am aware, this is merely an example.
> You want identifiers defined in a constraint to be visible in
> the body of the template. This is possible in simple cases like
> yours, but what if the `is` check is nested or negated?
I would presume it to work identically to its behavior inside a
static if statement.
More information about the Digitalmars-d
mailing list