mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 21:25:13 +00:00
Decay const qualifiers in is_pod_struct<>
This commit is contained in:
parent
6ecb5b1583
commit
edbd4cb0a7
@ -29,6 +29,8 @@ NAMESPACE_BEGIN(pybind11)
|
||||
namespace detail {
|
||||
template <typename type, typename SFINAE = void> struct npy_format_descriptor { };
|
||||
template <typename type> struct is_pod_struct;
|
||||
template <typename T> using decay_cv_ref =
|
||||
typename std::remove_cv<typename std::remove_reference<T>::type>::type;
|
||||
|
||||
struct npy_api {
|
||||
enum constants {
|
||||
@ -321,14 +323,15 @@ template <typename T, size_t N> struct is_std_array<std::array<T, N>> : std::tru
|
||||
template <typename T>
|
||||
struct is_pod_struct {
|
||||
enum { value = std::is_pod<T>::value && // offsetof only works correctly for POD types
|
||||
!std::is_reference<T>::value &&
|
||||
!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 };
|
||||
!std::is_same<typename std::remove_cv<T>::type, float>::value &&
|
||||
!std::is_same<typename std::remove_cv<T>::type, double>::value &&
|
||||
!std::is_same<typename std::remove_cv<T>::type, bool>::value &&
|
||||
!std::is_same<typename std::remove_cv<T>::type, std::complex<float>>::value &&
|
||||
!std::is_same<typename std::remove_cv<T>::type, std::complex<double>>::value };
|
||||
};
|
||||
|
||||
template <typename T> struct npy_format_descriptor<T, typename std::enable_if<std::is_integral<T>::value>::type> {
|
||||
|
Loading…
Reference in New Issue
Block a user