Home | Libraries | People | FAQ | More |
Copyright © 1999-2004 Jaakko Järvi, Gary Powell
Use, modification and distribution is subject to the Boost
Software License, Version 1.0. (See accompanying file
LICENSE_1_0.txt
or copy at http://www.boost.org/LICENSE_1_0.txt)
Table of Contents
The Boost Lambda Library (BLL in the sequel) is a C++ template
library, which implements form of lambda abstractions for C++.
The term originates from functional programming and lambda calculus, where a lambda abstraction defines an unnamed function.
The primary motivation for the BLL is to provide flexible and
convenient means to define unnamed function objects for STL algorithms.
In explaining what the library is about, a line of code says more than a thousand words; the
following line outputs the elements of some STL container
a
separated by spaces:
for_each(a.begin(), a.end(), std::cout << _1 << ' ');
The expression std::cout << _1 << ' '
defines a unary function object.
The variable _1
is the parameter of this function, a placeholder for the actual argument.
Within each iteration of for_each
, the function is
called with an element of a
as the actual argument.
This actual argument is substituted for the placeholder, and the “body” of the function is evaluated.
The essence of BLL is letting you define small unnamed function objects, such as the one above, directly on the call site of an STL algorithm.
[STL94] The Standard Template Library. Hewlett-Packard Laboratories. 1994. www.hpl.hp.com/techreports .
[SGI02] The SGI Standard Template Library. 2002. www.sgi.com/tech/stl/.
[Jär00] The Lambda Library : Lambda Abstraction in C++. Turku Centre for Computer Science. Technical Report . 378. 2000. www.tucs.fi/publications.
[Jär01] The Lambda Library : Lambda Abstraction in C++. Second Workshop on C++ Template Programming. Tampa Bay, OOPSLA'01. . 2001. www.oonumerics.org/tmpw01/.
[tuple] The Boost Tuple Library. www.boost.org/libs/tuple/doc/tuple_users_guide.html . 2002.
[type_traits] The Boost type_traits. www.boost.org/libs/type_traits/ . 2002.
[ref] Boost ref. www.boost.org/libs/bind/ref.html . 2002.
[bind] Boost Bind Library. www.boost.org/libs/bind/bind.html . 2002.
[function] Boost Function Library. www.boost.org/libs/function/ . 2002.
[fc++] The FC++ library: Functional Programming in C++. www.cc.gatech.edu/~yannis/fc++/ . 2002.
Last revised: November 29, 2006 at 19:28:48 GMT |