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