[C++-sig] Exposing c++ classes with static arrays using Boost.Python and py++

Roman Yakovenko roman.yakovenko at gmail.com
Thu May 4 07:25:10 CEST 2006


On 5/4/06, Abhi <abhi at qualcomm.com> wrote:
> While running py++ on a class with a static array inside it, py++ generates
> Boost.Python bindings using a derived class for the original C++ class.

>
>     pyplusplus::containers::static_sized::array_1_t< int, 10 >
>     pyplusplus_staticIntArray_wrapper(){
>         return pyplusplus::containers::static_sized::array_1_t< int, 10 >(
> staticIntArray );
>     }

I should make this function static and to take an instance as the
first argument.
Then generated code will work for derived classes too. I will fix it in few days

>
> Is there any drawback with just mapping the array variable to a global
> method rather than mapping the whole class.

Obviously, the generated code represents my understanding, preferences
and personal taste of how it should be done. In this specific case
py++ should mangle into function name: namespace name, class name,
variable name. Or it should create some
scope/namespace where IntArray will be unique name. Such scope already
exists - class
wrapper, so I reused it. Also the approach I choose, simplifies py++
code ( == less bugs ).

I will re-think my approach, if you will give 3 good reasons, why it
should be changed.
:-)


> thanks
> - Abhi


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



More information about the Cplusplus-sig mailing list