Manually check struct invariants

Imperatorn johan_forsberg_86 at hotmail.com
Tue Mar 23 23:14:22 UTC 2021


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?

It's called after the constructor has run and before the 
destructor is called.

It's called before entering a member function and after exiting a 
member function.

So technically you could just do like obj.writeln or whatever u 
have 😁


More information about the Digitalmars-d-learn mailing list