Eliminate "new" for class object creation?

Rainer Deyke rainerd at eldwood.com
Tue Oct 20 11:48:41 PDT 2009


Andrei Alexandrescu wrote:
> Lionello Lunesu wrote:
>> Also, somebody mentioned using 'new' to allocate structs on the heap;
>> I've never actually done that, but it sounds like using 'new' would be
>> the perfect way to do just that.
> 
> Yah, I guess I'll drop it.

Consistency with structs demands that for a class type 'X', 'new X'
allocates a *reference*, not an instance, on the heap.


-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list