digitalmars.D.learn - How to cast to "void*", while bypassing alias this or opCast
- monarch_dodra (16/16) Aug 28 2014 I'm investigating a phobos regression. From "doesPointTo":
- anonymous (2/18) Aug 28 2014 *cast(void**)&source
- monarch_dodra (5/28) Aug 28 2014 Hum... now I feel retarded.
I'm investigating a phobos regression. From "doesPointTo": //---- static if (isPointer!S || is(S == class) || is(S == interface)) { const m = cast(void*) source; //---- Basically, given a "pointer like" structure, I want the void* equivalent. I really don't care about how "S" works, and am "observing" the "source" object as nothing more than a bag of member fields. The issue though is that it turns out that such code can and will call either opCast or alias this, which is *not* what we want at all in this piece of code. Is there any way to do a "hard" reinterpret cast in such a situation?
Aug 28 2014
On Thursday, 28 August 2014 at 10:45:52 UTC, monarch_dodra wrote:I'm investigating a phobos regression. From "doesPointTo": //---- static if (isPointer!S || is(S == class) || is(S == interface)) { const m = cast(void*) source; //---- Basically, given a "pointer like" structure, I want the void* equivalent. I really don't care about how "S" works, and am "observing" the "source" object as nothing more than a bag of member fields. The issue though is that it turns out that such code can and will call either opCast or alias this, which is *not* what we want at all in this piece of code. Is there any way to do a "hard" reinterpret cast in such a situation?*cast(void**)&source
Aug 28 2014
On Thursday, 28 August 2014 at 11:02:03 UTC, anonymous wrote:On Thursday, 28 August 2014 at 10:45:52 UTC, monarch_dodra wrote:Hum... now I feel retarded. In my mind I had "I want re-interpret, not address of, so no operator&". Thanks.I'm investigating a phobos regression. From "doesPointTo": //---- static if (isPointer!S || is(S == class) || is(S == interface)) { const m = cast(void*) source; //---- Basically, given a "pointer like" structure, I want the void* equivalent. I really don't care about how "S" works, and am "observing" the "source" object as nothing more than a bag of member fields. The issue though is that it turns out that such code can and will call either opCast or alias this, which is *not* what we want at all in this piece of code. Is there any way to do a "hard" reinterpret cast in such a situation?*cast(void**)&source
Aug 28 2014