Skip to content

Commit

Permalink
Move try_initialization_using_shared_from_this into `PYBIND11_HAVE_…
Browse files Browse the repository at this point in the history
…INTERNALS_WITH_SMART_HOLDER_SUPPORT` block.
  • Loading branch information
rwgk committed Jul 20, 2024
1 parent 35b1177 commit 5566c63
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/pybind11/pybind11.h
Original file line number Diff line number Diff line change
Expand Up @@ -2204,6 +2204,8 @@ class class_ : public detail::generic_type {
init_holder(inst, v_h, (const holder_type *) holder_ptr, v_h.value_ptr<type>());
}

#ifdef PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT

template <typename WrappedType>
static bool try_initialization_using_shared_from_this(holder_type *, WrappedType *, ...) {
return false;
Expand All @@ -2229,7 +2231,6 @@ class class_ : public detail::generic_type {
return true;
}

#ifdef PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT
template <typename H = holder_type,
detail::enable_if_t<detail::is_smart_holder<H>::value, int> = 0>
static void init_instance(detail::instance *inst, const void *holder_const_void_ptr) {
Expand Down Expand Up @@ -2264,6 +2265,7 @@ class class_ : public detail::generic_type {
= pointee_depends_on_holder_owner;
v_h.set_holder_constructed();
}

#endif // PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT

/// Deallocates an instance; via holder, if constructed; otherwise via operator delete.
Expand Down

0 comments on commit 5566c63

Please sign in to comment.