From c9d73aaa43d4f081109c7365c9db93e81a910636 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 28 Jan 2021 21:01:37 -0800 Subject: [PATCH] Giving up on idea to use legacy init_instance only if is_base_of. There are use cases in the wild that define both a custom type_caster and class_. --- include/pybind11/pybind11.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index efb460b1f..9d3fd5def 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -1506,17 +1506,16 @@ public: } private: - template >::value, - int> = 0> + template < + typename T = type, + detail::enable_if_t::value, int> = 0> void generic_type_initialize(const detail::type_record &record) { generic_type::initialize(record, &detail::type_caster_generic::local_load); } template < typename T = type, - detail::enable_if_t::is_smart_holder_type_caster::value, int> = 0> + detail::enable_if_t::value, int> = 0> void generic_type_initialize(const detail::type_record &record) { generic_type::initialize(record, detail::type_caster::get_local_load_function_ptr()); } @@ -1565,10 +1564,9 @@ private: /// instance. Should be called as soon as the `type` value_ptr is set for an instance. Takes an /// optional pointer to an existing holder to use; if not specified and the instance is /// `.owned`, a new holder will be constructed to manage the value pointer. - template >::value, - int> = 0> + template < + typename T = type, + detail::enable_if_t::value, int> = 0> static void init_instance(detail::instance *inst, const void *holder_ptr) { auto v_h = inst->get_value_and_holder(detail::get_type_info(typeid(type))); if (!v_h.instance_registered()) { @@ -1580,7 +1578,7 @@ private: template < typename T = type, - detail::enable_if_t::is_smart_holder_type_caster::value, int> = 0> + detail::enable_if_t::value, int> = 0> static void init_instance(detail::instance *inst, const void *holder_ptr) { detail::type_caster::template init_instance_for_type(inst, holder_ptr); }