numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
|
Class of storage of objects. More...
#include <num_collect/util/object_storage.h>
Public Member Functions | |
object_storage () noexcept=default | |
Constructor. | |
object_storage (const object_storage &)=delete | |
object_storage (object_storage &&)=delete | |
~object_storage () noexcept | |
Destructor. | |
template<typename... Args> | |
void | emplace (Args &&... args) |
Construct an object. | |
auto | get_pointer () const noexcept -> const T * |
Get the pointer of the value. | |
auto | get_pointer () noexcept -> T * |
Get the pointer of the value. | |
auto | get_ref () const noexcept -> const T & |
Get the reference of the value. | |
auto | get_ref () noexcept -> T & |
Get the reference of the value. | |
auto | operator= (const object_storage &)=delete |
auto | operator= (object_storage &&)=delete |
void | reset () noexcept |
Destruct the object. | |
Private Attributes | |
bool | has_object_ {false} |
Whether this storage has an object. (Defined only in debug build for debugging.) | |
std::array< char, sizeof(T)> | storage_ {} |
Storage. | |
Class of storage of objects.
std::optional
, but this class won't check the existence of objects for any operation. Use this class only when you're writing a custom container by yourself and checking the lifetime of objects by your classes.T | Type of objects. |
MinimumAlignment | Minimum alignment. |
Definition at line 48 of file object_storage.h.
|
inlinenoexcept |
Destructor.
Definition at line 63 of file object_storage.h.
|
inline |
Construct an object.
Args | Types of arguments of the constructor. |
[in] | args | Arguments of the constructor. |
Definition at line 81 of file object_storage.h.
|
inlinenodiscardnoexcept |
Get the pointer of the value.
Definition at line 146 of file object_storage.h.
|
inlinenodiscardnoexcept |
Get the pointer of the value.
Definition at line 131 of file object_storage.h.
|
inlinenodiscardnoexcept |
Get the reference of the value.
Definition at line 120 of file object_storage.h.
|
inlinenodiscardnoexcept |
Get the reference of the value.
Definition at line 111 of file object_storage.h.
|
inlinenoexcept |
Destruct the object.
Definition at line 97 of file object_storage.h.
|
private |
Whether this storage has an object. (Defined only in debug build for debugging.)
Definition at line 163 of file object_storage.h.
|
private |
Storage.
Definition at line 156 of file object_storage.h.