Ocular Engine
OCULAR_INTERNAL_VoidCast< T > Union Template Reference

#include <VoidCast.hpp>

Public Attributes

var
 
void * ptr
 

Detailed Description

template<typename T>
union OCULAR_INTERNAL_VoidCast< T >

No namespace as I like to live dangerously.

Implementation of a simple void_cast set of functions. As the name suggests, these allow for the casting back and forth between void*. Example of it's use:

void* vp = nullptr;
uint32_t uiA = 5;
uint32_t uiB = 0;
vp = void_cast<uint32_t>(uiA);
uiB = void_cast<uint32_t>(vp); // uiB now equals 5
//---------------------------------------------
float fA = 13.37;
float fB = 0.0f;
vp = void_cast<float>(fA);
fB = void_cast<float>(vp); // fB now equals 13.37f
//---------------------------------------------
Foo* fooA = new Foo();
Foo* fooB = nullptr;
fooA->value = 19;
vp = void_cast<Foo*>(fooA);
fooB = void_cast<Foo*>(vp); // fooB->value now equals 19
//---------------------------------------------
Foo fooC;
Foo fooD;
fooC.value = 36;
vp = void_cast<Foo>(fooC);
fooD = void_cast<Foo>(vp); // fooD->value now equals 36

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