This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Arbitrary function as template parameter?
- From: Lally Singh <death_to_nt at mac dot com>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 25 Sep 2003 20:21:20 -0400
- Subject: Arbitrary function as template parameter?
- Reply-to: lallysingh at mac dot com
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