On Saturday, December 01, 2012 03:05:00 js.mdnq wrote: > Let O be an object with opCast overridden, then > > > writeln(O); //prints string > writeln(cast(void *)O)) // error, works fine if I comment out the > opCast override > writeln(&O) // address of pointer to O, not what I want. > > I want to compare a few objects based on their location. (I know > this is bad because of the GC, but I will probably pin them if I > go this route) > > It seems I have a difficult time getting the original behavior > when something is syntactically overridden in D. I understand the > point of cast(void *) not working when opCast is overridden but I > then do not know how to still get the address. > > Any Ideas?
For the moment, you're probably screwed. Certainly, if you overload opCast, then none of the normal casts work any more, which is a definite bug: http://d.puremagic.com/issues/show_bug.cgi?id=5747 So, unless there's a way to do it without a cast, you're stuck. And I have no idea how you could possibly do it without a cast. - Jonathan M Davis