From 2837df178e6fa30c5941f3ee18058baf130edda3 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 3 Jul 2024 10:49:17 -0700 Subject: [PATCH] Rename `holder` to `shared_ptr_holder` to improve readability. No functional changes. --- include/pybind11/cast.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 34d7178a3..ccf148106 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -857,8 +857,8 @@ public: // static_cast works around compiler error with MSVC 17 and CUDA 10.2 // see issue #2180 explicit operator type &() { return *(static_cast(this->value)); } - explicit operator std::shared_ptr *() { return std::addressof(holder); } - explicit operator std::shared_ptr &() { return holder; } + explicit operator std::shared_ptr *() { return std::addressof(shared_ptr_holder); } + explicit operator std::shared_ptr &() { return shared_ptr_holder; } static handle cast(const std::shared_ptr &src, return_value_policy policy, handle parent) { @@ -872,7 +872,7 @@ protected: bool load_value_shared_ptr(value_and_holder &&v_h) { if (v_h.holder_constructed()) { value = v_h.value_ptr(); - holder = v_h.template holder>(); + shared_ptr_holder = v_h.template holder>(); return true; } throw cast_error("Unable to cast from non-held to held instance (T& to Holder) " @@ -909,7 +909,8 @@ protected: copyable_holder_caster sub_caster(*cast.first); if (sub_caster.load(src, convert)) { value = cast.second(sub_caster.value); - holder = std::shared_ptr(sub_caster.holder, (type *) value); + shared_ptr_holder + = std::shared_ptr(sub_caster.shared_ptr_holder, (type *) value); return true; } } @@ -918,7 +919,7 @@ protected: static bool try_direct_conversions(handle) { return false; } - std::shared_ptr holder; + std::shared_ptr shared_ptr_holder; }; /// Specialize for the common std::shared_ptr, so users don't need to