On Monday, 15 April 2019 at 15:07:10 UTC, Robert M. Münch wrote:
On 2019-04-15 08:19:57 +, Ali ‡ehreli
Bingo, I didn't know that I can do an 'alias this' using a
function and not only a type... pretty cool. So, with several
of these I can setup implicit conversions to different types.
On 2019-04-15 08:19:57 +, Ali ehreli said:
'alias this' can do that:
Hi, I had the suspicion already...
struct IM;
struct C {
IM *impl;
};
int cInit(C* self) {
return 0;
}
class I {
C handler;
this(){cInit();}
C* ptr() { // <== ADDED
return
Le 15/04/2019 à 08:30, Robert M. Münch via Digitalmars-d-learn a écrit :
The C side requires that *impl is the 1st member in the struct/class whereever
it is stored. Hence, the wrapping in a struct and not directly putting it into a
D class.
All right! Did not think at this usage case,
On 04/14/2019 11:03 AM, Robert M. Münch wrote:
struct IM;
struct C {
IM *impl;
};
int cInit(C* self);
class I {
C handler;
this(){cInit();}
}
Is there a simple way that I can use handler without the address-of
operator and automatically get *impl?
Something like:
class I {
On 2019-04-14 20:01:27 +, diniz said:
Le 14/04/2019 à 20:03, Robert M. Münch via Digitalmars-d-learn a écrit :
struct IM;
struct C {
IM *impl;
};
int cInit(C* self);
class I {
C handler;
this(){cInit();}
}
Is there a simple way that I can use handler without the address-of
Le 14/04/2019 à 20:03, Robert M. Münch via Digitalmars-d-learn a écrit :
struct IM;
struct C {
IM *impl;
};
int cInit(C* self);
class I {
C handler;
this(){cInit();}
}
Is there a simple way that I can use handler without the address-of operator and
automatically get *impl?
struct IM;
struct C {
IM *impl;
};
int cInit(C* self);
class I {
C handler;
this(){cInit();}
}
Is there a simple way that I can use handler without the address-of
operator and automatically get *impl?
Something like:
class I {
C handler;