Structs as reference types?
sighoya
sighoya at gmail.com
Sun May 30 12:44:58 UTC 2021
On Sunday, 30 May 2021 at 12:17:07 UTC, Alexandru Ermicioi wrote:
> Anyway, it would be nice to know clearly, what usecases you
> want to cover by that proposal.
Simple case: Having a container of ref/ptr structs.
I know ptr structs can already been used with simple pointer
types but writing Struct* for every function is tedious, you can
alias but doing that with constructor in the mentioned example
above is also tedious given the sheer amount of types.
Yes, for ptr types it is solely a stylistic feature to write
things shorter.
> The only one I've noticed, is reference semantics, which can be
> covered by extern c++ final class (not as short as your
> example, but it works).
I don't like using extern C++ for that and as it was said, the
alignment doesn't seem to fit to structs.
Having value semantics for final classes would also be fine, but
it seems that D will stick more on structs as evidenced by the
standard library.
More information about the Digitalmars-d
mailing list