force explicit cast (fixes #130)

This commit is contained in:
Wenzel Jakob 2016-03-06 13:30:10 +01:00
parent 98e9210816
commit bce8a4b95c

View File

@ -567,7 +567,7 @@ template <typename T> inline T cast(handle handle) {
detail::type_caster<typename detail::intrinsic_type<T>::type> conv;
if (!conv.load(handle, true))
throw cast_error("Unable to cast Python object to C++ type");
return conv;
return (T) conv;
}
template <typename T> inline object cast(const T &value, return_value_policy policy = return_value_policy::automatic, handle parent = handle()) {