ErasedUnique Struct
Type-erased unique ownership wrapper. More...
Declaration
Public Constructors Index
| ErasedUnique ()=default | |
|
Default constructor. Creates an empty (non-owning) instance. More... | |
template <class T> | |
| ErasedUnique (std::unique_ptr< T > p) noexcept | |
|
Constructs from a unique_ptr, taking ownership. More... | |
| ErasedUnique (ErasedUnique &&obj) noexcept | |
|
Move constructor. Transfers ownership. More... | |
Public Destructor Index
| ~ErasedUnique () | |
|
Destructor. Destroys the owned object if present. More... | |
Public Operators Index
| ErasedUnique & | operator= (ErasedUnique &&obj) noexcept |
|
Move assignment. Transfers ownership after releasing current. More... | |
Public Member Functions Index
| void | reset () noexcept |
|
Destroys the owned object and resets to empty. More... | |
Public Member Attributes Index
| void * | ptr = nullptr |
|
Raw pointer to the owned object. More... | |
| void(* | destroy)(void *) noexcept = nullptr |
|
Stateless deleter that knows the concrete type. More... | |
Description
Type-erased unique ownership wrapper.
ErasedUnique provides unique_ptr-like ownership semantics without requiring a common base class or virtual destructor. It stores a void* and a stateless deleter function pointer, totaling 16 bytes.
Used by ResourceRegistry to store heterogeneous resource types (Managers, CommandBuffers) in a single owning collection without vtable overhead for destruction.
Definition at line 31 of file ErasedUnique.ixx.
Public Constructors
ErasedUnique()
| default |
Default constructor. Creates an empty (non-owning) instance.
Definition at line 46 of file ErasedUnique.ixx.
ErasedUnique()
| inline explicit noexcept |
Constructs from a unique_ptr, taking ownership.
Releases the unique_ptr and captures a typed deleter.
- Template Parameters
-
T The owned type.
- Parameters
-
p The unique_ptr to take ownership from.
Definition at line 58 of file ErasedUnique.ixx.
Reference helios::registerComponents.
ErasedUnique()
| inline noexcept |
Move constructor. Transfers ownership.
- Parameters
-
obj The source instance (nulled after move).
Definition at line 68 of file ErasedUnique.ixx.
Reference helios::registerComponents.
Public Destructor
~ErasedUnique()
| inline |
Destructor. Destroys the owned object if present.
Definition at line 93 of file ErasedUnique.ixx.
Reference reset.
Public Operators
operator=()
| inline noexcept |
Move assignment. Transfers ownership after releasing current.
- Parameters
-
obj The source instance (nulled after move).
- Returns
Reference to this instance.
Definition at line 80 of file ErasedUnique.ixx.
References destroy, ptr, helios::registerComponents and reset.
Public Member Functions
reset()
| inline noexcept |
Public Member Attributes
destroy
|
ptr
The documentation for this struct was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.