D
easily interfaces with C
.
D
just as easily interfaces with C++
, but (and it's a big but) the C++
needs to be extremely trivial. The code cannot use:
- namespaces
- templates
- multiple inheritance
- mix virtual with non-virtual methods
- more?
I completely understand the inheritance restriction. The rest however, feel like artificial limitations. Now I don't want to be able to use std::vector<T>
directly, but I would really like to be able to link with std::vector<int>
as an externed template.
The C++ interfacing page has this particularly depressing comment.
D templates have little in common with C++ templates, and it is very unlikely that any sort of reasonable method could be found to express C++ templates in a link-compatible way with D.
This means that the C++ STL, and C++ Boost, likely will never be accessible from D.
Admittedly I'll probably never need std::vector
while coding in D
, but I'd love to use QT or boost.
So what's the deal. Why is it so hard to express non-trivial C++
classes in D? Would it not be worth it to add some special annotations or something to express at least namespaces?