Arbitrary function as template parameter?
Lally Singh
death_to_nt@mac.com
Fri Sep 26 02:56:00 GMT 2003
Hi. I'm writing a g++ extension to give more type information via a
'special' template type_description<>. Yeah, 'special' templates are
kludge-esque, but I was able to figure out how to do it this way faster
than via more __builtins.
I can do this:
struct foo {};
int i = std::type_description<foo>::is_pod;
But I can't do this:
int foo();
typename std::type_description<foo>::return_type val = foo();
As parser.c (while very readable) scares me, I'd rather not do any
changes to the grammar. So, can I declare a template to either take in
a type or a function, or at least another template that can take an
arbitrary function as a parameter?
--
Life is short, give up early.
--
Government is not reason, it is not eloquence, it is force; like fire,
a troublesome servant and a fearful master. Never for a moment should
it be left to irresponsible action.
- George Washington
More information about the Gcc
mailing list