Boost Lambda Library

See http://www.boost.org/libs/lambda/doc/index.html

The Lambda Library (LL) adds a form of lambda abstraction to CeePlusPlus. The LL is implemented as a template library using standard C++; thus no language extensions or preprocessing is required. The LL consists of a rich set of tools for defining unnamed functions. Particularly, these unnamed functions work seamlessly with the StandardTemplateLibrary algorithms. The LL offers significant improvements, in terms of generality and ease of use, compared to the binders and functors in the C++ standard library.


The LL is implemented in standard C++.

VC++ 7.1 is pretty close to fully standard-compliant, and all of boost's unit tests are reported to work with it as of at least February 2004. Also, Comeau C++ was available earlier than VC++ 7.1, and very likely could compile LL applications also.

True. Microsoft replaced their pre-standard Dinkumware STL with a recent one. This went a long way toward making MS C++ compliant (not quite there yet, but who is?).

Comeau is arguably the most compliant compiler as it supports exporting templates.


Example:

  for_each( vec.start(), vec.end(), cout << _1 << ' ' );
to print each element in the vector 'vec', separated by a space. It does a lot of other cool things too.


The Lambda Library has been added to the BoostLibraries as of release 1.28.0 (May 2002).

The Lambda Library inspired BoostTupleLibrary was added to Boost in an earlier release.


See also: BoostPhoenixLibrary, FunctionalProgrammingLanguage, (GreenspunsTenthRuleOfProgramming) (ParkingTicket)

CppTemplateMetaprogramming (book) has some discussion of the BoostLambdaLibrary and the alternatives for use in C++.

See VariadicFunctoidsInCpp for an example incorporating BoostLambdaLibrary.


CategoryBoost CategoryCpp CategoryCppTemplates


EditText of this page (last edited September 28, 2010) or FindPage with title or text search