Elements  6.2
A C++ base framework for the Euclid Software.
FuncPtrCast.h
Go to the documentation of this file.
1 
29 #ifndef ELEMENTSKERNEL_ELEMENTSKERNEL_FUNCPTRCAST_H_
30 #define ELEMENTSKERNEL_ELEMENTSKERNEL_FUNCPTRCAST_H_
31 
32 namespace Elements {
33 namespace System {
34 
54 template <typename DESTPTR, typename SRCPTR>
55 inline DESTPTR FuncPtrCast(SRCPTR ptr) {
56 #ifdef __GNUC__
57  union {
58  SRCPTR src;
59  DESTPTR dst;
60  } p2p;
61  p2p.src = ptr;
62  return p2p.dst;
63 #else
64  return reinterpret_cast<DESTPTR>(ptr);
65 #endif
66 }
67 
68 } // namespace System
69 } // namespace Elements
70 
71 #endif // ELEMENTSKERNEL_ELEMENTSKERNEL_FUNCPTRCAST_H_
72 
Elements::System::FuncPtrCast
DESTPTR FuncPtrCast(SRCPTR ptr)
Cast from void * to function pointer.
Definition: FuncPtrCast.h:55
Elements
Definition: callBackExample.h:35
Elements::System::InfoType::System
@ System