Gaia-ECS v1.0.0
A simple and powerful entity component system
Loading...
Searching...
No Matches
gaia::mem::unaligned_ref< T > Class Template Reference

Pointer wrapper for writing memory in defined way (not causing undefined behavior) More...

#include <mem_alloc.h>

Public Member Functions

 unaligned_ref (void *p)
 Creates a reference to potentially unaligned storage.
 
unaligned_refoperator= (const T &value)
 Stores a value using byte-wise copying.
 
GAIA_NODISCARD operator T () const
 Loads a value using byte-wise copying.
 

Detailed Description

template<typename T>
class gaia::mem::unaligned_ref< T >

Pointer wrapper for writing memory in defined way (not causing undefined behavior)

Template Parameters
TStored value type.

Constructor & Destructor Documentation

◆ unaligned_ref()

template<typename T >
gaia::mem::unaligned_ref< T >::unaligned_ref ( void *  p)
inline

Creates a reference to potentially unaligned storage.

Parameters
pStorage address.

Member Function Documentation

◆ operator T()

template<typename T >
GAIA_NODISCARD gaia::mem::unaligned_ref< T >::operator T ( ) const
inline

Loads a value using byte-wise copying.

Returns
Value read from storage.

◆ operator=()

template<typename T >
unaligned_ref & gaia::mem::unaligned_ref< T >::operator= ( const T &  value)
inline

Stores a value using byte-wise copying.

Parameters
valueValue to store.
Returns
This reference.

The documentation for this class was generated from the following file: