Re: [pygccxml-development] Removing template default arguments?
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2008-08-26 12:41:01
|
On Tue, Aug 26, 2008 at 3:09 PM, Gustavo Carneiro <gjc...@gm...> wrote: > Thanks, Roman, it is indeed much faster now! :-) > > I have one more tricky question. I am getting this key_type: > > std::basic_string<char,std::char_traits<char>,std::allocator<char> > > [struct] > > Now, I know this is just a std::string type, but PyBindGen does not know > it. Is there any way to convert this into a simpler std::string -like > definition. That is because I register and lookup types by type expression > string, but if there are multiple definitions for the same type then things > won't match. > > Well, I guess one solution for me would be to register the > "std::basic_string<char, std::char_traits<char>, std::allocator<char> >" > type string alongside std::string, but if there's anything better to do I'll > take it. > > I guess this is a generic question. Given the simple test case I am working > on: > > std::map<std::string, int> > > pygccxml reads this as: > > std::map<std::basic_string<char, std::char_traits<char>, > std::allocator<char> >,int,std::less<std::basic_string<char, > std::char_traits<char>, std::allocator<char> > >>,std::allocator<std::pair<const std::basic_string<char, > std::char_traits<char>, std::allocator<char> >, int> > > > > Is there any easy way to just remove the template arguments that have the > same value as the template default template argument value? > > I am guessing the answer is no, but it doesn't hurt to ask :P Wrong guess: http://language-binding.net/pygccxml/apidocs/pygccxml.declarations.declaration.declaration_t-class.html#partial_name By the way, container_traits has "remove_defaults" functionality. Now, you know what it is for. This is a must functionality for a good code generator - the generated code should be as closed to "human written" as possible. HTH -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |