Skip to content

Commit df317e7

Browse files
committed
Added info on using enable_observer_from_this
1 parent 7a8078c commit df317e7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ int main() {
8383
}
8484
```
8585

86+
As with `std::shared_ptr`/`std::weak_ptr`, if you need to obtain an observer pointer to an object when you only have `this` (i.e., from a member function), you can inherit from `oup::enable_observer_from_this<T>` to gain access to the `observer_from_this()` member function. This function will return a valid observer pointer as long as the object is owned by a unique or sealed pointer, and will return `nullptr` in all other cases.
87+
8688

8789
## Limitations
8890

0 commit comments

Comments
 (0)