[C++-sig] How to make use of -> (dereferncing) operator in pyplusplus

Roman Yakovenko roman.yakovenko at gmail.com
Wed Apr 14 09:41:28 CEST 2010


On Wed, Apr 14, 2010 at 10:25 AM, vishal bayskar
<vishal.bayskar at nechclst.in> wrote:
>
> Hi I have a requirement of using dereferencing pointer, like in the below
> code
>
>...
>
> Below warnings displayed. Looking at warnings it seems like operator -> is
> not supported in pyplusplus.
>
> If operator -> is not supported then what is the mechanism for using it?
> ...

You should not export export "SmartPtr" class as is. You can "teach"
Boost.Python to understand that an object is the instance of SmartPtr
class and it will handle for you and your users "operator*" and
"operator->".

The following example (
http://language-binding.net/pyplusplus/troubleshooting_guide/smart_ptrs/smart_ptrs.html
) should help you. Also, in the past there were a lot of discussions
on this subject, so using Google will definitely help.

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/


More information about the Cplusplus-sig mailing list