Static Public Member Functions | |
template<typename T > | |
static bool | equal (const T *p1, const T *p2) |
template<typename T , typename U > | |
static bool | equal (const T *, const U *) |
&object1 != &object2
does only work if the types of the two objects are equal, but the compiler will barf if they are not. However, in the latter case, since the types of the two objects are different, we can be sure that the two objects cannot be the same.
This class implements a comparison function that always returns false
if the types of its two arguments are different, and returns p1 == p2
otherwise.
bool PointerComparison::equal | ( | const T * | p1, | |
const T * | p2 | |||
) | [inline, static] |
Comparison function for pointers of the same type. Returns true
if the two pointers are equal.
bool PointerComparison::equal | ( | const T * | , | |
const U * | ||||
) | [inline, static] |
Comparison function for pointers of different types. The C++ language does not allow comparing these pointers using operator==
. However, since the two pointers have different types, we know that they can't be the same, so we always return false
.