diff options
Diffstat (limited to 'libshiboken/autodecref.h')
-rw-r--r-- | libshiboken/autodecref.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libshiboken/autodecref.h b/libshiboken/autodecref.h index b9c5d29f0..20ed168d8 100644 --- a/libshiboken/autodecref.h +++ b/libshiboken/autodecref.h @@ -52,6 +52,12 @@ public: inline operator PyTupleObject*() { return reinterpret_cast<PyTupleObject*>(m_pyobj); } inline operator bool() const { return m_pyobj; } inline PyObject* operator->() { return m_pyobj; } + + template<typename T> + T cast() + { + return reinterpret_cast<T>(m_pyobj); + } private: PyObject* m_pyobj; AutoDecRef(const AutoDecRef&); |