I'm exploring [0] C++ interop after watching Walter's presentation [1].

I hit a block with classes as template parameters. This means vector<int> works, but vector<Foo> does not. D seems to map vector!Foo to vector<Foo*>. Likewise shared_ptr<Foo> is a problem. Any way to fix that on the D side? The ugly workaround is to adapt the C++ code.

I understand that this mapping makes sense for function calls because bar(Foo f) in D maps to bar(Foo *f) in C++. And C++ bar(Foo f) has no equivalent in D because classes are reference types.

On a related note, C++ interop requires to redeclare or even reimplement C++ code. Has anybody started a libcpp-in-d project? I'm looking for basics like vector and string.

[0] https://github.com/qznc/d-cpptest
[1] https://youtu.be/IkwaV6k6BmM

Reply via email to