Non-ugly ways to implement a 'static' class or namespace?
thebluepandabear
therealbluepandabear at protonmail.com
Mon Jan 30 21:50:03 UTC 2023
> Use a struct and put `static:` after the opening brace. That's
> what GC is in core.memory.
Using a `struct` for a purely static type would still allow the
user to create instances of that `struct`. To bypass that, you'd
have to disable the default constructor -- that then becomes
ugly, hackish code.
More information about the Digitalmars-d-learn
mailing list