Constructing a class in-place

Johan Engelen j at j.nl
Sat Jul 28 08:58:11 UTC 2018


On Thursday, 26 July 2018 at 12:53:44 UTC, rikki cattermole wrote:
> On 27/07/2018 12:45 AM, Johan Engelen wrote:
>> 
>> In D, we don't have placement new, great! And now, I learn 
>> that the _standard library_ _does_ have something that looks 
>> like placement new, but without extra guarantees of the spec 
>> that C++ has.
>> For some more info:
>> https://stackoverflow.com/a/49569305
>> https://stackoverflow.com/a/48164192
>> 
>> - Johan
>
> Both of those links is related to structs not classes (and 
> original post is about classes).
> Given the content (I could be wrong) but I don't think its 
> related to our situation in D.

Uhm, this has everything to do with our situation in D and with 
classes in D too. The links are of course about classes with and 
without vtable.

> Classes in D are very "heavy" with their explicit vtable. Given 
> that classes in C++ can act as a value and a reference type, 
> you have to be pretty careful when comparing them.

I'd appreciate it if you reread and think more about it. D's 
classes and C++'s structs/classes are the same in what is 
discussed here, and vtable is just one of the issues.

-Johan



More information about the Digitalmars-d mailing list