On Tuesday, 3 August 2021 at 16:35:04 UTC, Ali Çehreli wrote:

a) Classes are already reference types. So, replace struct with class:

class Foo {
  // ...
}

It's already a member of an object, so I don't like it to make it a sub object.


b) Make your struct a reference type by

i) Renaming it

Was thinking of something similar but end with the raw pointer solution.

I just made an alias on it and had just to remove the ref-keywords from the methods.

The only thing that bothers me is that I cannot use it via foreach() without an opApply() layer between. Why foreach() does not accept a pointer?



Reply via email to