Boost logo

Boost :

From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2001-05-24 13:06:31


> I disagree. Smart pointers have a coherent notion of identity and can be
> strict-weak ordered. It sounds like you didn't carefully consider what it
> means to compare them (although it's not complicated - it generally means
> the same as pointer comparison), and ended up with the wrong result. I
> don't
> think the rest of us should be penalized for that.
And I disagree here as well.
I have a table of shared_ptrs<string>, and I used these as keys in a map.
Not too unreasonable. However not all programmers on my team will use this
table of strings, so I have to construct a shared_ptr<string> from other
char*. (The alternative is to find the char * in the table and then use that
shared_ptr for the lookup.) They don't match of course and I'm dead in the
water. However it compiles and runs, it just doesn't do what I expect. (Of
course I am guilty of not fully reading the documentation, and the source.)

So now I'm left with overloading less<shared_ptr<string> >, or creating a
proxy that has an operator<(). I chose the proxy to avoid other problems and
it got progressively messier. So in the end, I tossed using shared_ptrs as

And while I don't consider myself a newbie, I still made this mistake. What
hope does a new user of shared_ptrs have?



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