On Mon, Apr 18, 2022 at 08:22:26AM +0000, cc via Digitalmars-d-learn wrote: > On Monday, 18 April 2022 at 03:21:30 UTC, H. S. Teoh wrote: > > Structs in D ought to be treated like "glorified ints", as Andrei > > puts it. If you need complex ctors and complex methods, that's a > > sign you should be using a class instead. > > Unless you're having a nice quiet get-together with friends, and you > don't want to invite the GC, the biggest loudest party animal on the > block. Phobos's RefCounted seems to stretch the definition of > "glorified ints"..
"Glorified int" includes pass-by-value types like pointers. Pointers / references wrapped in a struct is one of the more powerful D constructs that lets you do some pretty neat things. (Just don't expect it to behave like C++, lol. :-P) T -- Debian GNU/Linux: Cray on your desktop.