[C++-sig] def with name parser

Leonard "paniq" Ritter paniq at paniq.org
Thu Mar 10 10:19:07 CET 2005


hi everybody,

as a lazy programmer, i found the def("name",&func) convention a bit 
uncomfortable, since often name and func are the same name, so why not 
allow an alternate version of def that parses the function name?

there are several possibilities to do that, where the worst is
#define def_autoname(func) def(parse(#func),&func)
and a better one is
#define def_autoname(func) def(parse(typeid(func).name()),&func)

however i'm not a big fan of macros so i'd like to see this included 
natively in boost.python somewhere. is that possible, or do we run into 
cross platform issues with this?

best regards,
leonard




More information about the Cplusplus-sig mailing list