This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Unnamed functions, functors or, more formally, function literals
This macro will return (something that is at least close to) an
anonymous function:
#define ANON(type, args, body) ({ type __anon__ args body; &__anon__; })
Example:
printf ("%d\n", ANON (int, (int x), { return x + 2; }) (x));
--
Lars Brinkhoff http://lars.nocrew.org/ Linux, GCC, PDP-10,
Brinkhoff Consulting http://www.brinkhoff.se/ HTTP programming