Re: [pygccxml-development] Two patches proposal
Brought to you by:
mbaas,
roman_yakovenko
|
From: Berserker <ber...@ho...> - 2010-01-13 09:29:51
|
One more post about the "double registration" of std::pair in case of:
> boost::python::class_< std::map<std::string, int> >
> ("map_string_to_int")
> .def(boost::python::indexing::map_suite< std::map<std::string, int> >());
> boost::python::class_< boost::unordered_map<std::string, int> >
> ("unordered_map_string_to_int")
> .def(boost::python::indexing::map_suite< boost:unordered_map<std::string, int> >());
I "patched" the code in pair_header.py (redefining the global variable "code") in this way:
BEFORE THE PATCH:
pair_exposer_t(const std::string& name){
class_< pair_type >( name.c_str() )
.def( "__len__", &exposer_type::len )
.def( "__getitem__", &exposer_type::get_item )
.add_property( "key", &exposer_type::get_key )
.add_property( "value", &exposer_type::get_mapped );
}
AFTER THE PATCH:
pair_exposer_t(const std::string& name){
static bool expose = true;
if(expose)
{
class_< pair_type >( name.c_str() )
.def( "__len__", &exposer_type::len )
.def( "__getitem__", &exposer_type::get_item )
.add_property( "key", &exposer_type::get_key )
.add_property( "value", &exposer_type::get_mapped );
}
expose = false;
}
Probably there is a better way to implement this, but now it seems working :)
Let me know what's your opinion about this issue.
Bye
_________________________________________________________________
25 Gygabite gratis online. Archivia e condividi i tuoi file!
http://www.windowslive.it/skyDrive.aspx |