Collections question

Jakob Ovrum via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 27 23:15:37 PST 2015


On Saturday, 28 November 2015 at 06:59:35 UTC, bitwise wrote:
> Classes/real-ref-types dont act as you're describing

They do, actually.

class Collection(E) { ... }

Collection!E a; // null reference
auto b = new Collection!E(); // reference to empty collection

The only outlier is the associative array, which lazily 
initializes when operations are performed on null references.



More information about the Digitalmars-d mailing list