C++ BOOST The Boost Lambda Library

The Boost Lambda Library is free software; Permission to copy, use, modify and distribute this software and its documentation is granted, provided this copyright notice appears in all copies.


Table of Contents

1. In a nutshell
2. Getting Started
2.1. Installing the library
2.2. Conventions used in this document
3. Introduction
3.1. Motivation
3.2. Introduction to lambda expressions
4. Using the library
4.1. Introductory Examples
4.2. Parameter and return types of lambda functors
4.3. About actual arguments to lambda functors
4.4. Storing bound arguments in lambda functions
5. Lambda expressions in details
5.1. Placeholders
5.2. Operator expressions
5.3. Bind expressions
5.4. Overriding the deduced return type
5.5. Delaying constants and variables
5.6. Lambda expressions for control structures
5.7. Exceptions
5.8. Construction and destruction
5.9. Special lambda expressions
5.10. Casts, sizeof and typeid
5.11. Nesting STL algorithm invocations
6. Extending return type deduction system
7. Practical considerations
7.1. Performance
7.2. About compiling
7.3. Portability
8. Relation to other Boost libraries
8.1. Boost Function
8.2. Boost Bind
9. Contributors
A. Rationale for some of the design decisions
1. Lambda functor arity
Bibliography

1. In a nutshell

Boost Lambda Library(°Ê¹ß BLL )¤Ï C++ ¤Ë¤ª¤¤¤Æ¤Î ¦ËÃê¾Ý¤ò¼ÂÁõ¤·¤¿ C++ ¤Î¥Æ¥ó¥×¥ì¡¼¥È¥é¥¤¥Ö¥é¥ê¤Ç¤¢¤ë¡£ ¤³¤Î¸ÀÍդϴؿô·¿¸À¸ì¤ä¦Ë·×»»¤ËͳÍ褷¡¢¤½¤³¤Ç¤Ï¦ËÃê¾Ý¤Ï̵̾¤Î´Ø¿ô¤òÄêµÁ¤¹¤ë¡£ BLL¤Î¼ç¤Êưµ¡¤ÏSTL¤Î¥¢¥ë¥´¥ê¥º¥à¤Î¤¿¤á¤Î̵̾¤Î´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤òÄêµÁ¤¹¤ë½ÀÆð¤Ç´ÊÊØ¤ÊÊýË¡¤òÄ󶡤¹¤ë¤³¤È¤Ç¤¢¤ë¡£ ¤³¤Î¥é¥¤¥Ö¥é¥ê¤¬¤É¤ó¤Ê¤â¤Î¤Ç¤¢¤ë¤«¤Ï¡¢¸ÀÍÕ¤òʤ٤¿¤Æ¤ë¤è¤ê´Êñ¤Ê¥³¡¼¥É¤ò¸«¤ë¤Û¤¦¤¬Íý²ò¤·¤ä¤¹¤¤¡£ ¼¡¤Î°ì¹Ô¤Ï¤¢¤ëSTL¥³¥ó¥Æ¥Ê a ¤ÎÍ×ÁǤò¶õÇò¤Ç¶èÀڤäƽÐÎϤ¹¤ë¡£

for_each(a.begin(), a.end(), std::cout << _1 << ' ');
std::cout << _1 << ' '¤Ïñ¹à´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤òÄêµÁ¤·¤Æ¤¤¤ë¡£ ÊÑ¿ô_1¤Ï¤³¤Î´Ø¿ô¤Î²¾°ú¿ô¤Ç¤¢¤ê¡¢¼Â°ú¿ô¤Î¤¿¤á¤Î¥×¥ì¡¼¥¹¥Û¥ë¥À¡¼¤Ç¤¢¤ë¡£ for_each¤Î·«¤êÊÖ¤·¤Î¤¿¤Ó¤Ë¡¢¤³¤Î´Ø¿ô¤Ïa¤Î°ì¤Ä¤ÎÍ×ÁǤò¼Â°ú¿ô¤È¤·¤Æ¸Æ½Ð¤µ¤ì¤ë¡£ ¤³¤Î¼Â°ú¿ô¤Ï¥×¥ì¡¼¥¹¥Û¥ë¥À¡¼¤È¤·¤ÆÃê¾Ý²½¤µ¤ì¡¢¤³¤Î´Ø¿ô¤Î ‘ËÜÂÎ’ ¤¬É¾²Á¤µ¤ì¤ë¡£

BLL¤ÎËܼÁ¤Ï¾å¤Ë¤¢¤²¤¿¤è¤¦¤Ê¾®¤µ¤Ê̵̾¤Î´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤ò¡¢STL¥¢¥ë¥´¥ê¥º¥à¤ò¸Æ½Ð¤¹¼°¤ÎÃæ¤ÇľÀÜÄêµÁ¤¹¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë¤³¤È¤Ç¤¢¤ë¡£