From e8cd42953e40de8dbb087fd5f9e0b74e6fef6438 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Sun, 30 Jun 2024 11:22:41 -0700 Subject: [PATCH] pybind11/detail/init.h: replace type_uses_smart_holder_type_caster<> with is_same, smart_holder> (still does not build). --- include/pybind11/detail/init.h | 41 +++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/include/pybind11/detail/init.h b/include/pybind11/detail/init.h index e7b3a5f49..062036da5 100644 --- a/include/pybind11/detail/init.h +++ b/include/pybind11/detail/init.h @@ -10,7 +10,7 @@ #pragma once #include "class.h" -#include "smart_holder_sfinae_hooks_only.h" +#include "smart_holder_poc.h" PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE) @@ -156,9 +156,10 @@ void construct(value_and_holder &v_h, Alias *alias_ptr, bool) { // holder. This also handles types like std::shared_ptr and std::unique_ptr where T is a // derived type (through those holder's implicit conversion from derived class holder // constructors). -template >::value, int> - = 0> +template < + typename Class, + detail::enable_if_t, pybindit::memory::smart_holder>::value, int> + = 0> void construct(value_and_holder &v_h, Holder holder, bool need_alias) { PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(need_alias); auto *ptr = holder_helper>::get(holder); @@ -200,10 +201,11 @@ void construct(value_and_holder &v_h, Alias &&result, bool) { v_h.value_ptr() = new Alias(std::move(result)); } -template >, - detail::enable_if_t>::value, int> - = 0> +template < + typename Class, + typename D = std::default_delete>, + detail::enable_if_t, pybindit::memory::smart_holder>::value, int> + = 0> void construct(value_and_holder &v_h, std::unique_ptr, D> &&unq_ptr, bool need_alias) { PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(need_alias); auto *ptr = unq_ptr.get(); @@ -223,10 +225,11 @@ void construct(value_and_holder &v_h, std::unique_ptr, D> &&unq_ptr, v_h.type->init_instance(v_h.inst, &smhldr); } -template >, - detail::enable_if_t>::value, int> - = 0> +template < + typename Class, + typename D = std::default_delete>, + detail::enable_if_t, pybindit::memory::smart_holder>::value, int> + = 0> void construct(value_and_holder &v_h, std::unique_ptr, D> &&unq_ptr, bool /*need_alias*/) { @@ -238,9 +241,10 @@ void construct(value_and_holder &v_h, v_h.type->init_instance(v_h.inst, &smhldr); } -template >::value, int> - = 0> +template < + typename Class, + detail::enable_if_t, pybindit::memory::smart_holder>::value, int> + = 0> void construct(value_and_holder &v_h, std::shared_ptr> &&shd_ptr, bool need_alias) { PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(need_alias); auto *ptr = shd_ptr.get(); @@ -254,9 +258,10 @@ void construct(value_and_holder &v_h, std::shared_ptr> &&shd_ptr, boo v_h.type->init_instance(v_h.inst, &smhldr); } -template >::value, int> - = 0> +template < + typename Class, + detail::enable_if_t, pybindit::memory::smart_holder>::value, int> + = 0> void construct(value_and_holder &v_h, std::shared_ptr> &&shd_ptr, bool /*need_alias*/) {