How to get the pointer of "this" ?
Mike Parker
aldacron at gmail.com
Mon May 25 16:39:30 UTC 2020
On Monday, 25 May 2020 at 08:39:23 UTC, John Burton wrote:
> I believe that in D *this* is a reference to the
> object and not a pointer like in C++.
> So I think that writing &this might be what you need?
No. A class reference is a pointer under the hood. Getting its
address will result in a pointer to the reference variable
itself, not to the class instance. When passing a reference to a
C API, casting it directly to the C type is correct.
More information about the Digitalmars-d-learn
mailing list