summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-04-23 16:46:57 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-23 16:46:57 +0200
commitb91c49364df1683c7fe1191eb02b8d9c331874f6 (patch)
treea9ea5ff8e4cc8cfcfe75c279551be35793d0ffb3 /Documentation
parentb3db01e20eeae632cc75df9af8666772bda67091 (diff)
downloadserenity-b91c49364df1683c7fe1191eb02b8d9c331874f6.zip
AK: Rename adopt() to adopt_ref()
This makes it more symmetrical with adopt_own() (which is used to create a NonnullOwnPtr from the result of a naked new.)
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/SmartPointers.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/Documentation/SmartPointers.md b/Documentation/SmartPointers.md
index 339a3e335b..a6d456e02b 100644
--- a/Documentation/SmartPointers.md
+++ b/Documentation/SmartPointers.md
@@ -42,14 +42,14 @@ Objects can only be held by `RefPtr` if they meet certain criteria. Specifically
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`.
-**Note:** When constructing an object that derives from `RefCounted`, the reference count starts out at 1 (since 0 would mean that the object has no owners and should be deleted.) The object must therefore be "adopted" by someone who takes responsibility of that 1. This is done through the global `adopt()` function:
+**Note:** When constructing an object that derives from `RefCounted`, the reference count starts out at 1 (since 0 would mean that the object has no owners and should be deleted.) The object must therefore be "adopted" by someone who takes responsibility of that 1. This is done through the global `adopt_ref()` function:
```cpp
class Bar : public RefCounted<Bar> {
...
};
-RefPtr<Bar> our_object = adopt(*new Bar);
+RefPtr<Bar> our_object = adopt_ref(*new Bar);
RefPtr<Bar> another_owner = our_object;
```