C++ / Wrong function signature generated for reference parameter

Robert M. Münch robert.muench at saphirion.com
Thu May 3 06:00:53 UTC 2018


On 2018-05-03 02:23:27 +0000, Rubn said:

> If "Image" is a class then all classes are based as pointers to their 
> respective object.

Hi, ok. Didn't remember that this is always the case.

> So passing a ref to a class is kind of redundant.

Yes, that's why I was confused.

> You want to use a struct which isn't passed by pointer, but by value. 
> Which will then give you the signature you want.

On the C++ side, Image is a class. Sometimes I need to use a pointer to 
it and sometimes a reference when using C++ side functions.

So, how do I make it possible to have both variants available in D? If 
I use class I always get a pointer, if I use strucut I always get a 
reference.

Do I define two interfaces in D one as class and one as struct with 
different names and than cast things on the D side?

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



More information about the Digitalmars-d-learn mailing list