diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 395ab732e..72b3a87fd 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -1525,7 +1525,11 @@ struct holder_helper { }; /// Type caster for holder types like std::shared_ptr, etc. -template +/// The SFINAE hook is provided to help work around the current lack of support +/// for smart-pointer interoperability. Please consider it an implementation +/// detail that may change in the future, as formal support for smart-pointer +/// interoperability is added into pybind11. +template struct copyable_holder_caster : public type_caster_base { public: using base = type_caster_base; @@ -1600,7 +1604,10 @@ protected: template class type_caster> : public copyable_holder_caster> { }; -template +/// Type caster for holder types like std::unique_ptr. +/// Please consider the SFINAE hook an implementation detail, as explained +/// in the comment for the copyable_holder_caster. +template struct move_only_holder_caster { static_assert(std::is_base_of, type_caster>::value, "Holder classes are only supported for custom types");