Boost logo

Boost :

From: Joe Gottman (jgottman_at_[hidden])
Date: 2005-11-15 18:32:48

"Ben Artin" <macdev_at_[hidden]> wrote in message
> In article <f0e60a710511151400y3f557860ubf234ae67c83225_at_[hidden]>,
> Dan Day <coolmandan_at_[hidden]> wrote:
>> Why was operator== never added to weak_ptr? Couldn't the operator easily
>> be
>> implemented in terms of operator<?
> <>

   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

Boost list run by bdawes at, gregod at, cpdaniel at, john at