# Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world.

## Chapter 12. Boost.Lambda

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)

## In a nutshell

The Boost Lambda Library (BLL in the sequel) is a C++ template library, which implements a 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.

## Bibliography

[STL94] A. A. Stepanov and M. Lee. The Standard Template Library. Hewlett-Packard Laboratories. 1994.

[SGI02] The SGI Standard Template Library. 2002.

[C++98] International Standard, Programming Languages – C++. ISO/IEC:14882. 1998.

[Jär99] Lecture Notes in Computer Science. 1977. Springer. 2000.

[Jär00] The Lambda Library : Lambda Abstraction in C++. Turku Centre for Computer Science. Technical Report . 378. 2000.

[Jär01] The Lambda Library : Lambda Abstraction in C++. Second Workshop on C++ Template Programming. Tampa Bay, OOPSLA'01. . 2001.

[Jär03] Software - Practice and Expreience. 33:259-291. 2003.

[tuple] The Boost Tuple Library. 2002.

[type_traits] The Boost type_traits. 2002.

[ref] Boost ref. 2002.

[bind] Boost Bind Library. 2002.

[function] Boost Function Library. 2002.

[fc++] The FC++ library: Functional Programming in C++. 2002.

 Last revised: June 13, 2009 at 22:18:10 +0100
{"ft_lang_label":"__label__en","ft_lang_prob":0.6674373,"math_prob":0.643198,"size":2515,"snap":"2019-26-2019-30","text_gpt3_token_len":639,"char_repetition_ratio":0.13142174,"word_repetition_ratio":0.028328612,"special_character_ratio":0.26759443,"punctuation_ratio":0.21875,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9525051,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-07-23T00:56:20Z\",\"WARC-Record-ID\":\"<urn:uuid:80eb4a78-8114-460d-81e1-b5beb9583983>\",\"Content-Length\":\"16737\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:3c7e3ad6-dc41-4c15-b014-0a81a5a57054>\",\"WARC-Concurrent-To\":\"<urn:uuid:53fe5c62-d8b6-49be-8ed9-f359fa11ed90>\",\"WARC-IP-Address\":\"146.20.110.251\",\"WARC-Target-URI\":\"https://www.boost.org/doc/libs/1_47_0/doc/html/lambda.html\",\"WARC-Payload-Digest\":\"sha1:EQQPZ4BCQ6DSE3LJZV5LKUCRS7T3ZGHY\",\"WARC-Block-Digest\":\"sha1:JDN26ZARQCR34KLWLZGIAMRKDQ3YQVJM\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-30/CC-MAIN-2019-30_segments_1563195528635.94_warc_CC-MAIN-20190723002417-20190723024417-00197.warc.gz\"}"}