[C++-sig] Py++ and protected destructors

Roman Yakovenko roman.yakovenko at gmail.com
Thu Sep 17 11:30:59 CEST 2009


2009/9/17 Pertti Kellomäki <pertti.kellomaki at tut.fi>:
> Roman Yakovenko wrote:
>>
>> Before I modified the code, I suggest you to submit a small working
>> example which shows the problem, so we can solve the right problem.
>
> Ok, here's a distilled code example. Running
>
>  python dest.pypp && gcc -c -I/usr/include/python2.6 dest_bindings.cpp
>
> yields the error message
>
>  dest.hh:3: virhe: ”virtual A::~A()” is protected
>
> This is with the latest svn version of py++.

Okey. You should use "modify_type" function transformation with
"remove_const" type traits function.

Untested:

from pygccxml import declarations
from pyplusplus import module_builder
from pyplusplus import function_transformers as FT

mb = module_builder_( ... )
f = mb.mem_fun( 'f' )
f.add_transformation( FT.modify_type(0, declarations.remove_const ) )
#0 - argument index

HTH

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


More information about the Cplusplus-sig mailing list