On Monday, 3 June 2019 at 08:47:41 UTC, Mike Parker wrote:


If yes, when should one use 'new'?

Whenever you need to allocate something from the GC heap. In my experience, it's rare to need it with value types in D. I tend to use it primarily with classes and arrays.

Ali's book has an example using a struct-based linked list in the chapter on pointers:

https://forum.dlang.org/thread/rkmcvxftykhsvxofp...@forum.dlang.org

Reply via email to