Permalink
Browse files

- gcc/clang didn't like having this in a class

  • Loading branch information...
dpjudas committed Dec 3, 2018
1 parent ae44b93 commit 14919f49ec1b4862a50d84ebf43b5e3c5db1596d
Showing with 14 additions and 11 deletions.
  1. +14 −11 src/scripting/vm/vm.h
@@ -561,6 +561,19 @@ struct FieldDesc
int BitValue;
};
namespace
{
// Traits for the types we are interested in
template<typename T> struct native_is_valid { static const bool value = false; };
template<typename T> struct native_is_valid<T*> { static const bool value = true; };
template<typename T> struct native_is_valid<T&> { static const bool value = true; };
template<> struct native_is_valid<void> { static const bool value = true; };
template<> struct native_is_valid<int> { static const bool value = true; };
template<> struct native_is_valid<unsigned int> { static const bool value = true; };
template<> struct native_is_valid<double> { static const bool value = true; };
template<> struct native_is_valid<bool> { static const bool value = true; };
}
// Compile time validation of direct native functions
struct DirectNativeDesc
{
@@ -582,17 +595,7 @@ struct DirectNativeDesc
#undef TP
#undef VP
template<typename T> void ValidateType() { static_assert(is_valid<T>::value, "Argument type is not valid as a direct native parameter or return type"); }
// Traits for the types we are interested in
template<typename T> struct is_valid { static const bool value = false; };
template<typename T> struct is_valid<T*> { static const bool value = true; };
template<typename T> struct is_valid<T&> { static const bool value = true; };
template<> struct is_valid<void> { static const bool value = true; };
template<> struct is_valid<int> { static const bool value = true; };
template<> struct is_valid<unsigned int> { static const bool value = true; };
template<> struct is_valid<double> { static const bool value = true; };
template<> struct is_valid<bool> { static const bool value = true; };
template<typename T> void ValidateType() { static_assert(native_is_valid<T>::value, "Argument type is not valid as a direct native parameter or return type"); }
operator void *() const { return Ptr; }

0 comments on commit 14919f4

Please sign in to comment.