So I was mucking about with calling C++ from D yesterday and was
pleasantly surprised that this worked:
D:
struct Foo { int i; int j; }
extern(C++) void useFoo(ref const(Foo) foo);
C++:
struct Foo { int i; int j; };
void useFoo(const Foo& foo) { ... }
In fact, omitting const
Atila Neves:
D:
struct Foo { int i; int j; }
extern(C++) void useFoo(ref const(Foo) foo);
C++:
struct Foo { int i; int j; };
void useFoo(const Foo& foo) { ... }
This doesn't look very safe because D const is transitive, unlike
the C++ const. So in the C++ code you can mut
On Sunday, 1 June 2014 at 09:18:50 UTC, bearophile wrote:
Atila Neves:
D:
struct Foo { int i; int j; }
extern(C++) void useFoo(ref const(Foo) foo);
C++:
struct Foo { int i; int j; };
void useFoo(const Foo& foo) { ... }
This doesn't look very safe because D const is transitive
Try to report as a bug.