mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-22 01:08:56 +00:00
LibGC: Add Ptr::as_nonnull()
Convert from a GC::Ptr to a GC::Ref directly, instead of having to write `GC::Ref { *thing }`.
This commit is contained in:
parent
277117eed5
commit
e174215845
Notes:
github-actions[bot]
2025-08-29 09:58:48 +00:00
Author: https://github.com/AtkinsSJ
Commit: e174215845
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5955
Reviewed-by: https://github.com/trflynn89
1 changed files with 6 additions and 0 deletions
|
@ -183,6 +183,12 @@ public:
|
|||
|
||||
operator T*() const { return m_ptr; }
|
||||
|
||||
Ref<T> as_nonnull()
|
||||
{
|
||||
VERIFY(m_ptr);
|
||||
return *m_ptr;
|
||||
}
|
||||
|
||||
private:
|
||||
T* m_ptr { nullptr };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue