== operator

From: sksjava (sksjava_at_hotmail.com)
Date: 01/19/04


Date: Mon, 19 Jan 2004 09:16:13 -0600

I have overloaded the "==" operator for a class. But now I want to only
compare the addresses of the objects, is there is a c++ mechanism to do this
without casting?

Ex:- (not compileable)
void whatever(Something* one, Something* two) // "==" is overloaded for
class Something
{
    // want to compare one's and two's addresses
     if ( one == two ) {} // don't want to invoke the "==" operator

    // only solution that I can think of
    void* onev = reinterpret_cast<void*>(one);
    void* twov = reinterpret_cast<void*>(two);
    if ( onev == twov ) {}
}