fix: std::is_pod -> pybind11::detail::is_pod

This commit is contained in:
Henry Schreiner 2020-10-15 09:43:49 -04:00 committed by Henry Schreiner
parent f200832534
commit b72c79f964

View File

@ -20,6 +20,7 @@
#include <sstream>
#include <string>
#include <functional>
#include <type_traits>
#include <utility>
#include <vector>
#include <typeindex>
@ -328,6 +329,12 @@ template <typename T> using is_pod_struct = all_of<
satisfies_none_of<T, std::is_reference, std::is_array, is_std_array, std::is_arithmetic, is_complex, std::is_enum>
>;
// Replacement for std::is_pod (deprecated in C++20)
template <typename T> using is_pod = all_of<
std::is_standard_layout<T>,
std::is_trivial<T>
>;
template <ssize_t Dim = 0, typename Strides> ssize_t byte_offset_unsafe(const Strides &) { return 0; }
template <ssize_t Dim = 0, typename Strides, typename... Ix>
ssize_t byte_offset_unsafe(const Strides &strides, ssize_t i, Ix... index) {
@ -1448,7 +1455,7 @@ struct vectorize_arg {
using call_type = remove_reference_t<T>;
// Is this a vectorized argument?
static constexpr bool vectorize =
satisfies_any_of<call_type, std::is_arithmetic, is_complex, std::is_pod>::value &&
satisfies_any_of<call_type, std::is_arithmetic, is_complex, is_pod>::value &&
satisfies_none_of<call_type, std::is_pointer, std::is_array, is_std_array, std::is_enum>::value &&
(!std::is_reference<T>::value ||
(std::is_lvalue_reference<T>::value && std::is_const<call_type>::value));