On Tuesday, 21 October 2014 at 19:36:50 UTC, Ola Fosheim Grøstad wrote:
On Tuesday, 21 October 2014 at 19:33:14 UTC, Freddy wrote:
On Tuesday, 21 October 2014 at 12:22:54 UTC, edn wrote:
Could someone provide me with examples showing the usefulness of pointers in the D language? They don't seem to be used as much as in C and C++.

https://en.wikipedia.org/wiki/XOR_linked_list

Uhm. That won't work with the GC…

It won't work with the GC, but one could still safely implement an XOR linked list in D, if they used malloc/free manually, so that the collector was never aware of the existence of those allocations.

As to the OP, at the moment, D doesn't support structs as a reference type so if you want a container that stores references to structs rather than copies, the container will probably use pointers.

Reply via email to