2. Getting Started

2.1. Installing the library

¥é¥¤¥Ö¥é¥ê¤Ï¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë¤Î¤ß¤Ç¹½À®¤µ¤ì¤Æ¤¤¤ë¤¿¤á¡¢¥é¥¤¥Ö¥é¥ê¤òÍøÍѤ¹¤ë¤¿¤á¤ÎÆÃÊ̤ʼ곤­¤Ï¤Ê¤¤¡£ ¤¿¤À¤·¡¢boost ¤Î¥¤¥ó¥¯¥ë¡¼¥É¥Ç¥£¥ì¥¯¥È¥ê¤¬¥¤¥ó¥¯¥ë¡¼¥É¥Ñ¥¹¤Ë´Þ¤Þ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£ °Ê²¼¤Î¤è¤¦¤Ë°Û¤Ã¤¿µ¡Ç½¤òÄ󶡤¹¤ë¿ô¡¹¤Î¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤¹¤ë¡£
The library consists of include files only, hence there is no installation procedure. The boost include directory must be on the include path. There are a number of include files that give different functionality:

  • lambda/lambda.hpp ¤ÏÍÍ¡¹¤Ê C++ ¤Î±é»»»Ò¤Î¤¿¤á¤Î¦Ë¼°¤òÄêµÁ¤·¤Æ¤¤¤ë¡£¾Ü¤·¤¯¤ÏSection 5.2¤ò¸«¤è¡£
    lambda/lambda.hpp defines lambda expressions for different C++ operators, see Section 5.2.

  • lambda/bind.hpp ¤Ï9¸Ä¤Þ¤Ç¤Î°ú¿ô¤Î¤¿¤á¤Î boost::bind ´Ø¿ô¤òÄêµÁ¤·¤Æ¤¤¤ë¡£¾Ü¤·¤¯¤ÏSection 5.3¤ò¸«¤è¡£
    lambda/bind.hpp defines bind functions for up to 9 arguments, see Section 5.3.

  • lambda/if.hpp ¤Ï if ʸ¤ä¾ò·ï±é»»»Ò¤ÈÅù²Á¤Ê¦Ë´Ø¿ô¤òÄêµÁ¤·¤Æ¤¤¤ë¡£¾Ü¤·¤¯¤ÏSection 5.6¤ò¸«¤è¡£(lambda.hpp ¤â¸«¤ë¤³¤È¤òÁ¦¤á¤ë)¡£ lambda/if.hpp defines lambda function equivalents for if statements and the conditional operator, see Section 5.6 (includes lambda.hpp).

  • lambda/loops.hpp ¤Ï·«¤êÊÖ¤·¹½Â¤¤ÈÅù²Á¤Ê¦Ë´Ø¿ô¤òÄêµÁ¤·¤Æ¤¤¤ë¡£¾Ü¤·¤¯¤ÏSection 5.6¤ò¸«¤è¡£ lambda/loops.hpp defines lambda function equivalent for looping constructs, see Section 5.6.

  • lambda/switch.hpp ¤Ï switc ʸ¤ÈÅù²Á¤Ê¦Ë´Ø¿ô¤òÄêµÁ¤·¤Æ¤¤¤ë¡£¾Ü¤·¤¯¤ÏSection 5.6¤ò¸«¤è¡£ lambda/switch.hpp defines lambda function equivalent for the switch statement, see Section 5.6.

  • lambda/construct.hpp ¤Ï¥³¥ó¥¹¥È¥é¥¯¥¿¡¢¥Ç¥¹¥È¥é¥¯¥¿¡¢new ¤ä delete ¤ò¸Æ½Ð¤¹¦Ë¼°¤òµ­½Ò¤¹¤ë¥Ä¡¼¥ë¤òÄ󶡤·¤Æ¤¤¤ë¡£¾Ü¤·¤¯¤ÏSection 5.8¤ò¸«¤è¡£(lambda.hpp¤â¸«¤ë¤³¤È¤òÁ¦¤á¤ë)¡£ lambda/construct.hpp provides tools for writing lambda expressions with constructor, destructor, new and delete invocations, see Section 5.8 (includes lambda.hpp).

  • lambda/casts.hpp ¤Ï¦Ë´Ø¿ô¤Î¤¿¤á¤Î¡¢¥­¥ã¥¹¥È¤ä sizeof¡¢typeid ¤òÄêµÁ¤·¤Æ¤¤¤ë¡£¾Ü¤·¤¯¤ÏSection 5.10.1¤ò¸«¤è¡£
    lambda/casts.hpp provides lambda versions of different casts, as well as sizeof and typeid, see Section 5.10.1.

  • lambda/exceptions.hpp ¤Ï¦Ë´Ø¿ôÆâ¤Ç¤ÎÎã³°¤òÁ÷½Ð¤·¤¿¤ê¡¢Êä­¤¹¤ë¼êÃʤòÄ󶡤¹¤ë¡£¾Ü¤·¤¯¤ÏSection 5.7¤ò¸«¤è¡£(lambda.hpp¤ò´Þ¤à)
    lambda/exceptions.hpp gives tools for throwing and catching exceptions within lambda functions, Section 5.7 (includes lambda.hpp).

  • lambda/algorithm.hpp ¤È lambda/numeric.hpp (ɸ½à¥é¥¤¥Ö¥é¥ê¤Î algortihm ¤È numeric ¥Ø¥Ã¥À¤ò»²¾È ) ¤Ï¥Í¥¹¥È¤·¤¿ STL ¥¢¥ë¥´¥ê¥º¥à¤Î¸Æ¤Ó½Ð¤·¤ò²Äǽ¤Ë¤¹¤ë¡£¾Ü¤·¤¯¤ÏSection 5.11¤ò¸«¤è¡£
    lambda/algorithm.hpp and lambda/numeric.hpp (cf. standard algortihm and numeric headers) allow nested STL algorithm invocations, see Section 5.11.

°Ê¾å¤Ëµó¤²¤¿°Ê³°¤Î¥Ñ¥Ã¥±¡¼¥¸Æâ¤Î¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤ÏÆâÉôŪ¤Ë»ÈÍѤ·¤Æ¤¤¤ë¤â¤Î¤Ç¤¢¤ë¡£¹¹¤Ë¡¢lambda ¥é¥¤¥Ö¥é¥ê¤Ï Tuple [tuple] ¤È type_traits [type_traits] ¤ÎÆó¤Ä¤Î Boost ¥é¥¤¥Ö¥é¥ê¤Ë°Í¸¤·¤Æ¤¤¤ë¡£¤½¤·¤Æ¡¢boost/ref.hpp ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤Ë¤â°Í¸¤¹¤ë¡£

Any other header files in the package are for internal use. Additionally, the library depends on two other Boost Libraries, the Tuple [tuple] and the type_traits [type_traits] libraries, and on the boost/ref.hpp header.

Á´¤Æ¤ÎÄêµÁ¤Ï boost::lambda ¥Í¡¼¥à¥¹¥Ú¡¼¥¹¤È¤½¤Î¥µ¥Ö¥Í¡¼¥à¥¹¥Ú¡¼¥¹¤Ë°¤¹¤ë¡£
All definitions are placed in the namespace boost::lambda and its subnamespaces.

2.2. Conventions used in this document

¿¤¯¤Î¥³¡¼¥ÉÎã¤Ç¤Ï¡¢std ¤È boost::lambda ¤Î̾Á°¶õ´Ö¤Î̾Á°¤ÎÀÜÆ¬¼­¤ò¾Êά¤·¤Æ¤¤¤ë¡£¤½¤Î¤¿¤á»ö¼Â¾å°ÅÌÛŪ¤Ë¡¢

using namespace std;
using namespace boost::lambda;
¤È¤¤¤¦ÄêµÁ¤¬¤¢¤ë¤È²¾Äꤷ¤Æ¤¤¤ë¡£

2.2. Conventions used in this document

In most code examples, we omit the namespace prefixes for names in the std and boost::lambda namespaces. Implicit using declarations

using namespace std;
using namespace boost::lambda;
are assumed to be in effect.