From edbd4cb0a7f8a67280be27c7f7dcdafbed60a010 Mon Sep 17 00:00:00 2001 From: Ivan Smirnov Date: Mon, 15 Aug 2016 01:23:59 +0100 Subject: [PATCH] Decay const qualifiers in is_pod_struct<> --- include/pybind11/numpy.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 8653fc195..e2b5a16a2 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -29,6 +29,8 @@ NAMESPACE_BEGIN(pybind11) namespace detail { template struct npy_format_descriptor { }; template struct is_pod_struct; +template using decay_cv_ref = + typename std::remove_cv::type>::type; struct npy_api { enum constants { @@ -321,14 +323,15 @@ template struct is_std_array> : std::tru template struct is_pod_struct { enum { value = std::is_pod::value && // offsetof only works correctly for POD types + !std::is_reference::value && !std::is_array::value && !is_std_array::value && !std::is_integral::value && - !std::is_same::value && - !std::is_same::value && - !std::is_same::value && - !std::is_same>::value && - !std::is_same>::value }; + !std::is_same::type, float>::value && + !std::is_same::type, double>::value && + !std::is_same::type, bool>::value && + !std::is_same::type, std::complex>::value && + !std::is_same::type, std::complex>::value }; }; template struct npy_format_descriptor::value>::type> {