fix build failure by introducing init_instance() specialization for smart_holder (test fails)

This commit is contained in:
Ralf W. Grosse-Kunstleve 2024-06-29 12:13:19 -07:00
parent 97a3a49678
commit 00a91571fb

View File

@ -1954,6 +1954,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 <typename H = holder_type,
detail::enable_if_t<!std::is_same<H, pybindit::memory::smart_holder>::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()) {
@ -1963,6 +1966,12 @@ private:
init_holder(inst, v_h, (const holder_type *) holder_ptr, v_h.value_ptr<type>());
}
template <typename H = holder_type,
detail::enable_if_t<std::is_same<H, pybindit::memory::smart_holder>::value, int> = 0>
static void init_instance(detail::instance * /*inst*/, const void * /*holder_ptr*/) {
// detail::type_caster<T>::template init_instance_for_type<T, A>(inst, holder_ptr);
}
/// Deallocates an instance; via holder, if constructed; otherwise via operator delete.
static void dealloc(detail::value_and_holder &v_h) {
// We could be deallocating because we are cleaning up after a Python exception.