Specifying C++ symbols in C++ namespaces

monnoroch monnoroch at gmail.com
Wed Apr 2 18:55:50 PDT 2014


Also, D already has scope classes, so why not create full 
featured class bindings?

Suppose, i have this:

class A {
private:
     int x;

public:
     A(int x_) : x(x_) {}
     A(const A& v) : x(v.x) {}
     ~A() {}
};

Why not interfase those as:

extern (C++) {
     struct A {
         int x;
         this(int x_); // call c++ A::A(int)
         this(this);   // call c++ A::A(const A&)
         ~this();      // call c++ A::~A()
     }
}


I mean, methods in c++ are just like functions in namespaces with 
first T* argument, so this is also just mangling problem; and all 
those constructors and destructors are not something special 
either.

What stops to do that?
If value semantics isn't appropriate, user, who writes D 
interface can just do it in scope class.
Maby discussing that would also do some good.


More information about the Digitalmars-d mailing list