This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
C++: Implement code transformation in parser or tree
- From: Sohail Somani <sohail at taggedtype dot net>
- To: gcc <gcc at gcc dot gnu dot org>
- Date: Tue, 07 Nov 2006 20:57:07 -0800
- Subject: C++: Implement code transformation in parser or tree
Hi,
I'm trying to implement proposal n1968 in g++ which basically adds
lambda functions to C++. The obvious way of implementing this is by a
simple translation which generates a function object which is created
where the lambda function is created. Something like:
for_each(b,e,<>(int & t){t++;});
would become:
struct __some_random_name
{
void operator()(int & t){t++;}
};
for_each(b,e,__some_random_name());
Would this require a new tree node like LAMBDA_FUNCTION or should the
parser do the translation? In the latter case, no new nodes should be
necessary (I think).
Thanks!
Sohail