16 using storage_type = META::aligned_storage_t<sizeof(T), alignof(T)>;
35 return reinterpret_cast<T*
>(this->
rawPtr());
47 *
this = std::move(other);
51 this->init = other.
init;
66 template <
class... Args>
69 new(
rawPtr() )T{std::forward<Args>(args)...};
88 template <
class... Args>
90 return this->
constructor(std::forward<Args&&>(args)...);
136 return &(this->
get());
143 const T&
get()
const{
147 return *
reinterpret_cast<const T*
>(&this->
storage);
163 return &(this->
get());
178 operator bool()
const{
bool hasValue() const
Determine whether or not the storage holds a value.
void destroy()
Alias for RawStorage::destructor.
Global namespace of the SCL.
bool init
Determines whether or not the object has been constructed.
Exception class used when trying to access uninitialized memory.
RawStorage & operator=(RawStorage &&other)
storage_type storage
The actual memory that can hold the variable.
const T & operator*() const
Get the value from a constant RawStorage (e.g.
RawStorage(RawStorage &&other)
Class that handles raw storage (and manual memory management) for a variable type.
T * operator->()
Get a pointer to the underlying data.
scl::tools::meta ::aligned_storage_t< sizeof(Lhs), alignof(Lhs)> storage_type
T & constructor(Args &&... args)
Construct the variable in the storage.
T & operator*()
Access the underlying data.
T & construct(Args &&... args)
Alias for RawStorage::constructor.
RawStorage & reset()
Alias for RawStorage::destroy.
void destructor()
Call the destructor on the allocated object.
const T *const operator->() const
Get a pointer to the value from a constant RawStorage (e.g.