From: Sylvain Corlay <sylvain.corlay@gmail.com>
Date: Thu, 6 Apr 2017 19:30:22 +0200
Subject: Support pybind11 2.0 for Debian packaging

---
 include/xtensor-python/pycontainer.hpp | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/include/xtensor-python/pycontainer.hpp b/include/xtensor-python/pycontainer.hpp
index cb077cd..9b57980 100644
--- a/include/xtensor-python/pycontainer.hpp
+++ b/include/xtensor-python/pycontainer.hpp
@@ -116,6 +116,34 @@ namespace xt
 
     namespace detail
     {
+
+        template <typename T, typename SFINAE = void>
+        struct is_fmt_numeric
+        {
+            static constexpr bool value = false;
+        };
+
+        constexpr int log2(size_t n, int k = 0)
+        {
+            return (n <= 1) ? k : log2(n >> 1, k + 1);
+        }
+
+        template <typename T>
+        struct is_fmt_numeric<T, std::enable_if_t<std::is_arithmetic<T>::value>>
+        {
+            static constexpr bool value = true;
+            static constexpr int index = std::is_same<T, bool>::value ? 0 : 1 + (
+                 std::is_integral<T>::value ? log2(sizeof(T)) * 2 + std::is_unsigned<T>::value : 8 + (
+                     std::is_same<T, double>::value ? 1 : std::is_same<T, long double>::value ? 2 : 0));
+        };
+
+        template <class T>
+        struct is_fmt_numeric<std::complex<T>>
+        {
+            static constexpr bool value = true;
+            static constexpr int index = is_fmt_numeric<T>::index + 3;
+        };
+
         template <class T>
         struct numpy_traits
         {
@@ -132,7 +160,7 @@ namespace xt
 
             using value_type = std::remove_const_t<T>;
 
-            static constexpr int type_num = value_list[pybind11::detail::is_fmt_numeric<value_type>::index];
+            static constexpr int type_num = value_list[is_fmt_numeric<value_type>::index];
         };
     }
 
