On Tuesday, 10 February 2026 at 15:39:45 UTC, H. S. Teoh wrote:
If you want complex default construction, polymorphic behaviour, or by-reference semantics, consider using classes instead.


T

Or alternatively, design your struct to work as a reference to your actual data, not as the data itself. After all, this is pretty much how slices work. They essentially behave like a struct with a pointer and length value, with member functions and operator overloads to handle the actual data the slice is referring to.

Reply via email to