Namespace podio::utils
-
namespace utils
Functions
Variables
-
static constexpr auto MarkOwned = detail::MarkOwnedTag{}
- #include <podio/utilities/MaybeSharedPtr.h>
“Semi-smart” pointer class for pointers that at some point during their lifetime might hand over management to another entity.
E.g. Objects that are added to a collection will hand over the management of their Obj* to collection. In such a case two things need to be considered:
Other Objects with the same Obj* instance should not delete the managed Obj*, even if the last Object goes out of scope
Even if the managed Obj* is gone (e.g. collection has gone out of scope or was cleared), the remaining Object instances should still be able to gracefully destruct, even if they are at this point merely an “empty husk” The MaybeSharedPtr achieves this by having an optional control block that controls the lifetime of itself and potentially the managed Obj*.
Public Functions
There are no empty MaybeSharedPtrs.
Constructor from raw pointer.
Assumes someone else manages the pointer already
Constructor from a raw pointer assuming ownership in the process.
Copy constructor.
Assignment operator.
Move constructor.
Destructor.
Get a raw pointer to the managed pointer.
Do not change anything concerning the management of the pointer
Get a raw pointer to the managed pointer and assume ownership.
Friends
-
static constexpr auto MarkOwned = detail::MarkOwnedTag{}