Summary: | No easy way to use a RetainPtr as a key in a HashMap using object (rather than pointer) equality | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | mitz | ||||
Component: | Web Template Framework | Assignee: | mitz | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | andersca, benjamin, jberlin | ||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Attachments: |
|
Description
mitz
2013-02-14 14:28:04 PST
Created attachment 188429 [details]
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=188429&action=review > Source/WTF/wtf/RetainPtr.h:310 > + static void constructDeletedValue(RetainPtr<P>& slot) { new (&slot) RetainPtr<P>(AdoptCF, reinterpret_cast<P *>(-1)); } > + static bool isDeletedValue(const RetainPtr<P>& value) { return value.get() == reinterpret_cast<P *>(-1); } I would prefer something using an explicit constructor, like we do in RefPtr. (In reply to comment #2) > View in context: https://bugs.webkit.org/attachment.cgi?id=188429&action=review > > > Source/WTF/wtf/RetainPtr.h:310 > > + static void constructDeletedValue(RetainPtr<P>& slot) { new (&slot) RetainPtr<P>(AdoptCF, reinterpret_cast<P *>(-1)); } > > + static bool isDeletedValue(const RetainPtr<P>& value) { return value.get() == reinterpret_cast<P *>(-1); } > > I would prefer something using an explicit constructor, like we do in RefPtr. Done! Fixed in <http://trac.webkit.org/r142924>. |