Re: [boost] Please don't define a fake "operator <" justfor orderedcontainers

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Peter Dimov Sent: Monday, July 10, 2006 2:58 PM To: boost@lists.boost.org
Looking at <http://www.boost.org/libs/smart_ptr/shared_ptr.htm>, i.e. the Boost version, it seems that the authors fell into the "fake operator <" trap. If any of those authors are reading this, can you tell us why you added the fake operator instead of a custom-named comparison class?
shared_ptr defines operator< for map<shared_ptr<>, V> to work. What do you mean by "fake"?
I know what I did, but this still doesn't tell me what "fake" means in this context. What objective properties make an operator< "fake"?
Isn't shared_ptr<T> is supposed to be like T* which has ordering? In this case, it's a non-issue no?

On 7/10/06, Sohail Somani <s.somani@fincad.com> wrote:
Isn't shared_ptr<T> is supposed to be like T* which has ordering? In this case, it's a non-issue no?
My understanding is that < is only well-defined for pointers into the same array and that < between to arbitrary pointers is otherwise some sort of UB. It's less<T*> that provides a full ordering for arbitrary T*s. (By specialising std::less.) ~ Scott McMurray
participants (2)
-
me22
-
Sohail Somani