diff options
author | renatofilho <renato.filho@openbossa.org> | 2010-10-29 14:03:24 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:08:54 -0300 |
commit | 514544828d7b23cb7c78841a93a8ba30f2a9b830 (patch) | |
tree | 2b4bb4e36196b932683276feab5a9798ef574ebc /libshiboken/autodecref.h | |
parent | 0e0331dd62afb53005a08f2f5e22a631204110e6 (diff) |
Created utility function cast on AutoDecRef class.
Reviewer: Hugo Parente Lima <hugo.pl@gmail.com>
Marcelo Lira <marcelo.lira@openbossa.org>
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&); |