
"Ben Artin" <macdev@artins.org> wrote in message news:macdev-D3DEAB.17184015112005@sea.gmane.org...
In article <f0e60a710511151400y3f557860ubf234ae67c83225@mail.gmail.com>, Dan Day <coolmandan@gmail.com> wrote:
Why was operator== never added to weak_ptr? Couldn't the operator easily be implemented in terms of operator<?
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1590.html>
Now that unordered_set and company have been added to tr1, we might want to consider how to keep weak_ptr's in them. A major advantage of the ordered associative containers over their hash-based counterparts is the ability to do order-based searches, for example given a set<string> to find all elements that come before the string "dog". This advantage doesn't really apply to weak_ptr's (or shared_ptr's for that matter) so given a choice between the a set<weak_ptr<string> > and an unordered_set<weak_ptr<string> > I think many users would chose the later if it were available. To make it available we need two things: a hash function and an operator== on weak_ptrs. Joe Gottman