Like a Mutual_ptr
, except it can accept multiple partners.
More...
#include <Mutual_ptr.hpp>
Public Member Functions | |
Multiple_ptr (T *data) | |
Constructs a Multiple_ptr and permanently associates it with data . | |
Multiple_ptr (const Multiple_ptr &)=delete | |
Cannot copy a Multiple_ptr because it is unclear what that should do to partners. | |
Multiple_ptr & | operator= (const Multiple_ptr &)=delete |
Multiple_ptr (Multiple_ptr &&other) | |
Multiple_ptr & | operator= (Multiple_ptr &&other) |
Moving a Multiple_ptr steals the others partners. | |
void | add (Ptr_base< U, T > &other) |
Adds other to the list of partners and reciprocally connects it with this . | |
void | remove (Ptr_base< U, T > &other) |
Removes other from the list of partners and reciprocally disconnects it from this . | |
operator bool () const | |
Returns true iff this has at least 1 partner. | |
T & | mine () |
Obtain the object I am permanently associated with. | |
std::vector< Ptr_base< U, T > * > | partners () |
Obtains the sequence of partners, in no particular order. | |
const T & | mine () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
std::vector< const Ptr_base< U, T > * > | partners () const |
Obtains the sequence of partners, in no particular order. | |
Additional Inherited Members | |
![]() | |
void | connect (Ptr_base< U, T > *other) |
Mutually connect us by calling both our connect_self . | |
void | disconnect (Ptr_base< U, T > *other) |
Mutually disconnect us by calling both our disconnect_self . | |
Like a Mutual_ptr
, except it can accept multiple partners.
Has a sequence of partners()
, each of which is a Ptr_base<U, T>
. Thus it can be connected to Mutual_ptr
s or other Multiple_ptr
s. Disconnecting (using Multiple_ptr::remove
, Mutual_ptr::unpair()
, or destroying the partners) will simply remove partners from the sequence.
|
inline |
Constructs a Multiple_ptr
and permanently associates it with data
.
data
must not be null.
|
inline |
operator=(Multiple_ptr&&)
|
inlinevirtual |
Obtain the object I am permanently associated with.
Implements hexed::Ptr_base< T, U >.
|
inlinevirtual |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Implements hexed::Ptr_base< T, U >.
|
inline |
Moving a Multiple_ptr
steals the others partners.
mine()
will point to other.mine()
. Any partners this
had before the move assignment will be removed. other
will be left with its mine()
intact and no partners.