Programming Tecniques, Tools and Languages Group

Lambdas

ConceptGCC with lambdas

This page describes a partial implementation of the C++ standards proposal N2550: "Lambda Expressions and Closures," by Jaakko Järvi, John Freeman, and Lawrence Crowl.

Example

The implementation currently supports the following features of the proposal:

1std::transform (begin, end, result
2  <> (3int n) 4 : [5&s 6= sum] 7(s += n, '0' + (s % 10))
);
  1. Lambda expressions are usable with the std::CallableN class of concepts.
  2. A lambda function can be defined wherever a primary-expression is expected.
  3. Argument types must be explicitly specified.
  4. Return types are deducable and thus, may be omitted.
  5. Each external reference and its storage mechanism must be explicitly declared. An unadorned name means by-copy; an ampersand (&) means by-reference.
  6. Initializer expressions, which are not part of the proposal (yet), are supported.
  7. The body may be either a parenthesized-expression, enabling return type deduction, or a compound-statement, disabling it.

Bugs (and fixes)

Download

sourcethrough svn at https://svn.osl.iu.edu/svn/hlo/branches/lambdas

Installation

Download the source. $ svn co https://svn.osl.iu.edu/svn/hlo/branches/lambdas
$ ls
lambdas/
Make a build directory and change into it. $ mkdir build
$ cd build
Configure. Popular options include --prefix (for installation directory) and --enable-languages (to avoid building unused parts). $ ../gcc/configure --prefix="$PWD/../install" --enable-languages=c++
Build. This can be parallelized. $ make -j 4
Install. $ make install

Headlines

About Us | Site Map | Privacy Policy | Contact Us | ©2007 Texas A&M University