
25 Sep
2006
25 Sep
'06
9:11 a.m.
Hi, Probably a newbie question, but what's the best way to test if a shared_ptr and weak_ptr point to the same thing? My current code uses: if (shared_ptr != weak_ptr.lock()) but it feels wrong to create a temporary with some small locking overhead - even though I realise it will make absolutely no difference to performance. So, my question is really why is there no operator==(shared_ptr, weak_ptr)? Google provided little explanation other than this: http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2004/n1590.html which approaches the subject but isn't exactly authoritative. thanks, Matt