Is there ever a reason to declare this as
if(*this == rhs)
as opposed to what I normally see
if(this == &rhs)
?
Seems like the former version is going to be more expensive rather than
simply comparing addresses as in the latter (plus the former requires
the class to define operator== as well, no?). Wondering if that added
effort is ever justified.
if(*this == rhs)
as opposed to what I normally see
if(this == &rhs)
?
Seems like the former version is going to be more expensive rather than
simply comparing addresses as in the latter (plus the former requires
the class to define operator== as well, no?). Wondering if that added
effort is ever justified.
Comment