[Webkit-unassigned] [Bug 177732] There should be a version of copyToVector that returns a Vector, rather than using an out parameter

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Oct 2 11:01:28 PDT 2017


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

--- Comment #6 from Chris Dumez <cdumez at apple.com> ---
(In reply to Darin Adler from comment #5)
> (In reply to Chris Dumez from comment #4)
> > The templated out parameter is convenient for when you want to copy to a
> > vector that contains items of another type, which happens fairly commonly.
> > 
> > E.g. you have a HashSet<Node*> and want to copy to a Vector<RefPtr<Node>>.
> > 
> > Not sure how we can make this work:
> > 
> > HashSet<Node*> nodes;
> > Vector<RefPtr<Node>> nodesCopy = copyToVector(nodes);
> 
> Using your suggested function name, copyToVector, the syntax I would suggest
> would be:
> 
>     auto nodesCopy = copyToVector<RefPtr<Node>>(nodes);
> 
> Should not be too hard to implement.

Sure, if you add another template parameter then we can make it work. It is more verbose though.

-- 
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/20171002/f131a702/attachment.html>


More information about the webkit-unassigned mailing list