On Thursday, 25 July 2024 at 10:50:04 UTC, Dom DiSc wrote:
Can I replace this pattern with ```(x is this)``` or are there some special cases where this doen't work?

When a parameter is `ref` it is treated as a value type (i.e. it has value semantics), even though it is a reference; therefore an identity expression of `x is this` will check whether the bits in `x` and `this` are identical: https://dlang.org/spec/expression.html#identity_expressions Using the reference operator (`&`) on something that is `ref` returns its pointer form, which is what you want to compare.

TL;DR: No, `is` will compare the struct data not the pointers.

Reply via email to