Suicidal objects
Sean Kelly
sean at f4.ca
Mon Dec 10 11:49:48 PST 2007
Jarrett Billingsley wrote:
> "Sean Kelly" <sean at f4.ca> wrote in message
> news:fjjpgq$2t9c$3 at digitalmars.com...
>
> http://www.digitalmars.com/d/archives/digitalmars/D/Inheriting_constructors_54088.html
>> In short, there's no easy way to perform placement new on an existing
>> class, and I view this as a deficiency. My proposal would provide one
>> easy way to do so, but I still feel that making it automatic would be
>> preferable.
>
> With __traits, we can now get the size of a class instance and the overloads
> of the constructor (I think?). I think that's about all you'd need, no?
Yeah, but it would still be a bit awkward to use __traits to obtain the
size, allocate, then use __traits to call the proper ctor by name on the
new block or whatever. Placement new is so generally useful that it
should really just be supported by the language.
Sean
More information about the Digitalmars-d-learn
mailing list