File tree 1 file changed +3
-2
lines changed 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -1669,11 +1669,12 @@ T cast(const handle &handle) { return T(reinterpret_borrow<object>(handle)); }
1669
1669
template <typename T, detail::enable_if_t <!detail::is_pyobject<T>::value, int > = 0 >
1670
1670
object cast (T &&value, return_value_policy policy = return_value_policy::automatic_reference,
1671
1671
handle parent = handle()) {
1672
+ using no_ref_T = typename std::remove_reference<T>::type;
1672
1673
if (policy == return_value_policy::automatic)
1673
- policy = std::is_pointer<T >::value ? return_value_policy::take_ownership :
1674
+ policy = std::is_pointer<no_ref_T >::value ? return_value_policy::take_ownership :
1674
1675
std::is_lvalue_reference<T>::value ? return_value_policy::copy : return_value_policy::move;
1675
1676
else if (policy == return_value_policy::automatic_reference)
1676
- policy = std::is_pointer<T >::value ? return_value_policy::reference :
1677
+ policy = std::is_pointer<no_ref_T >::value ? return_value_policy::reference :
1677
1678
std::is_lvalue_reference<T>::value ? return_value_policy::copy : return_value_policy::move;
1678
1679
return reinterpret_steal<object>(detail::make_caster<T>::cast (std::forward<T>(value), policy, parent));
1679
1680
}
You can’t perform that action at this time.
0 commit comments