diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 8b21d3d43..ba41a223d 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -113,12 +113,12 @@ template struct same_size { template using as = bool_constant; }; +template constexpr int platform_lookup() { return -1; } + // Lookup a type according to its size, and return a value corresponding to the NumPy typenum. -template -constexpr int platform_lookup(Int... codes) { - using code_index = std::integral_constant::template as, Check...>()>; - static_assert(code_index::value != sizeof...(Check), "Unable to match type on this platform"); - return std::get(std::make_tuple(codes...)); +template +constexpr int platform_lookup(int I, Ints... Is) { + return sizeof(Concrete) == sizeof(T) ? I : platform_lookup(Is...); } struct npy_api {