7. Practical considerations
PrevŽ | Ž | Ž Next

## 7. Practical considerations

### 7.1. Performance

É¸½à STL ¤Î´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤ä¥Ð¥¤¥ó¥À¤Î¥ª¡¼¥Ð¡¼¥Ø¥Ã¥É¤ÈÆ±ÍÍ¤Ë ÍýÏÀÅª¤Ë¤Ï STL ¥¢¥ë¥´¥ê¥º¥à ¤ä ¦Ë¥Õ¥¡¥ó¥¯¥¿¤Î»ÈÍÑ¤Ë¤è¤ë ¼ê½ñ¤Î¥ë¡¼¥×¤ÈÈæ³Ó¤·¤¿Á´¤Æ¤Î¥ª¡¼¥Ð¡¼¥Ø¥Ã¥É¤Ï ºÇÅ¬²½¤Ë¤è¤ê²ò¾Ã¤µ¤ì¤ë¡£ ¥³¥ó¥Ñ¥¤¥é¤Ë°ÍÂ¸¤·¤Æ¤¤¤ë¤â¤Î¤Î¡¢¤³¤ì¤Ï¼ÂºÝ¤ËÀµ¤·¤¤¡£ GCC 3.0.4 ¤ò»ÈÍÑ¤·¤Æ¡¢Intel Pentium 4 ¤Î 1.5 GHz ¤Î¥Þ¥·¥ó¾å¤Ç Æó¤Ä¤Î¥Æ¥¹¥È¤ò¹Ô¤Ê¤Ã¤¿¡£ºÇÅ¬²½¥Õ¥é¥°¤Ï -O3 ¤È¤·¤¿¡£

In theory, all overhead of using STL algorithms and lambda functors compared to hand written loops can be optimized away, just as the overhead from standard STL function objects and binders can. Depending on the compiler, this can also be true in practice. We ran two tests with the GCC 3.0.4 compiler on 1.5 GHz Intel Pentium 4. The optimization flag -03 was used.

ºÇ½é¤Î¥Æ¥¹¥È¤Ç¤Ï¡¢¦Ë¥Õ¥¡¥ó¥¯¥¿¤ÈÌÀ¼¨Åª¤Ë½ñ¤¤¤¿´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤òÈæ³Ó¤·¤¿¡£ ·«¤êÊÖ¤·¼«Ê¬¼«¿È¤ÎÃÍ¤ò¤«¤±¤ëÃ±¹à´Ø¿ô¤òÎ¾Êý¤Î·Á¤ÇÄêµÁ¤·¤¿¡£ ¹±Åù´Ø¿ô¤«¤é»Ï¤á¤Æ¡¢x5 ¤Þ¤Ç¹Ô¤Ê¤Ã¤¿¡£ ¤³¤Î¼°¤Ï `std::transform` ¤Î¥ë¡¼¥×¤ÎÆâÉô¤Ç¸Æ½Ð¤µ¤ì¡¢ ¤¢¤ë `std::vector<int>` ¤«¤é°ú¿ô¤òÆÉ¤ß½Ð¤·¡¢ ·ë²Ì¤òÊÌ¤Ê `std::vector<int>` ¤Ë³ÊÇ¼¤·¤¿¡£ vector ¤ÎÍ×ÁÇ¿ô¤Ï 100 ¤È¤·¤¿¡£ ¼Â¹Ô»þ´Ö¤Ï¡¢ Table 3 ¤Ë¼¨¤·¤Æ¤¢¤ë¡£ Æó¤Ä¤ÎÊýË¡¤ËÂç¤¤Êº¹¤Ï¤Ê¤¤¤³¤È¤¬Ê¬¤«¤ë¡£

In the first test we compared lambda functors against explicitly written function objects. We used both of these styles to define unary functions which multiply the argument repeatedly by itself. We started with the identity function, going up to x5. The expressions were called inside a `std::transform` loop, reading the argument from one `std::vector<int>` and placing the result into another. The length of the vectors was 100 elements. The running times are listed in Table 3. We can observe that there is no significant difference between the two approaches.

Æó¤ÄÌÜ¤Î¥Æ¥¹¥È¤Ç¤Ï¡¢100¸Ä¤ÎÍ×ÁÇ¤Î vector ¤Î³ÆÍ×ÁÇ¤ËÂÐ¤·¤ÆÁàºî¤ò¹Ô¤¦¤¿¤á¡¢ ºÆ¤Ó `std::transform` ¤ò»ÈÍÑ¤·¤¿¡£ º£²ó¤Ï¡¢vector ¤ÎÍ×ÁÇ¤Î·¿¤Ï `double` ¤Ç¤¢¤ê¡¢ Èó¾ï¤Ë´ÊÃ±¤Ê»»½Ñ¼°¤«¤é»Ï¤á¤Æ¡¢¾¯¤·¤º¤ÄÊ£»¨¤Ê¤â¤Î¤Ø¤È¤·¤Æ¤¤¤Ã¤¿¡£ ¼Â¹Ô»þ´Ö¤ò Table 4 ¤Ë¼¨¤¹¡£ ¤³¤³¤Ç¤Ï¡¢½¾Íè¤Î STL ¥¹¥¿¥¤¥ë¤ÎÌµÌ¾´Ø¿ô¤â¥Æ¥¹¥È¤Ë²Ã¤¨¤Æ¤¤¤ë¡£ ¤³¤ì¤é¤Î¼°¤Ï¤è¤êÊ£»¨¤Ë¤Ê¤ë¤¿¤áÄó¼¨¤·¤Ê¤¤¡£ Îã¤¨¤Ð¡¢ Table 4 ¤ÎºÇ¸å¤Î¼°¤Ï¡¢½¾Íè¤Î STL ¤ÎÊýË¡¤Çµ½Ò¤¹¤ë¤È¡¢ ¼·²ó¤Î `compose2` ¤Î¸Æ½Ð¤·¤È¡¢È¬²ó¤Î `bind1st` ¤Î¸Æ½Ð¤·¡¢ `multiplies`¡¢`minus`¡¢`plus` ¤Î¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½ÃÛ¤Ë ¹ç·×½½»Í²ó¤Î¥³¥ó¥¹¥È¥é¥¯¥¿¤Î¸Æ½Ð¤·¤ò´Þ¤à¤³¤È¤Ë¤Ê¤ë¡£ ¤³¤Î¥Æ¥¹¥È¤Ë¤ª¤¤¤Æ¤Ï¡¢ÂÐ±þ¤¹¤ë¼ê½ñ¤¤Î´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤ÈÈæ³Ó¤·¤Æ¡¢ BLL ¤Î¼°¤Ï¾¯¤·ÃÙ¤¤¡£(Âç¤Þ¤«¤Ë¸À¤Ã¤ÆÊ¿¶Ñ¤Ç 10%¡¢ºÇÂç¤Ç 14% ¤Û¤É) ½¾Íè¤Î STL ¤Î¼°¤Ç¤Ï¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤ÎÄã²¼¤Ï¤â¤¦¾¯¤·Âç¤¤¤¡£ °ìÈÖÃ±½ã¤Ê¼°¤Ç¤Ï 27% ¤Û¤É¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£

In the second test we again used `std::transform` to perform an operation to each element in a 100-element long vector. This time the element type of the vectors was `double` and we started with very simple arithmetic expressions and moved to more complex ones. The running times are listed in Table 4. Here, we also included classic STL style unnamed functions into tests. We do not show these expressions, as they get rather complex. For example, the last expression in Table 4 written with classic STL tools contains 7 calls to `compose2`, 8 calls to `bind1st` and altogether 14 constructor invocations for creating `multiplies`, `minus` and `plus` objects. In this test the BLL expressions are a little slower (roughly 10% on average, less than 14% in all cases) than the corresponding hand-written function objects. The performance hit is a bit greater with classic STL expressions, up to 27% for the simplest expressios.

¤³¤ì¤é¤Î¥Æ¥¹¥È¤«¤é¡¢BLL ¤Ï STL ¤Î´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤ÈÈæ³Ó¤·¤Æ ¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤ÎÄã²¼¤ò¾·¤¤¤Æ¤Ï¤¤¤Ê¤¤¡£ Å¬Åö¤ÊºÇÅ¬²½¥³¥ó¥Ñ¥¤¥é¤ò»ÈÍÑ¤¹¤ì¤Ð¡¢¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤ÎÆÃÀ¤Ï¡¢ ½¾Íè¤Î STL ¤ò»È¤Ã¤¿¤â¤Î¤ËÉ¤Å¨¤¹¤ë¤È»×¤ï¤ì¤ë¡£ ¤µ¤é¤Ë¡¢Ã±½ã¤Ê¼°¤Ç¤¢¤ì¤Ð¡¢ÌÀ¼¨Åª¤Ëµ½Ò¤·¤¿´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤Î¾ì¹ç¤Î ¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤Ë¶á¤¤¤È¹Í¤¨¤é¤ì¤ë¡£ ¤·¤«¤·¡¢¦Ë¥Õ¥¡¥ó¥¯¥¿¤ÎÉ¾²Á¤Ï¡¢¥¤¥ó¥é¥¤¥óÀë¸À¤µ¤ì¤¿¾®¤µ¤Ê´Ø¿ô¤Î¸Æ½Ð¤·¤Î Ï¢Â³¤Ç¤¢¤ë¤¿¤á¡¢¥³¥ó¥Ñ¥¤¥é¤¬¤½¤ì¤é¤Î¥¤¥ó¥é¥¤¥óÅ¸³«¤Ë¼ºÇÔ¤¹¤ë¤È¡¢ ¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤ÏÄã²¼¤¹¤ë¤À¤í¤¦¡£ ¤³¤¦¤Ê¤Ã¤¿¾ì¹ç¡¢¼Â¹Ô»þ´Ö¤ÏÆóÇÜ°Ê¾å¤Ë¤Ê¤ë¤«¤â¤·¤ì¤Ê¤¤¡£ ¾åµ¤Î¥Æ¥¹¥È¤Ï¤³¤Î¤è¤¦¤Ê¤³¤È¤¬È¯À¸¤¹¤ë¼°¤ò´Þ¤ó¤Ç¤¤¤Ê¤¤¤¬¡¢ °ì¸«¤¹¤ë¤ÈÃ±½ã¤Ê¼°¤Ç¡¢¤³¤Î¤è¤¦¤Ê¤³¤È¤Ë¤Ê¤Ã¤¿¤³¤È¤â¤¢¤ë¡£

The tests suggest that the BLL does not introduce a loss of performance compared to STL function objects. With a reasonable optimizing compiler, one should expect the performance characteristics be comparable to using classic STL. Moreover, with simple expressions the performance can be expected to be close to that of explicitly written function objects. Note however, that evaluating a lambda functor consist of a sequence of calls to small functions that are declared inline. If the compiler fails to actually expand these functions inline, the performance can suffer. The running time can more than double if this happens. Although the above tests do not include such an expression, we have experiensed this for some seemingly simple expressions.

Table 3. Test 1. ¦Ë¼°¤Çµ½Ò¤·¤¿À°¿ô¤Î¾è»»¤È ½¾Íè¤Î¼ê½ñ¤¤Î´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¥¯¥é¥¹¤Çµ½Ò¤·¤¿À°¿ô¤Î¾è»» ¤Î CPU »þ´Ö¤ÎÈæ³Ó¡£ ¼Â¹Ô»þ´Ö¤ÏÇ¤°Õ¤ÎÃ±°Ì¤ÇÉ½¸½¤·¤Æ¤¤¤ë¡£
Table 3. Test 1. CPU time of expressions with integer multiplication written as a lambda expression and as a traditional hand-coded function object class. The running times are expressed in arbitrary units.

expression | lambda expression | hand-coded function object
--- | --- | ---
x | 240 | 230
x*x | 340 | 350
x*x*x | 770 | 760
x*x*x*x | 1180 | 1210
x*x*x*x*x | 1950 | 1910

Table 4. Test 2. ¦Ë¼°¤Çµ½Ò¤·¤¿»»½Ñ¼°¤È¡¢ `compose2` ¤ä `bind1st` ¤Ê¤É¤ò»ÈÍÑ¤·¤¿½¾Íè¤Î STL ¤ÎÌµÌ¾´Ø¿ô¤Çµ½Ò¤·¤¿»»½Ñ¼°¤È¡¢ ½¾Íè¤Î¼ê½ñ¤¤Î´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¥¯¥é¥¹¤Çµ½Ò¤·¤¿»»½Ñ¼°¤Î CPU »þ´Ö¤ÎÈæ³Ó¡£ BLL ¤Î¸ÀÍÕ¤ò»ÈÍÑ¤¹¤ì¤Ð¡¢ `a` ¤È `b` ¤Ï¼°¤ÎÂ«ÇûÊÑ¿ô¤Ç¤¢¤ê¡¢`x` ¤Ï¼«Í³ÊÑ¿ô¤Ç¤¢¤ë¡£ Á´¤Æ¤ÎÊÑ¿ô¤Ï `double` ·¿¤Ç¤¢¤ë¡£ ¼Â¹Ô»þ´Ö¤ÏÇ¤°Õ¤ÎÃ±°Ì¤ÇÉ½¸½¤·¤Æ¤¤¤ë¡£
Table 4. Test 2. CPU time of arithmetic expressions written as lambda nexpressions, as classic STL unnamed functions (using `compose2`, `bind1st` etc.) and as traditional hand-coded function object classes. Using BLL terminology, `a` and `b` are bound arguments in the expressions, and `x` is open. All variables were of types `double`. The running times are expressed in arbitrary units.

expression | lambda expression | classic STL expression | hand-coded function object
--- | --- | --- | ---
ax | 330 | 370 | 290
-ax | 350 | 370 | 310
ax-(a+x) | 470 | 500 | 420
(ax-(a+x))(a+x) | 620 | 670 | 600
((ax) - (a+x))(bx - (b+x))(ax - (b+x))(bx - (a+x)) | 1660 | 1660 | 1460

½é´ü¤Î¥é¥¤¥Ö¥é¥ê¤ò»ÈÍÑ¤·¤¿¹¹¤Ê¤ë¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤Î¥Æ¥¹¥È¤Ï¡¢ [Jär00] ¤Ëµ½Ò¤·¤Æ¤¢¤ë¡£

Some additional performance testing with an earlier version of the library is described [Jär00].

### 7.2. About compiling

BLL ¤ÏÆ±¤¸¥Æ¥ó¥×¥ì¡¼¥È¤Î¿ôÂ¿¤¯¤ÎºÆµ¢Åª¤Ê¥¤¥ó¥¹¥¿¥ó¥¹²½¤ò¹Ô¤¦¤¿¤á¡¢ ¥Æ¥ó¥×¥ì¡¼¥È¤òÈó¾ï¤ËÂçÎÌ¤Ë»ÈÍÑ¤·¤Æ¤¤¤ë¡£ ¤³¤Î¤³¤È¤Ï(¾¯¤Ê¤¯¤È¤â)¼¡¤Î»°¤Ä¤Î¤³¤È¤ò°ÕÌ£¤·¤Æ¤¤¤ë¡£
The BLL uses templates rather heavily, performing numerous recursive instantiations of the same templates. This has (at least) three implications:

- Èó¾ï¤ËÊ£»¨¤Ê¦Ë¼°¤ò½ñ¤¯¤³¤È¤¬¤Ç¤¤Æ¤â¡¢ ¶²¤é¤¯¤½¤ì¤Ï¤¤¤¤¹Í¤¨¤Ç¤Ï¤Ê¤¤¡£ ¤½¤Î¤è¤¦¤Ê¦Ë¼°¤Î¥³¥ó¥Ñ¥¤¥ë¤Ë¤Ï¤¿¤¯¤µ¤ó¤Î¥á¥â¥ê¤òÉ¬Í×¤È¤·¡¢ ¥³¥ó¥Ñ¥¤¥ë¤¬ÃÙ¤¯¤Ê¤Ã¤Æ¤·¤Þ¤¦¤«¤â¤·¤ì¤Ê¤¤¡£

  While it is possible to write incredibly complex lambda expressions, it probably isn't a good idea. Compiling such expressions may end up requiring a lot of memory at compile time, and being slow to compile.

- Îã¤¨Ã±½ã¤Ê¦Ë¼°¤«¤éÀ¸À®¤µ¤ì¤¿¤È¤·¤Æ¤â¡¢¦Ë¥Õ¥¡¥ó¥¯¥¿¤Î·¿¤ÏÉÔ²Ä²ò¤Ç¤¢¤ë¡£ ÄÌ¾ï¥×¥í¥°¥é¥Þ¤Ï¦Ë¥Õ¥¡¥ó¥¯¥¿¤½¤Î¤â¤Î¤Î·¿¤ò°·¤¦É¬Í×¤ÏÁ´¤¯¤Ê¤¤¡£ ¤·¤«¤·¡¢¦Ë¼°Ãæ¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¤Ï¡¢ ÄÌ¾ï¥³¥ó¥Ñ¥¤¥é¤Ï´Ø·¸¤¹¤ë¦Ë¥Õ¥¡¥ó¥¯¥¿¤Î·¿¤ò½ÐÎÏ¤¹¤ë¡£ ÆÃ¤Ë¡¢¥³¥ó¥Ñ¥¤¥é¤¬°ìÏ¢¤Î¥Æ¥ó¥×¥ì¡¼¥È¤Î¥¤¥ó¥¹¥¿¥ó¥¹²½¤ÎÁ´¤Æ¤ò½ÐÎÏ¤¹¤ë¤È¡¢ ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤ÏÈó¾ï¤ËÄ¹¤¯¤Ê¤ê¡¢°ÕÌ£¤òÍý²ò¤¹¤ë¤³¤È¤¬Æñ¤·¤¯¤Ê¤ë¡£

  The types of lambda functors that result from even the simplest lambda expressions are cryptic. Usually the programmer doesn't need to deal with the lambda functor the types at all, but in the case of an error in a lambda expression, the compiler usually outputs the types of the lambda functors involved. This can make the error messages very long and difficult to interpret, particularly if the compiler outputs the whole chain of template instantiations.

- C++ É¸½à¤Ç¤Ï¡¢Ìµ¸ÂºÆµ¢¤Î¸¡½Ð¤Î¤¿¤á¤Ë¡¢ ¥Æ¥ó¥×¥ì¡¼¥È¤Î¥Í¥¹¥È¤Ï 17 ³¬ÁØ¤Þ¤Ç¤ÈÄó°Æ¤µ¤ì¤Æ¤¤¤ë¡£ Ê£»¨¤Ê¦Ë¥Æ¥ó¥×¥ì¡¼¥È¤Ï´ÊÃ±¤Ë¤³¤ÎÀ©¸Â¤ò±Û¤¨¤Æ¤·¤Þ¤¦¡£ Â¿¤¯¤Î¥³¥ó¥Ñ¥¤¥é¤Ï¤è¤ê¿¼¤¤¥Æ¥ó¥×¥ì¡¼¥È¤Î¥Í¥¹¥È¤òµö¤·¤Æ¤¤¤ë¤¬¡¢ °ìÈÌÅª¤Ë¤Ï¡¢ÌÀ¼¨Åª¤ËÀ©¸Â¤ò¾å¤²¤ë¥³¥Þ¥ó¥É¥é¥¤¥ó°ú¿ô¤òÉ¬Í×¤È¤¹¤ë¡£

  The C++ Standard suggests a template nesting level of 17 to help detect infinite recursion. Complex lambda templates can easily exceed this limit. Most compilers allow a greater number of nested templates, but commonly require the limit explicitly increased with a command line argument.

### 7.3. Portability

BLL ¤Ï°Ê²¼¤Î¥³¥ó¥Ñ¥¤¥é¤ÇÆ°ºî¤¹¤ë¡£ ¤Ä¤Þ¤ê¡¢¤³¤ì¤é¤Î¥³¥ó¥Ñ¥¤¥é¤Ï BLL ¤ò´Þ¤ó¤À¥Æ¥¹¥È¥±¡¼¥¹¤ò¥³¥ó¥Ñ¥¤¥ë¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£

- GCC 3.0.4
- KCC 4.0f with EDG 2.43.1
- GCC 2.96 (`exception_test.cpp` ¤Î¤ß¥³¥ó¥Ñ¥¤¥é¤ÎÆâÉô¥¨¥é¡¼¤Ë¤è¤ê¼ºÇÔ¤¹¤ë)

The BLL works with the following compilers, that is, the compilers are capable of compiling the test cases that are included with the BLL:

- GCC 3.0.4
- KCC 4.0f with EDG 2.43.1
- GCC 2.96 (fails with one test case, the `exception_test.cpp` results in an internal compiler error. )

#### 7.3.1. Test coverage

°Ê²¼¤Î¥ê¥¹¥È¤Ï´Þ¤Þ¤ì¤Æ¤¤¤ë¥Æ¥¹¥È¥Õ¥¡¥¤¥ë¤È¡¢ ¤½¤ì¤¾¤ì¤Î¥Õ¥¡¥¤¥ë¤¬ÂÐ¾Ý¤È¤¹¤ëÆÃÀ¤ò¼¨¤·¤Æ¤¤¤ë¡£
The following list describes the test files included and the features that each file covers:

- `bind_tests_simple.cpp` : °Û¤Ê¤ë°ú¿ô¤Î¿ô¤È¡¢ÂÐ¾Ý¤Î´Ø¿ô¤Î°Û¤Ê¤ë·ÁÂÖ (´Ø¿ô¥Ý¥¤¥ó¥¿¡¢´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¡¢¥á¥ó¥Ð´Ø¿ô)¤ËÂÐ¤¹¤ë bind ¼°¡£ bind ¼°¤Ë¤è¤ë´Ø¿ô¤Î¹çÀ®¡£

  `bind_tests_simple.cpp` : Bind expressions of different arities and types of target functions: function pointers, function objects and member functions. Function composition with bind expressions.

- `bind_tests_simple_function_references.cpp` : ÂÐ¾Ý¤Î´Ø¿ô¤ò´Ø¿ô¥Ý¥¤¥ó¥¿¤ÎÂå¤ê¤Ë¡¢´Ø¿ô¤Ø¤Î»²¾È¤ò»ÈÍÑ¤·¤Æ `bind_tests_simple.cpp` ¤ÎÁ´¤Æ¤Î¥Æ¥¹¥È¤ò·«¤êÊÖ¤¹¡£

  `bind_tests_simple_function_references.cpp` : Repeats all tests from `bind_tests_simple.cpp` where the target function is a function pointer, but uses function references instead.

- `bind_tests_advanced.cpp` : ¥Í¥¹¥È¤·¤¿ bind ¼°¡¢`unlambda`¡¢`protect`¡¢ `const_parameters`¡¢`break_const` ¤Î¥Æ¥¹¥È¤ò´Þ¤à¡£ ¦Ë¥Õ¥¡¥ó¥¯¥¿¤ò¼Â°ú¿ô¤È¤·¤ÆÂ¾¤Î¦Ë¥Õ¥¡¥ó¥¯¥¿¤ËÅÏ¤·¡¢¥«¥ê¡¼²½¤·¡¢ ´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È¤ÎÊÖ¤êÃÍ¤Î·¿¤ò»ØÄê¤¹¤ë¤¿¤á¤Ë¡¢¥Æ¥ó¥×¥ì¡¼¥È `sig` ¤ò»ÈÍÑ¤¹¤ë¥Æ¥¹¥È

  `bind_tests_advanced.cpp` : Contains tests for nested bind expressions, `unlambda`, `protect`, `const_parameters` and `break_const`. Tests passing lambda functors as actual arguments to other lambda functors, currying, and using the `sig` template to specify the return type of a function object.

- `operator_tests_simple.cpp` : Ã±¹à¡¢Æó¹à¤Î»»½Ñ±é»»¡¢ ¥Ó¥Ã¥È±é»»¡¢ Èæ³Ó¡¢ ÏÀÍý±é»»¡¢ ¥¤¥ó¥¯¥ê¥á¥ó¥È¡¢¥Ç¥¯¥ê¥á¥ó¥È¡¢ ¹çÀ®¡¢ ÂåÆþ¡¢ subscrict ¥¢¥É¥ì¥¹±é»»¡¢ »²¾È¤Ï¤¬¤·¡¢ ¥³¥ó¥Þ±é»»»Ò ¤È¤¤¤¦¦Ë¼°¤Î¤¿¤á¤Ë¥ª¡¼¥Ð¡¼¥í¡¼¥É¤µ¤ì¤ë¤¹¤Ù¤Æ¤Î±é»»»Ò¤ò»È¤¦¥Æ¥¹¥È¡£ ²Ã»»±é»»»Ò¡¢¤ä¸º»»±é»»»Ò¤ò»È¤Ã¤¿¥Ý¥¤¥ó¥¿¤Î»»½Ñ±é»»¤ÈÆ±ÍÍ¤Ë ¥·¥Õ¥È±é»»»Ò¤ÎËÜ¼Á¤òÎ®¤¹¡£

  `operator_tests_simple.cpp` : Tests using all operators that are overloaded for lambda expressions, that is, unary and binary arithmetic, bitwise, comparison, logical, increment and decrement, compound, assignment, subscrict, address of, dereference, and comma operators. The streaming nature of shift operators is tested, as well as pointer arithmetic with plus and minus operators.

- `member_pointer_test.cpp` : ¥á¥ó¥Ð¤Î±é»»»Ò¤Ø¤Î¥Ý¥¤¥ó¥¿¤ÏÈó¾ï¤ËÊ£»¨¤Ê¤Î¤Ç¡¢¥Æ¥¹¥È¥Õ¥¡¥¤¥ë¤òÊÌ¤Ë¤·¤¿¡£

  `member_pointer_test.cpp` : The pointer to member operator is complex enough to warrant a separate test file.

- `control_structures.cpp` : ¥ë¡¼¥×¤È if Ê¸¤Î¹½Â¤¤Î¥Æ¥¹¥È¡£

  `control_structures.cpp` : Tests for the looping and if constructs.

- `switch_construct.cpp` : Á´¤Æ¤Î¥µ¥Ý¡¼¥È¤¹¤ë switch Ê¸ ¤Î°ú¿ô¤Î¿ô¤È default ¤Î¾ì¹ç¤¬¤¢¤ë¤«¤É¤¦¤«¤Î¥Æ¥¹¥È¤ò´Þ¤à¡£

  `switch_construct.cpp` : Includes tests for all supported arities of the switch statement, both with and without the default case.

- `exception_test.cpp` : catch ¥Ö¥í¥Ã¥¯¤Î¿ô¤òÊÑ²½¤µ¤»¤Ê¤¬¤é¡¢ try/catch ¤Î¤¿¤á¤ÎÎã³°¤òÁ÷½Ð¤¹¤ë¥Æ¥¹¥È¤ò´Þ¤à¡£

  `exception_test.cpp` : Includes tests for throwing exceptions and for try/catch constructs with varying number of catch blocks.

- `constructor_tests.cpp` : `constructor`¡¢`destructor`¡¢`new_ptr`¡¢ `delete_ptr`¡¢`new_array`¡¢`delete_array` ¤ËÂÐ¤¹¤ë¥Æ¥¹¥È¤ò´Þ¤à¡£

  `constructor_tests.cpp` : Contains tests for `constructor`, `destructor`, `new_ptr`, `delete_ptr`, `new_array` and `delete_array`.

- `cast_test.cpp` : »Í¤Ä¤Î¥¥ã¥¹¥È¼°¤Î¥Æ¥¹¥È¡£`typeid` ¤È `sizeof` ¤Î¥Æ¥¹¥È¤â´Þ¤à¡£

  `cast_test.cpp` : Tests for the four cast expressions, as well as `typeid` and `sizeof`.

- `extending_return_type_traits.cpp` : ¥æ¡¼¥¶ÄêµÁ·¿¤Î¤¿¤á¤ÎÊÖ¤êÃÍ¤Î·¿¿äÏÀ¥·¥¹¥Æ¥à¤Î³ÈÄ¥¤Î¥Æ¥¹¥È¡£ ¤¤¤¯¤Ä¤«¤Î¥æ¡¼¥¶ÄêµÁ¤Î±é»»»Ò¤È¡¢ ¤½¤ì¤ËÂÐ±þ¤¹¤ëÆÃ¼ì²½¤Î¤¿¤á¤ÎÊÖ¤êÃÍ¤Î·¿¿äÏÀ¥Æ¥ó¥×¥ì¡¼¥È¤ò´Þ¤à¡£

  `extending_return_type_traits.cpp` : Tests extending the return type deduction system for user defined types. Contains several user defined operators and the corresponding specializations for the return type deduction templates.

- `is_instance_of_test.cpp` : ÆâÉôÅª¤Ë»ÈÍÑ¤µ¤ì¤ëÆÃÀ¥Æ¥ó¥×¥ì¡¼¥È¤Î¤¿¤á¤Î¥Æ¥¹¥È¤ò´Þ¤à¡£ ¤³¤ÎÆÃÀ¥Æ¥ó¥×¥ì¡¼¥È¤Ï¡¢Í¿¤¨¤é¤ì¤¿·¿¤¬¤¢¤ë¥Æ¥ó¥×¥ì¡¼¥È¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤«¤É¤¦¤«¤ò¸¡½Ð¤¹¤ë¡£

  `is_instance_of_test.cpp` : Includes tests for an internally used traits template, which can detect whether a given type is an instance of a certain template or not.

- `bll_and_function.cpp` : ¦Ë¥Õ¥¡¥ó¥¯¥¿¤È `boost::function` ¤ò°ì½ï¤Ë¤·¤è¤¦¤¹¤ë¥Æ¥¹¥È¤ò´Þ¤à¡£

  `bll_and_function.cpp` : Contains tests for using `boost::function` together with lambda functors.

PrevŽ | Up | Ž Next
6. Extending return type deduction systemŽ | Home | Ž 8. Relation to other Boost libraries