From 7aad1b79fee15c3f0277484ffa9ac37e134a4b71 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 2 Aug 2024 09:07:30 -0700 Subject: [PATCH] native_proto_caster.h: Add `*_with_smart_holder_support_enabled` specializations. The * `copyable_holder_caster_shared_ptr_with_smart_holder_support_enabled` and * `move_only_holder_caster_unique_ptr_with_smart_holder_support_enabled` SFINAE helpers were introduced with https://github.com/pybind/pybind11/pull/5257. They need to be specialized here (`std::false_type`) because native_proto_caster.h has its own specializations for * `copyable_holder_caster>` and * `move_only_holder_caster>`. PiperOrigin-RevId: 658807442 --- pybind11_protobuf/native_proto_caster.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pybind11_protobuf/native_proto_caster.h b/pybind11_protobuf/native_proto_caster.h index dfdce39..cf87a83 100644 --- a/pybind11_protobuf/native_proto_caster.h +++ b/pybind11_protobuf/native_proto_caster.h @@ -91,6 +91,20 @@ struct type_caster< : public pybind11_protobuf::proto_caster< ProtoType, pybind11_protobuf::native_cast_impl> {}; +#if defined(PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT) + +template +struct copyable_holder_caster_shared_ptr_with_smart_holder_support_enabled< + ProtoType, enable_if_t::value>> + : std::false_type {}; + +template +struct move_only_holder_caster_unique_ptr_with_smart_holder_support_enabled< + ProtoType, enable_if_t::value>> + : std::false_type {}; + +#endif // PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT + // NOTE: If smart_holders becomes the default we will need to change this to // type_caster, ... // Until then using that form is ambiguous due to the existing specialization