Fix optional dereference type deduction

This commit is contained in:
fatvlady 2020-03-14 15:20:04 +02:00 committed by Wenzel Jakob
parent a3daf87d45
commit 556277d689

View File

@ -266,7 +266,8 @@ template<typename T> struct optional_caster {
static handle cast(T_ &&src, return_value_policy policy, handle parent) {
if (!src)
return none().inc_ref();
policy = return_value_policy_override<typename T::value_type>::policy(policy);
using dereference_type = decltype(*std::forward<T_>(src));
policy = return_value_policy_override<dereference_type>::policy(policy);
return value_conv::cast(*std::forward<T_>(src), policy, parent);
}