template<typename TR, typename... TA>
inline GenericFunctionPointer ToGenericFunctionPointer(
FuncPointer<TR, TA...> f) {
- union {
- GenericFunctionPointer gp;
- FuncPointer<TR, TA...> fp;
- } u;
- u.fp = f;
- return u.gp;
+ return reinterpret_cast<GenericFunctionPointer>(f);
}
template<typename TR, typename... TA>
inline FuncPointer<TR, TA...> FromGenericFunctionPointer(
GenericFunctionPointer g) {
- union {
- GenericFunctionPointer gp;
- FuncPointer<TR, TA...> fp;
- } u;
- u.gp = g;
- return u.fp;
+ return reinterpret_cast<FuncPointer<TR, TA...>>(g);
}
template<typename TR, typename... ArgInfo>
using TypeCode = unsigned char;
template<typename TR, typename... TA> using FuncPointer = TR (*)(TA...);
-using GenericFunctionPointer = FuncPointer<void *>;
+using GenericFunctionPointer = void (*) (void);
enum class PassBy { Ref, Val };
template<typename TA, PassBy Pass = PassBy::Ref> struct ArgumentInfo {