mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
AK: Let's call decrementing reference counts "unref" instead of "deref"
It always bothered me that we're using the overloaded "dereference" term for this. Let's call it "unreference" instead. :^)
This commit is contained in:
Notes:
sideshowbarker
2024-07-19 09:52:10 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3de5439579c
@@ -35,7 +35,7 @@ Shared ownership is implemented via reference counting.
|
||||
|
||||
NonnullRefPtr<T> is a special variant of RefPtr with one additional property: it cannot be null. NonnullRefPtr is suitable as a return type from functions that are guaranteed to never return null, and as an argument type where the argument may not be null. In other words, if RefPtr is "\*", then NonnullRefPtr is "&".
|
||||
|
||||
Objects can only be held by RefPtr if they meet certain criteria. Specifically, they need to implement the functions `ref()` and `deref()`.
|
||||
Objects can only be held by RefPtr if they meet certain criteria. Specifically, they need to implement the functions `ref()` and `unref()`.
|
||||
|
||||
To make a class T reference counted, you can simply make it inherit from RefCounted<T>. This will add all the necessary pieces to T.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user