Pointer to dlang spec for this alias construct?
evilrat
evilrat666 at gmail.com
Mon Jun 17 04:40:14 UTC 2024
On Monday, 17 June 2024 at 04:32:50 UTC, Andy Valencia wrote:
> In the alias:
>
> alias Unshared(T) = T;
> alias Unshared(T: shared U, U) = U;
>
> as used in:
>
> cast(Unshared!mytype)value
>
> turns a mytype with shared attribute into one without shared.
>
> I deduce the alias is using some sort of type matching and
> decomposition?
>
> I've read through the language spec, and didn't spot this
> mechanism. Can somebody tell me what section of the spec
> covers this very interesting mechanism?
>
> Thanks in advance,
> Andy
not sure if it works the same with template arguments but here is
the rules
https://dlang.org/spec/expression.html#IsExpression
More information about the Digitalmars-d-learn
mailing list