Re: get address of object if opCast is overridden

2013-12-25 Thread Lionello Lunesu
On 12/2/12, 21:25, js.mdnq wrote: I'm not just comparing them but using them as a unique ID for the objects in an algorithm to prevent computing over the same object more than once. o.toHash() ?? (Which incidentally just casts the reference to a hash_t, exactly what you want to do.)

Re: get address of object if opCast is overridden

2012-12-02 Thread Artur Skawina
On 12/02/12 14:25, js.mdnq wrote: > On Saturday, 1 December 2012 at 23:57:27 UTC, Artur Skawina wrote: >> On 12/01/12 20:26, Jonathan M Davis wrote: >>> On Saturday, December 01, 2012 18:43:22 Timon Gehr wrote: On 12/01/2012 06:23 PM, Jonathan M Davis wrote: > On Saturday, December 01, 201

Re: get address of object if opCast is overridden

2012-12-02 Thread js.mdnq
On Saturday, 1 December 2012 at 23:57:27 UTC, Artur Skawina wrote: On 12/01/12 20:26, Jonathan M Davis wrote: On Saturday, December 01, 2012 18:43:22 Timon Gehr wrote: On 12/01/2012 06:23 PM, Jonathan M Davis wrote: On Saturday, December 01, 2012 12:05:49 Artur Skawina wrote: So, unless there'

Re: get address of object if opCast is overridden

2012-12-01 Thread Jonathan M Davis
On Sunday, December 02, 2012 00:57:14 Artur Skawina wrote: > Seriously though, if one only needs to compare the addresses of class > objects, "is" may be a better solution. Is that all that was being done? I obviously missed that one way or another. Yeah, that's what the is operator is for. - Jo

Re: get address of object if opCast is overridden

2012-12-01 Thread Artur Skawina
On 12/01/12 20:26, Jonathan M Davis wrote: > On Saturday, December 01, 2012 18:43:22 Timon Gehr wrote: >> On 12/01/2012 06:23 PM, Jonathan M Davis wrote: >>> On Saturday, December 01, 2012 12:05:49 Artur Skawina wrote: > So, unless there's a way to do it without a cast, you're stuck. And I

Re: get address of object if opCast is overridden

2012-12-01 Thread Jonathan M Davis
On Saturday, December 01, 2012 18:43:22 Timon Gehr wrote: > On 12/01/2012 06:23 PM, Jonathan M Davis wrote: > > On Saturday, December 01, 2012 12:05:49 Artur Skawina wrote: > >>> 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

Re: get address of object if opCast is overridden

2012-12-01 Thread Timon Gehr
On 12/01/2012 06:23 PM, Jonathan M Davis wrote: On Saturday, December 01, 2012 12:05:49 Artur Skawina wrote: 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. *cast(void**)&O // assuming O is a class Are you su

Re: get address of object if opCast is overridden

2012-12-01 Thread Jonathan M Davis
On Saturday, December 01, 2012 12:05:49 Artur Skawina wrote: > > 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. > >*cast(void**)&O // assuming O is a class Are you sure? I'd be _very_ wary of that, because re

Re: get address of object if opCast is overridden

2012-12-01 Thread js.mdnq
On Saturday, 1 December 2012 at 11:06:02 UTC, Artur Skawina wrote: On 12/01/12 03:48, Jonathan M Davis wrote: 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 co

Re: get address of object if opCast is overridden

2012-12-01 Thread Artur Skawina
On 12/01/12 03:48, Jonathan M Davis wrote: > 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) // addre

Re: get address of object if opCast is overridden

2012-11-30 Thread Jonathan M Davis
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 t

get address of object if opCast is overridden

2012-11-30 Thread js.mdnq
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