mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 22:52:01 +00:00
Remove usage of C++14 constructs (fixes #1929)
This commit is contained in:
parent
f3109d8419
commit
7f5dad7d5f
@ -113,12 +113,12 @@ template <typename T> struct same_size {
|
|||||||
template <typename U> using as = bool_constant<sizeof(T) == sizeof(U)>;
|
template <typename U> using as = bool_constant<sizeof(T) == sizeof(U)>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename Concrete> constexpr int platform_lookup() { return -1; }
|
||||||
|
|
||||||
// Lookup a type according to its size, and return a value corresponding to the NumPy typenum.
|
// Lookup a type according to its size, and return a value corresponding to the NumPy typenum.
|
||||||
template <typename Concrete, typename... Check, typename... Int>
|
template <typename Concrete, typename T, typename... Ts, typename... Ints>
|
||||||
constexpr int platform_lookup(Int... codes) {
|
constexpr int platform_lookup(int I, Ints... Is) {
|
||||||
using code_index = std::integral_constant<int, constexpr_first<same_size<Concrete>::template as, Check...>()>;
|
return sizeof(Concrete) == sizeof(T) ? I : platform_lookup<Concrete, Ts...>(Is...);
|
||||||
static_assert(code_index::value != sizeof...(Check), "Unable to match type on this platform");
|
|
||||||
return std::get<code_index::value>(std::make_tuple(codes...));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct npy_api {
|
struct npy_api {
|
||||||
|
Loading…
Reference in New Issue
Block a user