Allow copy policy in smart holder caster for shared_ptr

This commit is contained in:
Jakob Lykke Andersen 2021-06-16 15:42:51 +02:00 committed by Ralf W. Grosse-Kunstleve
parent 2934913761
commit c807807c55

View File

@ -629,6 +629,7 @@ struct smart_holder_type_caster<std::shared_ptr<T>> : smart_holder_type_caster_l
static handle cast(const std::shared_ptr<T> &src, return_value_policy policy, handle parent) { static handle cast(const std::shared_ptr<T> &src, return_value_policy policy, handle parent) {
if (policy != return_value_policy::automatic if (policy != return_value_policy::automatic
&& policy != return_value_policy::reference_internal && policy != return_value_policy::reference_internal
&& policy != return_value_policy::copy
&& policy != return_value_policy::automatic_reference) { && policy != return_value_policy::automatic_reference) {
// SMART_HOLDER_WIP: IMPROVABLE: Error message. // SMART_HOLDER_WIP: IMPROVABLE: Error message.
throw cast_error("Invalid return_value_policy for shared_ptr."); throw cast_error("Invalid return_value_policy for shared_ptr.");