![]() |
Spicy
|
#include <reference.h>
Public Types | |
using | Base = std::shared_ptr< T > |
Public Member Functions | |
StrongReference () | |
StrongReference (T t) | |
StrongReference (const ValueReference< T > &t) | |
StrongReference (std::nullptr_t) | |
StrongReference (const StrongReference &other) | |
StrongReference (StrongReference &&other) noexcept | |
bool | isNull () const |
ValueReference< T > | derefAsValue () const |
void | reset () |
const T & | operator* () const |
T & | operator* () |
const T * | operator-> () const |
T * | operator-> () |
operator bool () const | |
StrongReference & | operator= (T other) |
StrongReference & | operator= (const ValueReference< T > &other) |
StrongReference & | operator= (const StrongReference &other) |
StrongReference & | operator= (StrongReference &&other) noexcept |
StrongReference & | operator= (std::nullptr_t) noexcept |
A strong reference to a shared value. This is essentially a shared_ptr
that can bind to the values of ValueReference
or WeakReference.
Note that different from ValueReference
, a strong reference can explicitly be null.
|
inline |
Default constructor creating a null reference.
|
inlineexplicit |
Instantiates a reference pointing to a newly allocated value.
t | initialization value |
|
inlineexplicit |
Instantiates a reference pointing to the value referred to be an existing ValueReference
. This does not copy the value, it will be shared (and managed jointly) afterwards.
|
inlineexplicit |
Instantiate an unset reference.
|
inline |
Copy constructor. This copies the reference, not the value, which will be shared afterwards.
|
inlinenoexcept |
Move constructor.
|
inline |
Returns a value reference that is linked to the referred value. If the strong reference is null, the returned reference will be so, too.
|
inline |
Returns true if the reference does not refer any value.
|
inlineexplicit |
Returns true if the reference is not null.
|
inline |
Returns the contained value.
NullReference | if the instance is null. |
|
inline |
Returns the contained value.
NullReference | if the instance is null. |
|
inline |
Returns a pointer to the contained value.
NullReference | if the instance is null. |
|
inline |
Returns a pointer to the contained value.
NullReference | if the instance is null. |
|
inline |
Reinitializes the reference with a newly allocated value, releasing any previous ownership still held.
t | value to allocate and then refer to |
|
inline |
Reinitialized the reference to now point to to the value referred to be an existing ValueReference
. This does not copy that value, it will be shared (and managed jointly) afterwards.
|
inline |
Copy assignment. This will share ownership, not copy the value.
|
inlinenoexcept |
Move assignment.
|
inlinenoexcept |
Reset pointer.
|
inline |
Resets the reference to a null value, releasing any ownership it still holds.