I'm using weak pointers as keys in a map. However, when I tried to compile, I got ugly messages which I interpreted to mean that I lacked a comparison operator for the std::weak_ptr, which, obviously, is required in a std::map, as it orders its elements according to key value.
Now, however, the weak_ptr class is a smart-pointer type class, and, as such, works with pointers to some managed data.
Is there a good reason why this class would NOT provide a base implementation of the operator< method ? I mean, comparing the pointer values seem pretty obvious to me, and, if it is required that it works in a different way, then one should be able to extend, or redefine, the method, to get the expected behavior instead, wouldn't it ?
Your insight would be much appreciated, here. Thanks in anticipation.