I just discovered an alternative use of the `in`-operator
snarwin at gmail.com
Thu Aug 6 22:24:43 UTC 2020
On Thursday, 6 August 2020 at 21:50:06 UTC, Per Nordlöw wrote:
> I just discovered that the is-operator can be used as in
> template ElementType(R)
> static if (is(typeof(R.init.front.init) T))
> alias ElementType = T;
> alias ElementType = void;
> . Very powerful. Is this documented?
Yes, in the following paragraph under "IsExpression" :
> Identifier is declared to be an alias of the resulting type if
> the condition is satisfied. The Identifier forms can only be
> used if the IsExpression appears in a StaticIfCondition.
More information about the Digitalmars-d-learn