From afb07e7e9268e0ef316c6dc58dca30599e878b6f Mon Sep 17 00:00:00 2001 From: Ivan Smirnov Date: Wed, 20 Jul 2016 00:26:18 +0100 Subject: [PATCH] Code reordering / cleanup only --- example/example-numpy-dtypes.py | 1 - include/pybind11/numpy.h | 33 ++++++++++++++++----------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/example/example-numpy-dtypes.py b/example/example-numpy-dtypes.py index 34dfd8339..68ea5c2cb 100644 --- a/example/example-numpy-dtypes.py +++ b/example/example-numpy-dtypes.py @@ -42,7 +42,6 @@ for func, dtype in [(create_rec_simple, simple_dtype), (create_rec_packed, packe else: print_rec_packed(arr) - arr = create_rec_partial(3) print(arr.dtype) partial_dtype = arr.dtype diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 20fbfd86f..d0cf1f6b7 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -27,22 +27,7 @@ NAMESPACE_BEGIN(pybind11) namespace detail { template struct npy_format_descriptor { }; - -template struct is_std_array : std::false_type { }; -template struct is_std_array> : std::true_type { }; - -template -struct is_pod_struct { - enum { value = std::is_pod::value && // offsetof only works correctly for POD types - !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 }; -}; +template struct is_pod_struct; } class array : public buffer { @@ -242,6 +227,21 @@ object dtype_of() { } NAMESPACE_BEGIN(detail) +template struct is_std_array : std::false_type { }; +template struct is_std_array> : std::true_type { }; + +template +struct is_pod_struct { + enum { value = std::is_pod::value && // offsetof only works correctly for POD types + !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 }; +}; template struct npy_format_descriptor::value>::type> { private: @@ -302,7 +302,6 @@ struct field_descriptor { object descr; }; - template struct npy_format_descriptor::value>::type> { static PYBIND11_DESCR name() { return _("struct"); }