[Webkit-unassigned] [Bug 177732] New: 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
Sun Oct 1 20:11:10 PDT 2017
https://bugs.webkit.org/show_bug.cgi?id=177732
Bug ID: 177732
Summary: There should be a version of copyToVector that returns
a Vector, rather than using an out parameter
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: Web Template Framework
Assignee: webkit-unassigned at lists.webkit.org
Reporter: sam at webkit.org
As Darin noted in 177728, it is quite lame that copyToVector (and its ilk) uses an out parameter and doesn't just return a Vector. I think we can leverage the WTF::map to make this rather simple. Perhaps add to Vector.h something like:
template<typename T>
static T mapIdentity(const T& value)
{
return WTFMove(value);
}
template<typename C>
inline auto copyToVector(const C& collection) -> decltype(map(collection, mapIdentity))
{
return map(collection, mapIdentity);
}
It would also be nice to make things like copyToVector(hashmap.keys()) work, rather than having separate copyKeysToVector/copyValuesToVector functions. I think that could be done by adding a new SizedIteratorRange class that keys() and values() return (rather than the IteratorRange they currently return) so they can work with WTF::map.
--
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/e9a0ff9b/attachment-0001.html>
More information about the webkit-unassigned
mailing list