observable_unique_ptr | Unique-ownership smart pointers with observable lifetime
kandi X-RAY | observable_unique_ptr Summary
kandi X-RAY | observable_unique_ptr Summary
observable_unique_ptr is a C++ library. observable_unique_ptr has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.
This is a small header-only library, providing the unique-ownership smart pointers observable_unique_ptr and observable_sealed_ptr that can be observed with non-owning pointers observer_ptr. This is a mixture of std::unique_ptr and std::shared_ptr: it borrows the unique-ownership semantic of std::unique_ptr (movable, non-copiable), but allows creating observer_ptr to monitor the lifetime of the pointed object (like std::weak_ptr for std::shared_ptr). The only difference between observable_unique_ptr and observable_sealed_ptr is that the former can release ownership, while the latter cannot. Disallowing release of ownership enables allocation optimizations. Therefore, the recommendation is to use observable_sealed_ptr unless release of ownership is required. These pointers are useful for cases where the shared-ownership of std::shared_ptr is not desirable, e.g., when lifetime must be carefully controlled and not be allowed to extend, yet non-owning/weak/observer references to the object may exist after the object has been deleted. Note: Because of the unique ownership model, observer pointers cannot extend the lifetime of the pointed object, hence this library provides less safety compared to std::shared_ptr/std::weak_ptr. This is also true of std::unique_ptr, and is a fundamental limitation of unique ownership. If this is an issue, simply use std::shared_ptr/std::weak_ptr.
This is a small header-only library, providing the unique-ownership smart pointers observable_unique_ptr and observable_sealed_ptr that can be observed with non-owning pointers observer_ptr. This is a mixture of std::unique_ptr and std::shared_ptr: it borrows the unique-ownership semantic of std::unique_ptr (movable, non-copiable), but allows creating observer_ptr to monitor the lifetime of the pointed object (like std::weak_ptr for std::shared_ptr). The only difference between observable_unique_ptr and observable_sealed_ptr is that the former can release ownership, while the latter cannot. Disallowing release of ownership enables allocation optimizations. Therefore, the recommendation is to use observable_sealed_ptr unless release of ownership is required. These pointers are useful for cases where the shared-ownership of std::shared_ptr is not desirable, e.g., when lifetime must be carefully controlled and not be allowed to extend, yet non-owning/weak/observer references to the object may exist after the object has been deleted. Note: Because of the unique ownership model, observer pointers cannot extend the lifetime of the pointed object, hence this library provides less safety compared to std::shared_ptr/std::weak_ptr. This is also true of std::unique_ptr, and is a fundamental limitation of unique ownership. If this is an issue, simply use std::shared_ptr/std::weak_ptr.
Support
Quality
Security
License
Reuse
Support
observable_unique_ptr has a low active ecosystem.
It has 23 star(s) with 2 fork(s). There are 2 watchers for this library.
It had no major release in the last 12 months.
There are 0 open issues and 1 have been closed. There are no pull requests.
It has a neutral sentiment in the developer community.
The latest version of observable_unique_ptr is v0.7.2
Quality
observable_unique_ptr has no bugs reported.
Security
observable_unique_ptr has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
License
observable_unique_ptr is licensed under the MIT License. This license is Permissive.
Permissive licenses have the least restrictions, and you can use them in most projects.
Reuse
observable_unique_ptr releases are available to install and integrate.
Installation instructions are not available. Examples and code snippets are available.
Top functions reviewed by kandi - BETA
kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of observable_unique_ptr
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of observable_unique_ptr
observable_unique_ptr Key Features
No Key Features are available at this moment for observable_unique_ptr.
observable_unique_ptr Examples and Code Snippets
Copy
#include
#include
#include
#include
int main() {
// Non-owning pointer that will outlive the object
oup::observer_ptr obs_ptr;
{
// Sealed (unique) pointer that owns the object
auto owner_ptr = oup::make_observable_
Community Discussions
No Community Discussions are available at this moment for observable_unique_ptr.Refer to stack overflow page for discussions.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install observable_unique_ptr
You can download it from GitHub.
Support
For any new features, suggestions and bugs create an issue on GitHub.
If you have any questions check and ask questions on community page Stack Overflow .
Find more information at:
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page