diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index c98be0a22..29f0a87cb 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -326,8 +326,8 @@ public: } static PyObject *cast(const type &src, return_value_policy policy, PyObject *parent) { - object o1(type_caster::type>::cast(src.first, policy, parent), false); - object o2(type_caster::type>::cast(src.second, policy, parent), false); + object o1(type_caster::type>::cast(src.first, policy, parent), false); + object o2(type_caster::type>::cast(src.second, policy, parent), false); if (!o1 || !o2) return nullptr; PyObject *tuple = PyTuple_New(2); @@ -340,16 +340,16 @@ public: static PYBIND11_DESCR name() { return type_descr( - _("(") + type_caster::type>::name() + - _(", ") + type_caster::type>::name() + _(")")); + _("(") + type_caster::type>::name() + + _(", ") + type_caster::type>::name() + _(")")); } operator type() { return type(first, second); } protected: - type_caster::type> first; - type_caster::type> second; + type_caster::type> first; + type_caster::type> second; }; template class type_caster> { @@ -368,7 +368,7 @@ public: static PYBIND11_DESCR name() { return type_descr( _("(") + - detail::concat(type_caster::type>::name()...) + + detail::concat(type_caster::type>::name()...) + _(")")); } @@ -412,7 +412,7 @@ protected: /* Implementation: Convert a C++ tuple into a Python tuple */ template static PyObject *cast(const type &src, return_value_policy policy, PyObject *parent, index_sequence) { std::array results {{ - object(type_caster::type>::cast(std::get(src), policy, parent), false)... + object(type_caster::type>::cast(std::get(src), policy, parent), false)... }}; for (const auto & result : results) if (!result) @@ -427,7 +427,7 @@ protected: } protected: - std::tuple::type>...> value; + std::tuple::type>...> value; }; /// Type caster for holder types like std::shared_ptr, etc. @@ -488,7 +488,7 @@ public: NAMESPACE_END(detail) template inline T cast(PyObject *object) { - detail::type_caster::type> conv; + detail::type_caster::type> conv; if (!conv.load(object, true)) throw cast_error("Unable to cast Python object to C++ type"); return conv; @@ -497,7 +497,7 @@ template inline T cast(PyObject *object) { template inline object cast(const T &value, return_value_policy policy = return_value_policy::automatic, PyObject *parent = nullptr) { if (policy == return_value_policy::automatic) policy = std::is_pointer::value ? return_value_policy::take_ownership : return_value_policy::copy; - return object(detail::type_caster::type>::cast(value, policy, parent), false); + return object(detail::type_caster::type>::cast(value, policy, parent), false); } template inline T handle::cast() const { return pybind11::cast(m_ptr); } @@ -506,7 +506,7 @@ template <> inline void handle::cast() const { return; } template inline object handle::call(Args&&... args_) const { const size_t size = sizeof...(Args); std::array args{ - { object(detail::type_caster::type>::cast( + { object(detail::type_caster::type>::cast( std::forward(args_), return_value_policy::reference, nullptr), false)... } }; for (const auto & result : args) diff --git a/include/pybind11/common.h b/include/pybind11/common.h index c6e62910e..8b34e4e89 100644 --- a/include/pybind11/common.h +++ b/include/pybind11/common.h @@ -221,13 +221,13 @@ template struct remove_class struct remove_class { typedef R type(A...); }; /// Helper template to strip away type modifiers -template struct decay { typedef T type; }; -template struct decay { typedef typename decay::type type; }; -template struct decay { typedef typename decay::type type; }; -template struct decay { typedef typename decay::type type; }; -template struct decay { typedef typename decay::type type; }; -template struct decay { typedef typename decay::type type; }; -template struct decay { typedef typename decay::type type; }; +template struct intrinsic_type { typedef T type; }; +template struct intrinsic_type { typedef typename intrinsic_type::type type; }; +template struct intrinsic_type { typedef typename intrinsic_type::type type; }; +template struct intrinsic_type { typedef typename intrinsic_type::type type; }; +template struct intrinsic_type { typedef typename intrinsic_type::type type; }; +template struct intrinsic_type { typedef typename intrinsic_type::type type; }; +template struct intrinsic_type { typedef typename intrinsic_type::type type; }; /// Helper type to replace 'void' in some expressions struct void_type { }; diff --git a/include/pybind11/functional.h b/include/pybind11/functional.h index 18056ce4a..5bc898834 100644 --- a/include/pybind11/functional.h +++ b/include/pybind11/functional.h @@ -41,7 +41,7 @@ public: PYBIND11_TYPE_CASTER(type, _("function<") + type_caster>::name() + _(" -> ") + - type_caster::type>::name() + + type_caster::type>::name() + _(">")); }; diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 9827c0a3c..19a465582 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -94,7 +94,7 @@ private: /// Picks a suitable return value converter from cast.h template using return_value_caster = detail::type_caster::value, detail::void_type, typename detail::decay::type>::type>; + std::is_void::value, detail::void_type, typename detail::intrinsic_type::type>::type>; /// Picks a suitable argument value converter from cast.h template using arg_value_caster = @@ -127,7 +127,7 @@ private: if (entry->class_ && entry->args.empty()) entry->args.emplace_back("self", nullptr, nullptr); - PyObject *obj = detail::type_caster::type>::cast( + PyObject *obj = detail::type_caster::type>::cast( a.value, return_value_policy::automatic, nullptr); if (obj == nullptr)