3. Introduction
PrevŽ | Ž | Ž Next

## 3. Introduction

### 3.1. Motivation

¸½ºß¤Ç¤Ï C++ É¸½à¥é¥¤¥Ö¥é¥ê[C++98]¤Î°ìÉô¤È¤Ê¤Ã¤Æ¤¤¤ëÉ¸½à¥Æ¥ó¥×¥ì¡¼¥È¥é¥¤¥Ö¥é¥ê (STL)[STL94] ¤ÏÈÆÍÑ¤Î¥³¥ó¥Æ¥Ê¤È¥¢¥ë¥´¥ê¥º¥à¤Î¥é¥¤¥Ö¥é¥ê¤Ç¤¢¤ë¡£°ìÈÌÅª¤Ë¤Ï STL ¥¢¥ë¥´¥ê¥º¥à¤Ï¥³¥ó¥Æ¥Ê¤ÎÍ×ÁÇ¤ò´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤ò²ð¤·¤ÆÁàºî¤¹¤ë¡£¤³¤ì¤é¤Î´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤Ï¥¢¥ë¥´¥ê¥º¥à¤Ë°ú¿ô¤È¤·¤ÆÅÏ¤µ¤ì¤ë¡£

The Standard Template Library (STL) [STL94], now part of the C++ Standard Library [C++98], is a generic container and algorithm library. Typically STL algorithms operate on container elements via function objects. These function objects are passed as arguments to the algorithms.

´Ø¿ô¸Æ¤Ó½Ð¤·¤ÎÊ¸Ë¡¤Ë½¾¤Ã¤Æ¸Æ½Ð¤µ¤ì¤ë¤¤¤«¤Ê¤ë C++ ¤Î¹½Â¤¤â´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¢¤ë¡£ STL ¤Ë¤Ï¤¤¤¯¤Ä¤«¤Î¶¦ÄÌ¤ÎÍÑÅÓ¤Î¤¿¤á¤Î´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤¬¤¢¤é¤«¤¸¤áÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£(`plus`¡¢`less`¡¢`not1`¤Ê¤É¤¬¤¢¤ë¡£) Îã¤¨¤Ð¡¢`plus` ¤ÎÉ¸½àÅª¤Ê¼ÂÁõ¤Î°ì¤Ä¤Ï¼¡¤Î¤è¤¦¤Ë¤Ê¤ë¡£

    template <class T> : public binary_function<T, T, T>
    struct plus {
      T operator()(const T& i, const T& j) const {
        return i + j;
      }
    };

´ðÄì¥¯¥é¥¹¤Î `binary_function<T, T, T>` ¤Ë¤Ï¡¢´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤Î°ú¿ô¤ÈÊÖ¤êÃÍ¤Î·¿¤Î¤¿¤á¤Î typedef ¤¬Â¸ºß¤¹¤ë¡£¤½¤ì¤é¤Î typedef ¤Ï´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤òÅ¬¹ç¤µ¤»¤ë¤Î¤ËÉ¬Í×¤Ç¤¢¤ë¡£

Any C++ construct that can be called with the function call syntax is a function object. The STL contains predefined function objects for some common cases (such as `plus`, `less` and `not1`). As an example, one possible implementation for the standard `plus` template is:

    template <class T> : public binary_function<T, T, T>
    struct plus {
      T operator()(const T& i, const T& j) const {
        return i + j;
      }
    };

The base class `binary_function<T, T, T>` contains typedefs for the argument and return types of the function object, which are needed to make the function object adaptable.

¾å¤Ëµó¤²¤¿¤è¤¦¤Ê´ðËÜÅª¤Ê´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤Ë²Ã¤¨¤Æ¡¢Å¬¹çÆó¹à´Ø¿ô¤Î°ú¿ô¤Î°ì¤Ä¤òÄê¿ô¤ËÄê¤á¤ÆÃ±¹à´Ø¿ô¤òºî¤ë¤¿¤á¤Î binder ¥Æ¥ó¥×¥ì¡¼¥È¤âÂ¸ºß¤¹¤ë¡£ Îã¤¨¤Ð¡¢¼¡¤Î¤è¤¦¤Ê´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤òÌÀ¼¨Åª¤Ëµ½Ò¤·¤Ê¤¯¤È¤â `plus`¥Æ¥ó¥×¥ì¡¼¥È¤Èbinder¥Æ¥ó¥×¥ì¡¼¥È¤Î°ì¤Ä`bind1st`¤ò»ÈÍÑ¤·¤ÆÅù²Á¤Êµ¡Ç½¤ò¼Â¸½¤Ç¤¤ë¡£

    class plus_1 {
      int _i;
    public:
      plus_1(const int& i) : _i(i) {}
      int operator()(const int& j) { return _i + j; }
    };

°Ê²¼¤ÎÆó¤Ä¤Î¼°¤ÏÆ±°ì¤Î´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤¹¤ë¡£ ¤Ä¤Þ¤ê¡¢¸Æ½Ð¤µ¤ì¤¿¤È¤ÁÐÊý¤È¤â´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤Î°ú¿ô¤Ë`1`¤ò²Ã¤¨¤¿·ë²Ì¤òÊÖ¤¹¡£

    plus_1(1)
    bind1st(plus<int>(), 1)

¸å¤Î¼°¤ÎÉôÊ¬¼° `plus<int>()` ¤ÏÆó¤Ä¤ÎÀ°¿ô¤Î¹ç·×¤ò·×»»¤¹¤ëÆó¹à´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¢¤ë¡£¤½¤·¤Æ¡¢bind1st ¤Ï Âè°ì°ú¿ô¤òÉôÊ¬Åª¤Ë 1 ¤ËÂ«Çû¤·¤Æ¡¢¤³¤Î´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤ò¸Æ½Ð¤¹¡£ ¾åµ¤Î´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤Î»ÈÍÑÎã¤ò°Ê²¼¤ËÄó¼¨¤¹¤ë¡£°Ê²¼¤Î¥³¡¼¥É¤Ï¤¢¤ë¥³¥ó¥Æ¥Ê `a` ¤ÎÍ×ÁÇ¤Ë 1 ¤ò²Ã¤¨¤Æ¡¢¤½¤Î·ë²Ì¤òÉ¸½à½ÐÎÏ¥¹¥È¥ê¡¼¥à `cout` ¤Ø½ÐÎÏ¤¹¤ë¡£

    transform(a.begin(), a.end(), ostream_iterator<int>(cout),
              bind1st(plus<int>(), 1));

In addition to the basic function object classes, such as the one above, the STL contains binder templates for creating a unary function object from an adaptable binary function object by fixing one of the arguments to a constant value. For example, instead of having to explicitly write a function object class like:

    class plus_1 {
      int _i;
    public:
      plus_1(const int& i) : _i(i) {}
      int operator()(const int& j) { return _i + j; }
    };

the equivalent functionality can be achieved with the `plus` template and one of the binder templates (`bind1st`). E.g., the following two expressions create function objects with identical functionalities; when invoked, both return the result of adding `1` to the argument of the function object:

    plus_1(1)
    bind1st(plus<int>(), 1)

The subexpression `plus<int>()` in the latter line is a binary function object which computes the sum of two integers, and `bind1st` invokes this function object partially binding the first argument to `1`. As an example of using the above function object, the following code adds `1` to each element of some container `a` and outputs the results into the standard output stream `cout`.

    transform(a.begin(), a.end(), ostream_iterator<int>(cout),
              bind1st(plus<int>(), 1));

binder ¥Æ¥ó¥×¥ì¡¼¥È¤ò¤è¤ê°ìÈÌÅª¤ËÅ¬ÍÑ¤Ç¤¤ë¤è¤¦¤Ë¤¹¤ë¤¿¤á¤Ë¡¢STL ¤Ï´Ø¿ô¤Ø¤Î¥Ý¥¤¥ó¥¿¤ä»²¾È¡¢¥á¥ó¥Ð´Ø¿ô¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÅ¬¹ç²ÄÇ½¤Ë¤¹¤ë adaptors ¤òÄó¶¡¤·¤Æ¤¤¤ë¡£ To make the binder templates more generally applicable, the STL contains for making ¤µ¤é¤Ë¡¢É¸½à[SGI02]¤Î³ÈÄ¥¤È¤·¤Æ¡¢´Ø¿ô¤Î¹çÀ®Áàºî¤ò´Þ¤à STL ¤Î¼ÂÁõ¤â¤¢¤ë¡£

To make the binder templates more generally applicable, the STL contains adaptors for making pointers or references to functions, and pointers to member functions, adaptable. Finally, some STL implementations contain function composition operations as extensions to the standard [SGI02].

¤³¤ì¤é¤¹¤Ù¤Æ¤Î¼êÃÊ¤ÎÌÜÉ¸¤Ï°ì¤Ä¤Ç¤¢¤ë¡£ STL ¥¢¥ë¥´¥ê¥º¥à¤Î¸Æ½Ð¤·¤ÎÃæ¤ÇÌµÌ¾´Ø¿ô¤ò»ØÄê¤Ç¤¤ë¤è¤¦¤Ë¤¹¤ë¤³¤È¤Ç¤¢¤ë¡£ ¸À¤¤´¹¤¨¤ë¤È¡¢¥³¡¼¥É¤Î°ìÉô¤ò´Ø¿ô¤Ø¤Î°ú¿ô¤È¤·¤ÆÅÏ¤¹¤³¤È¤Ç¤¢¤ë¡£ ¤·¤«¤·¡¢¤³¤ÎÌÜÉ¸¤ÏÉôÊ¬Åª¤Ë¤·¤«¼Â¸½¤Ç¤¤Ê¤¤¡£ ¾å¤ÎÃ±½ã¤ÊÎã¤ò¸«¤Æ¤âÊ¬¤«¤ëÄÌ¤ê¡¢É¸½à¤Î¼êÃÊ¤òÍÑ¤¤¤¿ÌµÌ¾´Ø¿ô¤ÎÄêµÁ¤Ï°·¤¤¤Ë¤¯¤¤¡£ ¥Õ¥¡¥ó¥¯¥¿¤ä¡¢¥¢¥À¥×¥¿¡¢¥Ð¥¤¥ó¥À¤ä´Ø¿ô¹çÀ®Áàºî¤ò´Þ¤àÊ£»¨¤Ê¼°¤ÏÍý²ò¤·¤Ë¤¯¤¯¤Ê¤Ã¤Æ¤·¤Þ¤¦¡£ ¤½¤ì¤Ë²Ã¤¨¡¢É¸½à¤Î¼êÃÊ¤òÅ¬ÍÑ¤¹¤ë¤Î¤Ë½ÅÍ×¤ÊÀ©¸Â¤¬¤¢¤ë¡£ É¸½à¤Î¥Ð¥¤¥ó¥À¤Ç¤Ï¡¢Æó¹à´Ø¿ô¤Î°ú¿ô¤Î¤¦¤Á¤Î°ì¤Ä¤·¤«Â«Çû¤¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¡£ 3 °ú¿ô¡¢4 °ú¿ô¤È¤¤¤Ã¤¿ 3 ¤Ä°Ê¾å°ú¿ô¤ò¤È¤ë´Ø¿ô¤Î¤¿¤á¤Î¥Ð¥¤¥ó¥À¤¬Â¸ºß¤·¤Ê¤¤¤Î¤Ç¤¢¤ë¡£

All these tools aim at one goal: to make it possible to specify unnamed functions in a call of an STL algorithm, in other words, to pass code fragments as an argument to a function. However, this goal is attained only partially. The simple example above shows that the definition of unnamed functions with the standard tools is cumbersome. Complex expressions involving functors, adaptors, binders and function composition operations tend to be difficult to comprehend. In addition to this, there are significant restrictions in applying the standard tools. E.g. the standard binders allow only one argument of a binary function to be bound; there are no binders for 3-ary, 4-ary etc. functions.

Boost Lambda Library ¤Ï¾åµ¤Î¤è¤¦¤ÊÌäÂê¤ò²ò·è¤¹¤ë¡£

- Ä¾´ÑÅª¤ÊÊ¸Ë¡¤Ë¤è¤Ã¤Æ´ÊÃ±¤ËÌµÌ¾´Ø¿ô¤òºîÀ®¤Ç¤¤ë¡£ ¾åµ¤ÎÎã¤Ï¼¡¤Î¤è¤¦¤Ëµ½Ò¤Ç¤¤ë¡£

      transform(a.begin(), a.end(), ostream_iterator<int>(cout),
                1 + _1);

  ¤Þ¤¿¤Ï¡¢¤è¤êÄ¾´ÑÅª¤Ë

      for_each(a.begin(), a.end(), cout << (1 + _1));

- °ú¿ô¤ÎÂ«Çû¤Ë´Ø¤¹¤ë¤Û¤È¤ó¤É¤ÎÀ©¸Â¤Ï¤Ê¤¯¤Ê¤ê¡¢¼ÂºÝÅª¤Ë¤Ï C++ ¤Î¤¤¤«¤Ê¤ë´Ø¿ô¤Ç¤âÇ¤°Õ¤Î°ú¿ô¤òÂ«Çû¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£

- ´Ø¿ô¹çÀ®¤Ï°ÅÌÛÅª¤Ë¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤ë¤Î¤Ç¸Ä¡¹¤Î´Ø¿ô¹çÀ®Áàºî¤ÏÉÔÍ×¤Ç¤¢¤ë¡£

The Boost Lambda Library provides solutions for the problems described above:

- Unnamed functions can be created easily with an intuitive syntax. The above example can be written as:

      transform(a.begin(), a.end(), ostream_iterator<int>(cout),
                1 + _1);

  or even more intuitively:

      for_each(a.begin(), a.end(), cout << (1 + _1));

- Most of the restrictions in argument binding are removed, arbitrary arguments of practically any C++ function can be bound.

- Separate function composition operations are not needed, as function composition is supported implicitly.

### 3.2. Introduction to lambda expressions

¦Ë¼°¤Ï´Ø¿ô·¿¸À¸ì¤Ë¤ª¤¤¤Æ¤Ï°ìÈÌÅª¤Ê¤â¤Î¤Ç¤¢¤ë¡£ ¤½¤ÎÊ¸Ë¡¤Ï¸À¸ì¤Ë¤è¤Ã¤ÆÍÍ¡¹¤Ç¤¢¤ë¡£(¦Ë·×»»¤Î·Á¼°¤Ë¤è¤Ã¤Æ¤â°Û¤Ê¤ë) ¤·¤«¤·¡¢¦Ë¼°¤Î´ðËÜÅª¤Ê·Á¤Ï¼¡¤Î¤è¤¦¤Ç¤¢¤ë¡£
Lambda expression are common in functional programming languages. Their syntax varies between languages (and between different forms of lambda calculus), but the basic form of a lambda expressions is:

    lambda x1 ... xn.e

¦Ë¼°¤ÏÌµÌ¾´Ø¿ô¤òÄêµÁ¤·¡¢¼¡¤Î¤è¤¦¤Ë¹½À®¤µ¤ì¤ë¡£

- ¤³¤Î´Ø¿ô¤Î²¾°ú¿ô : `x1 ... xn`.

- ²¾°ú¿ô¤«¤é´Ø¿ô¤ÎÃÍ¤ò·×»»¤¹¤ë¼° e `x1 ... xn`.

A lambda expression defines an unnamed function and consists of:

- the parameters of this function: `x1 ... xn`.

- the expression e which computes the value of the function in terms of the parameters `x1 ... xn`.

¦Ë¼°¤Î´ÊÃ±¤ÊÎã¤òµó¤²¤ë¤È¡¢

    lambda x y.x+y

¦Ë´Ø¿ô¤òÅ¬ÍÑ¤¹¤ë¤È¤Ï¡¢·Á¼°Åª¤Ê°ú¿ô¤ò¼ÂºÝ¤Î°ú¿ô¤ÇÃÖ¤´¹¤¨¤ë¤³¤È¤Ç¤¢¤ë¡£

    (lambda x y.x+y) 2 3 = 2 + 3 = 5

A simple example of a lambda expression is

    lambda x y.x+y

Applying the lambda function means substituting the formal parameters with the actual arguments:

    (lambda x y.x+y) 2 3 = 2 + 3 = 5

C++ ¤Ë¤ª¤±¤ë¦Ë¼°¤Ç¤Ï¡¢`lambda x1 ... xn` ¤È¤¤¤¦ÉôÊ¬¤¬¤Ê¤¯¡¢ ·Á¼°Åª¤Ê°ú¿ô¤ÏÍ½¤á·è¤á¤é¤ì¤¿Ì¾Á°¤ò»ý¤Ã¤Æ¤¤¤ë¡£ ¸½ºß¤Î¥é¥¤¥Ö¥é¥ê¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï¡¢ ¥×¥ì¡¼¥¹¥Û¥ë¥À¤È¸Æ¤Ð¤ì¤ë¤³¤Î¤è¤¦¤ÊÍ½¤á·è¤á¤é¤ì¤¿·Á¼°Åª¤Ê°ú¿ô¤¬»°¤Ä¤¢¤ë¡£ `_1` ¤È `_2` ¤È `_3`. ¤Ç¤¢¤ë¡£ ¤½¤ì¤¾¤ì¦Ë¼°¤Ç´Ø¿ôÄêµÁ¤µ¤ì¤¿´Ø¿ô¤ÎÂè°ì¡¢ÂèÆó¡¢Âè»°°ú¿ô¤ò¼¨¤¹¡£ Îã¤¨¤Ð¡¢

    lambda x y.x+y

¤Î C++ ¤Ë¤ª¤±¤ëÄêµÁ¤Ï

    _1 + _2

¤È¤Ê¤ë¡£

In the C++ version of lambda expressions the `lambda x1 ... xn` part is missing and the formal parameters have predefined names. In the current version of the library, there are three such predefined formal parameters, called placeholders: `_1`, `_2` and `_3`. They refer to the first, second and third argument of the function defined by the lambda expression. For example, the C++ version of the definition

    lambda x y.x+y

is

    _1 + _2

¤è¤Ã¤Æ¡¢C++¤Î¦Ë¼°¤Ë¤ÏÊ¸Ë¡Åª¤Ê¥¡¼¥ï¡¼¥É¤ÏÂ¸ºß¤·¤Ê¤¤¡£ ¥ª¥Ú¥é¥ó¥É¤È¤·¤Æ¥×¥ì¡¼¥¹¥Û¥ë¥À¡¼¤Î»È¤¹¤ë¤³¤È¤Ï¡¢¤³¤Î±é»»»Ò¤Î¸Æ½Ð¤·¤Ï¦Ë¼°¤Ç¤¢¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ ¤·¤«¤·¡¢¤³¤ì¤Ï±é»»»Ò¤Î¸Æ½Ð¤·¤Ë´Ø¤·¤Æ¤Î¤ßÀµ¤·¤¤¡£ ´Ø¿ô¸Æ½Ð¤·¤ä¡¢Áàºî¹½Â¤¡¢¥¥ã¥¹¥È¤Ê¤É¤¬´Þ¤Þ¤ì¤¿¦Ë¼°¤Ï¡¢ÆÃÊÌ¤ÊÊ¸Ë¡Åª¹½Â¤¤¬É¬Í×¤È¤Ê¤ë¡£ ¤µ¤é¤Ë½ÅÍ×¤Ê¤³¤È¤Ë¤Ï¡¢´Ø¿ô¸Æ½Ð¤·¤ÏÆâÉô¤Ç¤Ï¡¢´Ø¿ô `boost::bind` ¤Ç¥é¥Ã¥×¤µ¤ì¤ëÉ¬Í×¤¬¤¢¤ë¡£ Îã¤¨¤Ð¡¢ `foo(_1, _2)` ¤Ç¤Ï¤Ê¤¯¡¢

    lambda x y.foo(x,y)

¤È¤¤¤¦¦Ë¼°¤ò¹Í¤¨¤Æ¤ß¤ë¡£ ¤³¤Î¼°¤ËÂÐ±þ¤¹¤ë C++ ¤Î¼°¤Ï¡¢

    bind(foo, _1, _2)

¤È¤Ê¤ë¡£ ¤³¤Î¼ï¤Î¦Ë¼°¤òbind expressions¤È¸Æ¤Ö¤³¤È¤Ë¤¹¤ë¡£

¦Ë¼°¤Ï C++ ¤Î´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤òÄêµÁ¤¹¤ë¡£¤è¤Ã¤Æ¡¢´Ø¿ôÅ¬ÍÑ¤ÎÊ¸Ë¡¤ÏÂ¾¤Î´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤Î¸Æ½Ð¤·¤ÈÆ±ÍÍ¤Ç¤¢¤ë¡£ ¤¹¤Ê¤ï¤Á¡¢`(_1 + _2)(i, j)` ¤è¤¦¤Ê·Á¤Ç¤¢¤ë¡£

Hence, there is no syntactic keyword for C++ lambda expressions. The use of a placeholder as an operand implies that the operator invocation is a lambda expression. However, this is true only for operator invocations. Lambda expressions containing function calls, control structures, casts etc. require special syntactic constructs. Most importantly, function calls need to be wrapped inside a `bind` function. As an example, consider the lambda expression:

    lambda x y.foo(x,y)

Rather than `foo(_1, _2)`, the C++ counterpart for this expression is:

    bind(foo, _1, _2)

We refer to this type of C++ lambda expressions as bind expressions.

A lambda expression defines a C++ function object, hence function application syntax is like calling any other function object, for instance: `(_1 + _2)(i, j)`.

#### 3.2.1. Partial function application

´Ø¿ô boost::bind ¤Ï¼Â¼Á¾åÉôÊ¬´Ø¿ôÅ¬ÍÑ¤Ç¤¢¤ë¡£ ÉôÊ¬´Ø¿ôÅ¬ÍÑ¤Ç¤Ï¡¢´Ø¿ô¤Î°ú¿ô¤Î¤¤¤¯¤Ä¤«¤òÄê¿ô¤ØÂ«Çû¤¹¤ë¡£ Å¬ÍÑ¤Î·ë²Ì¤ÏÊÌ¤Ê´Ø¿ô¤Ç¤¢¤ë¡£¤½¤·¤Æ¡¢¤½¤Î´Ø¿ô¤Î°ú¿ô¤Ï¤ª¤½¤é¤¯¸µ¤Î´Ø¿ô¤è¤ê¤â¾¯¤Ê¤¤¡£ Â«Çû¤µ¤ì¤Æ¤¤¤Ê¤¤°ú¿ô¤ò¤È¤â¤Ê¤Ã¤Æ¸Æ½Ð¤µ¤ì¤¿¤È¤¡¢¤³¤Î¿·¤·¤¤´Ø¿ô¤ÏÂ«Çû¤µ¤ì¤¿°ú¿ô¤È¤½¤¦¤Ç¤Ê¤¤°ú¿ô¤È¤ò¤Þ¤È¤á¤Æ¸µ¤Î´Ø¿ô¤ò¸Æ½Ð¤¹¡£

A bind expression is in effect a partial function application. In partial function application, some of the arguments of a function are bound to fixed values. The result is another function, with possibly fewer arguments. When called with the unbound arguments, this new function invokes the original function with the merged argument list of bound and unbound arguments.

#### 3.2.2. Terminology

¦Ë¼°¤Ï´Ø¿ô¤òÄêµÁ¤¹¤ë¡£C++ ¤Î¦Ë¼°¤ÏÉ¾²Á¤µ¤ì¤ë¤È¤¤Ë¡¢´°Á´¤Ë´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È(¥Õ¥¡¥ó¥¯¥¿)¤ò¹½ÃÛ¤¹¤ë¡£¤³¤Î¤è¤¦¤Ê´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤ò»Ø¤¹¤Î¤Ë¡¢¦Ë¥Õ¥¡¥ó¥¯¥¿ ¤È¤¤¤¦¸ÀÍÕ¤òÍÑ¤¤¤ë¡£ ¤è¤Ã¤Æ¡¢¤³¤Î¸ìË¡¤Ë½¾¤¨¤Ð¡¢¦Ë¼°¤ÎÉ¾²Á·ë²Ì¤Ï¦Ë¥Õ¥¡¥ó¥¯¥¿¤Ç¤¢¤ë¡£

A lambda expression defines a function. A C++ lambda expression concretely constructs a function object, a functor, when evaluated. We use the name lambda functor to refer to such a function object. Hence, in the terminology adopted here, the result of evaluating a lambda expression is a lambda functor.

PrevŽ | Up | Ž Next
2. Getting StartedŽ | Home | Ž 4. Using the library