diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 73cdce0e3..bbd68cfb8 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -23,7 +23,19 @@ #endif NAMESPACE_BEGIN(pybind11) -namespace detail { template struct npy_format_descriptor { }; } +namespace detail { +template struct npy_format_descriptor { }; + +template +struct is_pod_struct { + enum { value = std::is_pod::value && // offsetof only works correctly for POD types + !std::is_integral::value && + !std::is_same::value && + !std::is_same::value && + !std::is_same>::value && + !std::is_same>::value }; +}; +} class array : public buffer { public: @@ -156,14 +168,8 @@ public: } }; -template struct format_descriptor -::value && - !std::is_integral::value && - !std::is_same::value && - !std::is_same::value && - !std::is_same>::value && - !std::is_same>::value>::type> -{ +template +struct format_descriptor::value>::type> { static const char *format() { return detail::npy_format_descriptor::format(); } @@ -217,13 +223,8 @@ struct field_descriptor { object descr; }; -template struct npy_format_descriptor -::value && // offsetof only works correctly for POD types - !std::is_integral::value && - !std::is_same::value && - !std::is_same::value && - !std::is_same>::value && - !std::is_same>::value>::type> +template +struct npy_format_descriptor::value>::type> { static PYBIND11_DESCR name() { return _("user-defined"); }