CTR Pia  4.11.3
Game Communication Engine
clone_VoidMemberConcealer.h
1 /*---------------------------------------------------------------------------*
2  Project: Pia
3  File: clone_VoidMemberConcealer.h
4 
5  Copyright Nintendo. All rights reserved.
6 
7  These coded instructions, statements, and computer programs contain
8  proprietary information of Nintendo of America Inc. and/or Nintendo
9  Company Ltd., and are protected by Federal copyright law. They may
10  not be disclosed to third parties or copied or duplicated in any form,
11  in whole or in part, without the prior written consent of Nintendo.
12  *---------------------------------------------------------------------------*/
13 
14 
15 #pragma once
16 
17 #include <pia/clone/clone_definitions.h>
18 
19 
20 namespace nn
21 {
22 namespace pia
23 {
24 namespace clone
25 {
26 
27 /*
28 n1589:memo
29 This is a wrapper template for not using extra memory when <tt>void</tt> is set to <tt>T2</tt>.
30 */
31 
32 //! @cond PRIVATE
33 template <typename T1, typename T2>
34 struct VoidMemberConcealer
35 {
36 public:
37  VoidMemberConcealer()
38  : m_T1(), m_T2()
39  {
40  }
41  T1* GetT1Ptr()
42  {
43  return &m_T1;
44  }
45  T2* GetT2Ptr()
46  {
47  return &m_T2;
48  }
49 
50 private:
51  T1 m_T1;
52  T2 m_T2;
53 };
54 
55 template <typename T1>
56 struct VoidMemberConcealer<T1, void>
57 {
58 public:
59  VoidMemberConcealer()
60  : m_T1()
61  {
62  }
63  T1* GetT1Ptr()
64  {
65  return &m_T1;
66  }
67  void* GetT2Ptr()
68  {
69  return NULL;
70  }
71 
72 private:
73  T1 m_T1;
74 };
75 //! @endcond
76 }
77 }
78 } // end of namespace nn::pia::clone
Definition: assert.h:115