[C++-sig] def with name parser
Stefan Seefeld
seefeld at sympatico.ca
Thu Mar 10 20:49:50 CET 2005
Leonard "paniq" Ritter wrote:
> as far as i see, the second method is also possible as a template, and
> using overloads multiple versions of that def can be supported
>
> here's the simplest case, bit of pseudo
>
> template <typename L, typename T>
> L& def_autoname(T func)
> {
> return def(parse(typeid(func).name()),func);
> }
There is no guarantee that typeid(func).name() == "func", with gcc it is not.
It is mangled, and so not what you want.
Stefan
More information about the Cplusplus-sig
mailing list