From aadc2f3d8c63c90c6fedda48001bbf75c868dbf2 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Tue, 3 May 2016 13:27:57 +0200 Subject: [PATCH] cast(): use cast_op_type mechanism --- include/pybind11/cast.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 64e6eeea4..a5ee2c5f7 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -764,10 +764,11 @@ public: NAMESPACE_END(detail) template inline T cast(handle handle) { - detail::type_caster::type> conv; + typedef detail::type_caster::type> type_caster; + type_caster conv; if (!conv.load(handle, true)) throw cast_error("Unable to cast Python object to C++ type"); - return (T) conv; + return conv.operator typename type_caster::template cast_op_type(); } template inline object cast(const T &value, return_value_policy policy = return_value_policy::automatic_reference, handle parent = handle()) {