On Tuesday, 23 March 2021 at 22:22:12 UTC, Q. Schroll wrote:
For a class object obj, one can use assert(obj) to get its invariants checked. How to do this for structs?

https://dlang.org/spec/expression.html#assert_expressions

If the first AssignExpression is a pointer to a struct instance for which a Struct Invariant exists, the Struct Invariant must hold.

So, you would write `assert(&obj)` for a struct instance.

Reply via email to