Are D classes proper reference types?

kinke noone at nowhere.com
Sat Jun 26 20:24:21 UTC 2021


On Saturday, 26 June 2021 at 20:03:01 UTC, kinke wrote:
> With C++, you can today, an `extern(C++) class C` is equivalent 
> to and mangled as C++ `C*`. You can't pass it directly to some 
> `unique_ptr<C>` or `shared_ptr<T>` of course; an according D 
> wrapper reflecting the C++ implementation (library-dependent) 
> would be needed anyway for correct mangling. It'd be 
> implemented as a templated D struct, similar to how 
> `std::vector` works today for the MSVC runtime: 
> https://github.com/dlang/druntime/blob/master/src/core/stdcpp/vector.d

Oh, I've just seen that unique_ptr is already implemented in 
https://github.com/dlang/druntime/blob/master/src/core/stdcpp/memory.d, and according to the tests, working for the MSVC++ runtime, see https://github.com/dlang/druntime/pull/2723/files.


More information about the Digitalmars-d-learn mailing list