C++ Interop
Mengu
mengukagan at gmail.com
Sat Jan 6 12:11:55 UTC 2018
On Friday, 5 January 2018 at 13:02:12 UTC, qznc wrote:
> 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
is C++ support in LDC better than what we have with DMD?
i did checkout your code btw and could not enjoy it more. :)
More information about the Digitalmars-d-learn
mailing list