diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index cee40c817..04001d6c5 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -552,6 +552,14 @@ template struct format_descriptor> { static std::string format() { return std::to_string(N) + "s"; } }; +template +struct format_descriptor::value>> { + static std::string format() { + return format_descriptor< + typename std::remove_cv::type>::type>::format(); + } +}; + NAMESPACE_BEGIN(detail) template struct is_std_array : std::false_type { }; template struct is_std_array> : std::true_type { }; @@ -563,6 +571,7 @@ struct is_pod_struct { !std::is_array::value && !is_std_array::value && !std::is_integral::value && + !std::is_enum::value && !std::is_same::type, float>::value && !std::is_same::type, double>::value && !std::is_same::type, bool>::value && @@ -612,6 +621,14 @@ template struct npy_format_descriptor { DECL_CHAR_FMT }; template struct npy_format_descriptor> { DECL_CHAR_FMT }; #undef DECL_CHAR_FMT +template struct npy_format_descriptor::value>> { +private: + using base_descr = npy_format_descriptor::type>; +public: + static PYBIND11_DESCR name() { return base_descr::name(); } + static pybind11::dtype dtype() { return base_descr::dtype(); } +}; + struct field_descriptor { const char *name; size_t offset;