Mixin that lets copies of the this object keep an external object reference of type BackRef alive.
More...
#include <back_ref_mixin.hpp>
template<typename BackRef>
class rapidsmpf::BackRefMixin< BackRef >
Mixin that lets copies of the this object keep an external object reference of type BackRef alive.
- Note
- Copying an instance without calling
set_backref() throws std::bad_weak_ptr.
- Template Parameters
-
| BackRef | Type of the external object reference. |
Definition at line 25 of file back_ref_mixin.hpp.
◆ BackRefMixin()
template<typename BackRef >
Acquire shared ownership of other's back-referenced owner.
After construction, this references the same owner as other and keeps it alive for as long as this lives.
- Parameters
-
- Exceptions
-
| std::bad_weak_ptr | if other is uninstalled, or is installed but its owner has been destroyed. |
Definition at line 40 of file back_ref_mixin.hpp.
◆ operator=() [1/2]
template<typename BackRef >
Move assignment operator.
- Returns
- Reference to this mixin.
◆ operator=() [2/2]
template<typename BackRef >
Copy assignment with the same semantics as the copy constructor.
If the assignment throws, this is left unchanged.
- Parameters
-
- Returns
- Reference to this.
- Exceptions
-
| std::bad_weak_ptr | if other is uninstalled, or is installed but its owner has been destroyed. |
Definition at line 55 of file back_ref_mixin.hpp.
◆ operator==()
template<typename BackRef >
Owner-based equality.
- Parameters
-
| other | Mixin to compare against. |
- Returns
true if both mixins reference the same back-referenced owner, or are both uninstalled.
Definition at line 84 of file back_ref_mixin.hpp.
◆ set_backref()
template<typename BackRef >
Install a back-reference on this instance.
After this call, every subsequent copy of this will hold shared ownership of backref's referent for the lifetime of the copy.
Installation only affects this and copies made from it afterwards; copies that already exist are not retroactively back-referenced. To guarantee the back-reference is honored by every observable copy, install it before the host object becomes reachable to any code that may copy it.
- Parameters
-
| backref | Non-empty weak reference to the back-referenced owner. |
- Exceptions
-
| std::invalid_argument | if backref is empty, or if a back-reference is already installed on this instance. |
Definition at line 104 of file back_ref_mixin.hpp.
The documentation for this class was generated from the following file: