Does anyone know why the two pointers this
and &op2
are first converted to void*
before comparing them? (this example is taken from C++ templates: The complete Guide by David Vandevoorde and Nicolai M. Josuttis)
template<typename T>
template<typename T2>
Stack<T>& operator=(const Stack<T2> & op2){
if ((void*)this==(void*)&op2){
return *this;
}
// ....
}