4 ms·
Actually, that's not always correct in C++ (it is in C). It is possible that either type has the operator& overloaded, so instead the proper way to do it is:
by sherincall 9y ago
Actually, that's not always correct in C++ (it is in C). It is possible that either type has the operator& overloaded, so instead the proper way to do it is:
(std::addressof(a) == std::addressof(b))
http://en.cppreference.com/w/cpp/memory/addressof http://en.cppreference.com/w/cpp/memory/addressof
- _pmf_ 9y agoThanks (I didn't even know this operator was overloadable)!