Re: [pygccxml-development] [py++] vector of vectors trouble
Brought to you by:
mbaas,
roman_yakovenko
|
From: Roman Y. <rom...@gm...> - 2009-01-16 19:24:06
|
On Fri, Jan 16, 2009 at 3:45 PM, Maik Beckmann
<bec...@go...> wrote:
> Maik Beckmann schrieb am Freitag 16 Januar 2009 um 14:22:
>> The only statement I've found to get what I want is
>> vv = mb.class_('::std::vector< std::vector< double > >')
>> vv.rename('vvector_double')
>
> What I actually need for my code is to set an alias for
> vector<vector<double> const*>
> But
> vv = mb.class_('::std::vector< std::vector< double > const* >')
> fails. How is it done right?
Basically you have to spell the class name right.
Another work around could be to define "match" function:
def is_my_class( class_ ):
if not class_.name.startswith( 'vector' ):
return False
n = class_.name[ len('vector' ): ]
if 'vector' in n and 'double' in n and 'const' in n and '*' in n:
return True
return False
my_class = mb.class_( is_my_class )
But the prefered approach to this problem is described here:
http://language-binding.net/pyplusplus/documentation/how_to/hints.html
By the way, if you already have define to your class in C++, than
using type traits functionality could help:
from pygccxml import declarations:
mb = module_builder_t( ... )
typedef = mb.global_ns.typedef( '<<<your typedef>>>' )
my_class = declarations.class_traits.get_declaration( typedef )
HTH
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|