|
DF-0
DF-0: Data processing Framework with Zero-overhead
|
A utility class that simplifies declaring function attributes that need to be stored without requiring the user to create a shared pointer. More...
#include <ref_or_owned.h>
Public Member Functions | |
| ref_or_owned (ref_or_owned< T > &&other) noexcept | |
| ref_or_owned (const ref_or_owned< T > &other) | |
| ref_or_owned & | operator= (const ref_or_owned< T > &other) |
| Copy assignment operator. | |
| ref_or_owned & | operator= (ref_or_owned< T > &&other) noexcept |
| Move assignment operator. | |
| template<ref_or_owned_compatible< T > U> | |
| ref_or_owned (U &value) | |
| Constructs a ref_or_owned object from a reference to an object. | |
| template<ref_or_owned_compatible< T > U> | |
| ref_or_owned (U &&value) | |
| Constructs a ref_or_owned object from a temporary object. | |
| template<ref_or_owned_compatible< T > U> | |
| ref_or_owned (std::shared_ptr< U > ptr) | |
| const T & | get () const |
| Returns a const reference to the stored object, regardless of whether it is stored as a reference or a shared pointer. | |
| T & | get () |
| Returns a non-const reference to the stored object, regardless of whether it is stored as a reference or a shared pointer. | |
| std::shared_ptr< T > | to_shared_ptr () const |
A utility class that simplifies declaring function attributes that need to be stored without requiring the user to create a shared pointer.
The ref_or_owned class is designed to make it easy to declare function parameters that need to store a value, without requiring the user to manually manage the memory. It acts as a "sink" that can accept either a reference or a temporary object, and will automatically manage the memory for the user.
| T | The type of the object being stored. |
Definition at line 31 of file ref_or_owned.h.
|
inlinenoexcept |
Definition at line 37 of file ref_or_owned.h.
|
inline |
Definition at line 41 of file ref_or_owned.h.
|
inline |
Constructs a ref_or_owned object from a reference to an object.
The object is stored as a reference, and the ref_or_owned object will not manage its memory.
| value | The object to be stored. |
Definition at line 65 of file ref_or_owned.h.
|
inline |
Constructs a ref_or_owned object from a temporary object.
The object is stored as a shared pointer, and the ref_or_owned object will manage its memory.
| value | The object to be stored. |
Definition at line 77 of file ref_or_owned.h.
|
inline |
Definition at line 82 of file ref_or_owned.h.
|
inline |
Returns a non-const reference to the stored object, regardless of whether it is stored as a reference or a shared pointer.
Definition at line 100 of file ref_or_owned.h.
|
inline |
Returns a const reference to the stored object, regardless of whether it is stored as a reference or a shared pointer.
Definition at line 91 of file ref_or_owned.h.
|
inline |
Copy assignment operator.
Definition at line 46 of file ref_or_owned.h.
|
inlinenoexcept |
Move assignment operator.
Definition at line 52 of file ref_or_owned.h.
|
inline |
Definition at line 104 of file ref_or_owned.h.