[Webkit-unassigned] [Bug 177389] WeakPtrFactory should allow downcasting

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Sep 22 15:15:47 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=177389

--- Comment #2 from Jiewen Tan <jiewen_tan at apple.com> ---
Geoff's proposal:

The Problem we have currently:
WeakPtr<Element> ptr = parent.createWeakPtr(); // fails: returns WeakPtr<Node>
WeakPtr<Element> ptr = parent.createWeakPtr<Element>(); // succeeds: returns WeakPtr<Element>

Solution is something like this:
   template<typename U> WeakPtr<U> createWeakPtr() const { return WeakPtr<U>(static_reference_cast<U>(m_ref); }

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170922/afc36ea1/attachment.html>


More information about the webkit-unassigned mailing list