The best way to store a structure by reference

rsw0x via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Nov 27 02:47:06 PST 2015


On Friday, 27 November 2015 at 08:38:29 UTC, drug wrote:
> I need to store a struct like a reference type. Now I use 
> pointer for this, is it the best D way? This pointer is private 
> and access to it is safe, but it's just unusual for me to see 
> pointers in D code.

if you own the resource, consider std.typecons.unique or 
std.typecons.refcounted
otherwise consider std.typecons.nullableref


More information about the Digitalmars-d-learn mailing list