Nebula
Loading...
Searching...
No Matches
typepunning.h
Go to the documentation of this file.
1
#pragma once
2
//------------------------------------------------------------------------------
14
#include "
core/types.h
"
15
16
//------------------------------------------------------------------------------
17
namespace
Util
18
{
19
20
template
<
typename
A,
typename
B>
21
A&
TypePunning
(B &v)
22
{
23
union
24
{
25
A *a;
26
B *b;
27
} pun;
28
pun.b = &v;
29
return
*pun.a;
30
}
31
32
template
<
typename
A,
typename
B>
33
const
A&
TypePunning
(
const
B &v)
34
{
35
union
36
{
37
const
A *a;
38
const
B *b;
39
} pun;
40
pun.b = &v;
41
return
*pun.a;
42
}
43
44
}
// namespace Util
45
//------------------------------------------------------------------------------
46
Util
A pinned array is an array which manages its own virtual memory.
Definition
String.cs:6
Util::TypePunning
A & TypePunning(B &v)
Definition
typepunning.h:21
types.h
code
foundation
util
typepunning.h
Generated on Wed Nov 13 2024 21:37:38 for Nebula. Dark theme by
Tilen Majerle
. All rights reserved.