Bug 281835
Summary: | UniqueRef<T>::operator-> shouldn't return a const T* | ||
---|---|---|---|
Product: | WebKit | Reporter: | Jean-Yves Avenard [:jya] <jean-yves.avenard> |
Component: | Web Template Framework | Assignee: | Jean-Yves Avenard [:jya] <jean-yves.avenard> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | achristensen, cdumez, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Jean-Yves Avenard [:jya]
UniqueRef<T> is supposed to operate like a std::unique_ptr<T> which is never null.
But both its `operator->()` and `operator*()` return a const object, unlike std::unique_ptr<T> equivalent that will return a non const object (just like a T* type would)
This prevents `const UniqueRef<T>` from being commonly use, which not only indicates that it will never be null, but that it also will never be modified during the lifetime of its `this` parent.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/138270047>
Chris Dumez
Seems like a good change. This difference between unique_ptr and UniqueRef makes switching from one to the other more painful than it needs to be. This would also align UniqueRef with RefPtr / Ref.
Jean-Yves Avenard [:jya]
Pull request: https://github.com/WebKit/WebKit/pull/35614
EWS
Committed 285628@main (c684d1a74a2b): <https://commits.webkit.org/285628@main>
Reviewed commits have been landed. Closing PR #35614 and removing active labels.