[webkit-changes] [WebKit/WebKit] f3d201: Introduce WTF::flatMap

aestes noreply at github.com
Tue Sep 19 19:07:22 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f3d2011c12f9cfae2515edca040e24ef0fcd37a3
      https://github.com/WebKit/WebKit/commit/f3d2011c12f9cfae2515edca040e24ef0fcd37a3
  Author: Andy Estes <aestes at apple.com>
  Date:   2023-09-19 (Tue, 19 Sep 2023)

  Changed paths:
    M Source/WTF/wtf/Vector.h
    M Tools/TestWebKitAPI/Tests/WTF/Vector.cpp

  Log Message:
  -----------
  Introduce WTF::flatMap
https://bugs.webkit.org/show_bug.cgi?id=261780
rdar://problem/115751217

Reviewed by Richard Robinson.

Introduced WTF::flatMap. Similar to map and compactMap, flatMap takes a collection that may contain
nested collections and allows the caller to specify a map function that produces a flat Vector.

Added test cases to TestWTF. A follow-on change will adopt this in CDMInstanceFairPlayStreamingAVFObjC.

* Source/WTF/wtf/Vector.h:
(WTF::FlatMapper::flatMap):
(WTF::flatMap):
* Tools/TestWebKitAPI/Tests/WTF/Vector.cpp:
(TestWebKitAPI::mapVector):
(TestWebKitAPI::TEST):
(TestWebKitAPI::mapInnerStruct):

Canonical link: https://commits.webkit.org/268171@main




More information about the webkit-changes mailing list