DIP77 - Fix unsafe RC pass by 'ref'

w0rp via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 9 11:53:21 PDT 2015


On Thursday, 9 April 2015 at 18:44:10 UTC, Walter Bright wrote:
> The only real purpose to a postblit is to support ref counting. 
> Why would a by-value container use a postblit and not ref count?

A struct could have a postblit defined if you are implementing 
something like std::vector, where you you copy the memory when 
the struct is copied. I'm not sure why you would want to do such 
a thing in D, though. If allocating memory is your concern, you 
probably don't want any allocation, including malloc.


More information about the Digitalmars-d mailing list