Using C++ with D / returning a templated type from C++
Robert M. Münch
robert.muench at saphirion.com
Wed Jul 4 17:32:49 UTC 2018
I have the following C++ code and want to give the D/C++ integration a new try:
template<typename T> class Array {...}
class myClass {...}
typedef Array<myClass> myClassArray;
myClassArray classA::getArray() noexcept {...}
How does the D binding for this look like? I tried something like this:
extern (C++) {
class Array(T){};
class Array(myClass) {};
class classA {
final Array(myClass) getArray(); <== COMPILER ERRORS
};
}
But this doesn't work at all and give a bunch of comiler errors:
Error: function declaration without return type. (Note that
constructors are always named this)
Error: no identifier for declarator extern (C++) Array(myClass)
Error: semicolon expected following function declaration
Error: function declaration without return type. (Note that
constructors are always named this)
Error: no identifier for declarator extern (C++) getArray()
Any ideas?
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
More information about the Digitalmars-d-learn
mailing list