[Webkit-unassigned] [Bug 234865] New: Add a helper function that returns the value of a std::optional<T> or constructs T if needed

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jan 4 16:24:56 PST 2022


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

            Bug ID: 234865
           Summary: Add a helper function that returns the value of a
                    std::optional<T> or constructs T if needed
           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: wenson_hsieh at apple.com

Motivated by the fact that you can't do the following:

```
std::optional<Foo> foo;

…

return foo.value_or({ }); // Grab the optional's value if it exists, or create and return a new Foo() if it's nullopt.
```

-- 
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/20220105/c618601a/attachment.htm>


More information about the webkit-unassigned mailing list