mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 15:12:01 +00:00
Code reordering / cleanup only
This commit is contained in:
parent
5db82353f7
commit
afb07e7e92
@ -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
|
||||
|
@ -27,22 +27,7 @@
|
||||
NAMESPACE_BEGIN(pybind11)
|
||||
namespace detail {
|
||||
template <typename type, typename SFINAE = void> struct npy_format_descriptor { };
|
||||
|
||||
template <typename T> struct is_std_array : std::false_type { };
|
||||
template <typename T, size_t N> struct is_std_array<std::array<T, N>> : std::true_type { };
|
||||
|
||||
template <typename T>
|
||||
struct is_pod_struct {
|
||||
enum { value = std::is_pod<T>::value && // offsetof only works correctly for POD types
|
||||
!std::is_array<T>::value &&
|
||||
!is_std_array<T>::value &&
|
||||
!std::is_integral<T>::value &&
|
||||
!std::is_same<T, float>::value &&
|
||||
!std::is_same<T, double>::value &&
|
||||
!std::is_same<T, bool>::value &&
|
||||
!std::is_same<T, std::complex<float>>::value &&
|
||||
!std::is_same<T, std::complex<double>>::value };
|
||||
};
|
||||
template <typename type> struct is_pod_struct;
|
||||
}
|
||||
|
||||
class array : public buffer {
|
||||
@ -242,6 +227,21 @@ object dtype_of() {
|
||||
}
|
||||
|
||||
NAMESPACE_BEGIN(detail)
|
||||
template <typename T> struct is_std_array : std::false_type { };
|
||||
template <typename T, size_t N> struct is_std_array<std::array<T, N>> : std::true_type { };
|
||||
|
||||
template <typename T>
|
||||
struct is_pod_struct {
|
||||
enum { value = std::is_pod<T>::value && // offsetof only works correctly for POD types
|
||||
!std::is_array<T>::value &&
|
||||
!is_std_array<T>::value &&
|
||||
!std::is_integral<T>::value &&
|
||||
!std::is_same<T, float>::value &&
|
||||
!std::is_same<T, double>::value &&
|
||||
!std::is_same<T, bool>::value &&
|
||||
!std::is_same<T, std::complex<float>>::value &&
|
||||
!std::is_same<T, std::complex<double>>::value };
|
||||
};
|
||||
|
||||
template <typename T> struct npy_format_descriptor<T, typename std::enable_if<std::is_integral<T>::value>::type> {
|
||||
private:
|
||||
@ -302,7 +302,6 @@ struct field_descriptor {
|
||||
object descr;
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct npy_format_descriptor<T, typename std::enable_if<is_pod_struct<T>::value>::type> {
|
||||
static PYBIND11_DESCR name() { return _("struct"); }
|
||||
|
Loading…
Reference in New Issue
Block a user