Skip to content

Commit 0c786ad

Browse files
committed
Added limitations
1 parent 1eba6d1 commit 0c786ad

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,13 @@ int main() {
5353
return 0;
5454
}
5555
```
56+
57+
## Limitation
58+
59+
- Because of the unique ownership, weak pointers locking cannot extend the lifetime of the pointed object, hence `observable_unique_ptr` provides less thread-safety compared to `std::shared_ptr`.
60+
- `observable_unique_ptr` does not support pointers to arrays, but `std::unique_ptr` and `std::shared_ptr` both do.
61+
- `observable_unique_ptr` does not support custom allocators, but `std::shared_ptr` does.
62+
- `observable_unique_ptr` does not have a `release()` function to let go of the ownership, which `std::unique_ptr` has.
63+
- `observable_unique_ptr` allows moving from other `observable_unique_ptr` only if the deleter type is exactly the same, while `std::unique_ptr` allows moving from a convertible deleter.
64+
- `observable_unique_ptr may or may not own a deleter instance; if in doubt, check `has_deleter()`` before calling `get_deleter()`, or use `try_get_deleter()`.
65+
- a moved-from `observable_unique_ptr` will not own a deleter instance.

0 commit comments

Comments
 (0)