2
0
mirror of https://github.com/boostorg/lambda.git synced 2026-01-21 17:02:36 +00:00

Compare commits

...

108 Commits

Author SHA1 Message Date
Eric Niebler
4def72c970 Merged revisions 42451-43517 via svnmerge from
https://svn.boost.org/svn/boost/trunk

................
  r42455 | johnmaddock | 2008-01-04 08:54:35 -0800 (Fri, 04 Jan 2008) | 1 line
  
  Fix typos.
................
  r42456 | eric_niebler | 2008-01-04 09:14:53 -0800 (Fri, 04 Jan 2008) | 1 line
  
  mark up borland and sun accumulators failures
................
  r42459 | andreas_huber69 | 2008-01-04 10:23:18 -0800 (Fri, 04 Jan 2008) | 1 line
  
  This should fix template parameter shadowing errors for gcc and Intel compilers.
................
  r42462 | bgubenko | 2008-01-04 15:55:43 -0800 (Fri, 04 Jan 2008) | 1 line
  
  mark Accumulators tests for gcc 4.2.1 affected by GCC Bugzilla Bug 33580
................
  r42471 | turkanis | 2008-01-04 20:51:49 -0800 (Fri, 04 Jan 2008) | 1 line
  
  merged changes from iostreams_dev, revisions 42441-42469; added 'std::' for Intel on Linux/Darwin; added STDCXX workaround for codecvt; fixed docs for invert.hpp
................
  r42473 | turkanis | 2008-01-04 23:35:44 -0800 (Fri, 04 Jan 2008) | 1 line
  
  new iostreams expected failures: stream_offset_64bit_test.cpp on Borland, and wide stream tests on gcc-3.4.2_hpux_pa_risc
................
  r42475 | andreas_huber69 | 2008-01-05 04:42:02 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Added defaults for in_state_reaction template parameters and updated tests accordingly.
................
  r42476 | bemandawes | 2008-01-05 06:41:55 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Disable Microsoft "secure" overloads in Dinkumware libraries since they cause compile errors with Intel versions 9 and 10
................
  r42478 | jurko | 2008-01-05 07:19:53 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Typo corrections. Minor stylistic changes.
................
  r42479 | jurko | 2008-01-05 08:53:03 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Updated Boost.Jam command line option texts. Minor stylistic changes.
................
  r42480 | jurko | 2008-01-05 08:55:36 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Typo corrections. Minor stylistic changes.
................
  r42481 | jurko | 2008-01-05 08:56:42 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Typo correction. Corrected an invalid command-line option name.
................
  r42482 | jurko | 2008-01-05 08:57:17 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Corrected an invalid command-line option name reference.
................
  r42483 | jurko | 2008-01-05 08:58:01 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Corrected an out-of-date comment listing all command-line options.
................
  r42484 | jurko | 2008-01-05 09:11:50 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Corrected the used file suffix for the VERBATIM file type. Now the documentation is in sync with the 'customization' example. This also closes the Trac ticket 134. Minor stylistic changes.
................
  r42485 | jurko | 2008-01-05 09:46:45 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Stylistic comment changes & typo corrections.
................
  r42486 | jurko | 2008-01-05 09:52:31 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Stylistic comment changes & typo corrections in several files. Corrected an incorrect error message in boost-build/build/project.jam displayed when a --build-dir command-line option and a non top-level project build-dir attribute are specified.
................
  r42487 | jurko | 2008-01-05 09:54:02 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Cleaned up some import rule calls.
................
  r42488 | jurko | 2008-01-05 10:02:23 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Documentation wording cleaned up a bit.
................
  r42489 | jurko | 2008-01-05 10:13:10 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Removed or simplified some import calls. Comment updates. Minor stylistic changes.
................
  r42490 | jurko | 2008-01-05 10:14:20 -0800 (Sat, 05 Jan 2008) | 2 lines
  
  Simplified the used make rules. Removed some dead code. Minor stylistic changes.
................
  r42492 | jurko | 2008-01-05 10:29:36 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Removed trailing spaces and some empty lines.
................
  r42494 | jurko | 2008-01-05 12:02:24 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Minor stylistic changes such as: comment typo corrections, wrapping lines to 80 characters, indentations, removing trailing spaces, etc.
................
  r42495 | jurko | 2008-01-05 12:06:15 -0800 (Sat, 05 Jan 2008) | 2 lines
  
  Cleaned up where the stage module is imported in tools/builtin.jam. Added a missing import in tools/stage.jam that causes errors with the previous fix. Minor stylistic changes in tools/stage.jam.
................
  r42496 | jurko | 2008-01-05 12:14:48 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Comment cleanup.
................
  r42497 | jurko | 2008-01-05 12:37:44 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Minor stylistic changes - cleaned up import calls, wrapped much text at 80 characters updated comments, typo corrections, removed trailing spaces, etc.
................
  r42498 | jurko | 2008-01-05 12:48:50 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Renamed some Jamfile and project-root.jam references to Jamfile.jam and Jamroot.jam respectively.
................
  r42499 | jurko | 2008-01-05 13:37:15 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Test code cleaned up a bit. No functional changes.
................
  r42502 | hkaiser | 2008-01-05 14:44:28 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Wave: updated copyright messages to include the year 2008 (merged from release branch).
................
  r42504 | jurko | 2008-01-05 15:18:17 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Refactored the test into two separate test functions. Made the 'directory names with dots' test use the expect_output_line() tool instead of a manual find, causing a better diagnostic to be displayed in case of a failure. Made one of the test Jam scripts more compact. Made the test use the Jamroot.jam file instead of project-root.jam.
................
  r42505 | bgubenko | 2008-01-05 15:35:05 -0800 (Sat, 05 Jan 2008) | 1 line
  
  mark up accumulators library test weighted_kurtosis for acc toolset
................
  r42506 | jurko | 2008-01-05 16:25:48 -0800 (Sat, 05 Jan 2008) | 1 line
  
  No functional changes but only stylistic changes such as: comment typo corrections, wrapping lines to 80 characters, indentations, removing trailing spaces, removing empty lines, made tests use Jamfile.jam and Jamroot.jam Boost Build script names, removed unnecessary module imports, etc.
................
  r42507 | jurko | 2008-01-05 16:53:09 -0800 (Sat, 05 Jan 2008) | 1 line
  
  No functional changes but only stylistic changes such as: comment typo corrections, wrapping lines to 80 characters, indentations, removing trailing spaces, removing empty lines, removed unnecessary module imports, etc.
................
  r42508 | jurko | 2008-01-05 22:15:39 -0800 (Sat, 05 Jan 2008) | 5 lines
  
  Refactored build-system.jam. Added many detailed comments.
  
  Test configuration module now gets loaded the same as all other configuration modules.
  
  In addition to being able to specify which user configuration to load, user may now also prevent loading the user configuration by specifying an empty file name for it.
................
  r42509 | jurko | 2008-01-05 22:50:56 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Added a --test-config command-line option for specifying where the test configuration file should be loaded from instead of always being looked up in Boost Build's test folder. This allows non-test builds to not use test config when it exists on the system and different tests to use different test configurations when needed.
................
  r42510 | jurko | 2008-01-05 22:58:24 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Specifying that a build uses test configuration no longer prevents toolset auto-configuration and therefore no longer causes --toolset options to be ignored.
................
  r42511 | jurko | 2008-01-05 23:13:28 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Minor stylistic comment changes.
................
  r42512 | jurko | 2008-01-05 23:17:08 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Added support for choosing the toolset and toolset version to be used 'by default' by Boost Build. Allows testing of default toolset functionality.
................
  r42513 | jurko | 2008-01-05 23:26:46 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Upgraded the tool for testing that a certain line exists in the given output support so that it now also knows how to test that a certain line does not exist in the given output.
................
  r42514 | jurko | 2008-01-05 23:28:47 -0800 (Sat, 05 Jan 2008) | 1 line
  
  Added the --ignore-site-config option telling Boost.Build not to load the site configuration file.
................
  r42516 | jurko | 2008-01-06 00:16:34 -0800 (Sun, 06 Jan 2008) | 1 line
  
  Stylistic changes: typo corrections, comment alignments, output string updates, no functional changes, etc.
................
  r42527 | andreas_huber69 | 2008-01-06 05:49:31 -0800 (Sun, 06 Jan 2008) | 1 line
  
  Various doc updates.
................
  r42528 | danieljames | 2008-01-06 08:47:16 -0800 (Sun, 06 Jan 2008) | 2 lines
  
  Add Boost.Unordered and add to the documentation. Not fully integrated yet.
................
  r42529 | danieljames | 2008-01-06 08:48:36 -0800 (Sun, 06 Jan 2008) | 1 line
  
  Add more libraries that use Boost.Hash to its intro.
................
  r42530 | danieljames | 2008-01-06 08:49:11 -0800 (Sun, 06 Jan 2008) | 1 line
  
  Add Boost.Unordered to Boost.Hash's intro.
................
  r42531 | danieljames | 2008-01-06 08:59:18 -0800 (Sun, 06 Jan 2008) | 1 line
  
  Combine the 'container' and 'unordered' tests.
................
  r42532 | danieljames | 2008-01-06 08:59:49 -0800 (Sun, 06 Jan 2008) | 1 line
  
  Give the unordered exception test suite its own name.
................
  r42533 | danieljames | 2008-01-06 09:13:15 -0800 (Sun, 06 Jan 2008) | 1 line
  
  Add the contents of compile_tests.cpp to set_compile.cpp and map_compile.cpp
................
  r42534 | danieljames | 2008-01-06 09:16:51 -0800 (Sun, 06 Jan 2008) | 1 line
  
  Rename the test-suites to match other libraries' style.
................
  r42535 | danieljames | 2008-01-06 09:23:16 -0800 (Sun, 06 Jan 2008) | 2 lines
  
  Add forwarding html files for Boost.Unordered.
................
  r42536 | danieljames | 2008-01-06 09:40:32 -0800 (Sun, 06 Jan 2008) | 1 line
  
  Add Boost.Unordered to the regression tests.
................
  r42537 | eric_niebler | 2008-01-06 09:44:06 -0800 (Sun, 06 Jan 2008) | 1 line
  
  add myself as maintainer of accumulators
................
  r42538 | danieljames | 2008-01-06 09:45:18 -0800 (Sun, 06 Jan 2008) | 2 lines
  
  Add library identification.
................
  r42539 | danieljames | 2008-01-06 09:48:11 -0800 (Sun, 06 Jan 2008) | 2 lines
  
  Add the unordered library to the maintainers list.
................
  r42540 | danieljames | 2008-01-06 09:56:06 -0800 (Sun, 06 Jan 2008) | 2 lines
  
  Add unordered to the library list.
................
  r42544 | turkanis | 2008-01-06 10:32:05 -0800 (Sun, 06 Jan 2008) | 18 lines
  
  copy.hpp: 
  
      fix for Visual Age: std::min was passed arguments of different types; replaced std:: min with conditional
  
  detail/streambuf/indirect_streambuf.hpp: 
  
      removed trailing comma in enum definition
  
  test/combine_test.cpp:
  test/symmetric_filter_test.cpp:
  test/compose_test.cpp:
  test/close_test.cpp:
  test/invert_test.cpp:
  test/tee_test.cpp:
  test/restrict_test.cpp:
  test/Jamfile.v2:
  
      moved tests for close() into the test files for various adapters
................
  r42546 | jurko | 2008-01-06 12:06:33 -0800 (Sun, 06 Jan 2008) | 1 line
  
  Corrected a bug with the customized default toolset being read from the toolset module but defined in the build-system module. Effect was that customized default toolsets were getting ignored.
................
  r42547 | jurko | 2008-01-06 12:37:55 -0800 (Sun, 06 Jan 2008) | 1 line
  
  Simple code cleanup. Typo corrections.
................
  r42548 | jurko | 2008-01-06 12:43:25 -0800 (Sun, 06 Jan 2008) | 1 line
  
  Added support for tests configuring whether they want their Boost Build to ignore toolset requirements instead of always ignoring them. Minor stylistic changes.
................
  r42549 | jurko | 2008-01-06 12:56:20 -0800 (Sun, 06 Jan 2008) | 1 line
  
  Added new tests related to Boost Build's default toolset handling. They test that the correct default toolset gets use and that when it gets used that has no different status than any other explicitly specified toolset.
................
  r42563 | turkanis | 2008-01-06 17:26:52 -0800 (Sun, 06 Jan 2008) | 1 line
  
  marked restrict_test.cpp as failing on vacpp and stream_offset_64bit_test as failing on sun (iostreams)
................
  r42564 | turkanis | 2008-01-06 17:32:29 -0800 (Sun, 06 Jan 2008) | 1 line
  
  alphabetized the iostreams failures
................
  r42565 | turkanis | 2008-01-06 21:20:32 -0800 (Sun, 06 Jan 2008) | 5 lines
  
  merged changes from branches/iostreams_dev, revisions 42544-42544
  
  - added "slice" as an alias for "restrict", for platforms on which "restrict" is a keyword
  - attempted to configure file_descriptor for __IBMCPP__
  - added better error output to stream_offset_64bit_test.cpp
................
  r42566 | jurko | 2008-01-07 09:00:59 -0800 (Mon, 07 Jan 2008) | 1 line
  
  Corrected explicitly specified user-config file handling. Was not looking for the specified file in the regular path instead of the current folder and did not work with absolute paths.
................
  r42567 | jurko | 2008-01-07 10:15:13 -0800 (Mon, 07 Jan 2008) | 1 line
  
  Code cleanup. Converted to using True/False instead of 1/0. Changed to obey documented coding conventions regarding whitespace and function parameters. Renamed private member functions to use the __ name prefix.
................
  r42568 | jurko | 2008-01-07 10:38:28 -0800 (Mon, 07 Jan 2008) | 1 line
  
  Added a new configuration test making sure that the bug with not being able to process absolute user-config configuration file references never rears its ugly head again.
................
  r42570 | eric_niebler | 2008-01-07 11:06:31 -0800 (Mon, 07 Jan 2008) | 1 line
  
  s/order/tail/
................
  r42571 | eric_niebler | 2008-01-07 11:08:16 -0800 (Mon, 07 Jan 2008) | 1 line
  
  add missing includes, fix signed/unsigned warnings, clean-up trailing whitespace, fixes #1552
................
  r42572 | danieljames | 2008-01-07 11:40:32 -0800 (Mon, 07 Jan 2008) | 1 line
  
  Rename the exception tests so that they don't clash with the normal tests.
................
  r42573 | danieljames | 2008-01-07 11:41:05 -0800 (Mon, 07 Jan 2008) | 1 line
  
  Remove some development code.
................
  r42575 | danieljames | 2008-01-07 11:44:13 -0800 (Mon, 07 Jan 2008) | 3 lines
  
  Add missing 'use namespace std'. Which I should have done when I was told about
  them before. Sorry.
................
  r42576 | danieljames | 2008-01-07 11:46:27 -0800 (Mon, 07 Jan 2008) | 1 line
  
  Add support for multiple copyrights in the library info.
................
  r42578 | danieljames | 2008-01-07 11:51:02 -0800 (Mon, 07 Jan 2008) | 1 line
  
  Reneame the set and map compile tests so they'll be adjacent in the test results.
................
  r42580 | danieljames | 2008-01-07 12:06:15 -0800 (Mon, 07 Jan 2008) | 1 line
  
  Avoid some uses of an invalid pointer.
................
  r42581 | danieljames | 2008-01-07 12:07:12 -0800 (Mon, 07 Jan 2008) | 1 line
  
  Use the default location for the reference documentation.
................
  r42587 | danieljames | 2008-01-07 13:05:42 -0800 (Mon, 07 Jan 2008) | 5 lines
  
  Fix a bug which was causing the memory area stuff to fail.
  
  I should probably try to be less clever and use memory area's lower
  bounds as the key, and do the extra work required to get that working.
................
  r42588 | danieljames | 2008-01-07 13:07:43 -0800 (Mon, 07 Jan 2008) | 1 line
  
  Fix an off by one error.
................
  r42591 | danieljames | 2008-01-07 13:47:24 -0800 (Mon, 07 Jan 2008) | 1 line
  
  Merge in spell check.
................
  r42596 | turkanis | 2008-01-07 15:13:26 -0800 (Mon, 07 Jan 2008) | 5 lines
  
  merged changes from branches/iostreams_dev, revisions 42565-42595:
  
  - Simplified implementation with the help to the C-runtime function _get_osfhandle so that on Windows only a single HANDLE is stored and the POSIX-style implementation is never needed; added the handle_type on POSIX systems (typedef for int) and a function returning the underlying handle as an instance of handle_type
  - fixed the bug described in ticket Ticket #1551 (stream_buffer::seekpos ignores openmode parameter)
  - fixed test/operation_sequence_test.cpp file description
................
  r42598 | grafik | 2008-01-07 18:49:25 -0800 (Mon, 07 Jan 2008) | 1 line
  
  Mostly fix bad path calc for direct html from doxygen doc generation. (fixes #1562)
................
  r42600 | turkanis | 2008-01-07 19:49:23 -0800 (Mon, 07 Jan 2008) | 1 line
  
  merged changes from branches/iostreams_dev revisions 42595-42599; applied Dinkumware implementation of positioning functions to IBM Visual Age; simplified and corrected implementation
................
  r42602 | turkanis | 2008-01-07 20:20:38 -0800 (Mon, 07 Jan 2008) | 1 line
  
  removed unneeded headers, one of which (restrict.hpp) causes failures on IBM Visual Age
................
  r42603 | turkanis | 2008-01-07 20:52:54 -0800 (Mon, 07 Jan 2008) | 1 line
  
  removed spurious '.cpp' extension from test names (iostreams)
................
  r42612 | danieljames | 2008-01-08 05:59:01 -0800 (Tue, 08 Jan 2008) | 3 lines
  
  Merge in latest unordered developments (revisions 42607-42611).
................
  r42613 | jurko | 2008-01-08 06:40:24 -0800 (Tue, 08 Jan 2008) | 1 line
  
  Added a new test making sure properties conditioned on multiple different feature values are handled correctly. This especially includes testing the case when one of those features is <toolset> and the value given for it includes a toolset version.
................
  r42614 | jurko | 2008-01-08 07:21:15 -0800 (Tue, 08 Jan 2008) | 1 line
  
  Made some debugging messages more consistent.
................
  r42615 | eric_niebler | 2008-01-08 09:42:20 -0800 (Tue, 08 Jan 2008) | 1 line
  
  support for LaTeX formulas in Doxygen comments
................
  r42616 | eric_niebler | 2008-01-08 09:43:34 -0800 (Tue, 08 Jan 2008) | 1 line
  
  automatically generate png files from LaTeX formulas using doxygen
................
  r42617 | jurko | 2008-01-08 09:51:30 -0800 (Tue, 08 Jan 2008) | 1 line
  
  Comment correction.
................
  r42619 | danieljames | 2008-01-08 10:15:01 -0800 (Tue, 08 Jan 2008) | 1 line
  
  Merge: Another missing 'using namespace std'
................
  r42620 | eric_niebler | 2008-01-08 10:43:43 -0800 (Tue, 08 Jan 2008) | 1 line
  
  fix signed/unsigned warnings, clean up trailing whitespace
................
  r42624 | eric_niebler | 2008-01-08 13:40:52 -0800 (Tue, 08 Jan 2008) | 1 line
  
  disable iterator debugging for all msvc versions
................
  r42625 | turkanis | 2008-01-08 14:25:01 -0800 (Tue, 08 Jan 2008) | 1 line
  
  merged changes from branches/iostreams_dev, revisions 42602-42624: adding missing included to fix #1550; fix for positioning on IBM; fix for file_descriptor on POSIX; restructed the version range for the Borland workaround in large_file_test.cpp
................
  r42626 | jurko | 2008-01-08 17:09:26 -0800 (Tue, 08 Jan 2008) | 1 line
  
  Minor stylistic code indentation changes.
................
  r42627 | jurko | 2008-01-08 17:11:03 -0800 (Tue, 08 Jan 2008) | 1 line
  
  Tried trailing spaces. Minor comment typo corrections.
................
  r42628 | jurko | 2008-01-08 17:18:38 -0800 (Tue, 08 Jan 2008) | 1 line
  
  Remove trailing spaces. Removed an empty line.
................
  r42629 | jurko | 2008-01-08 20:05:29 -0800 (Tue, 08 Jan 2008) | 8 lines
  
  Updated the __ACTION_RULE__ to not return its action command output as a single string but instead split it into a list of output lines. This allows Jam code using this output to work correctly independently of what newline character combinations are in use. This was causing problems with Boost Build unit tests which can now be updated to pass.
  
  Consequences & checks:
    * Final __ACTION_RULE__ rule parameter has changed from output ? to output-lines *.
    * Updated corresponding Jam documentation.
    * Updated the all related Boost Build code.
    * No code on the Boost trunk uses this rule except for Boost Build itself.
................
  r42630 | jurko | 2008-01-08 20:15:35 -0800 (Tue, 08 Jan 2008) | 1 line
  
  Fixed a failing test by making it access action output using the __ACTION_RULE__ rule so it would not be affected by the level of debug output given by Boost Build/Jam.
................
  r42631 | jurko | 2008-01-08 20:30:25 -0800 (Tue, 08 Jan 2008) | 1 line
  
  Fixed a failing test by making it access its action results using the __ACTION_RULE__ rule. Now it works with the default debug level settings (i.e. no action output displayed).
................
  r42632 | grafik | 2008-01-08 20:31:58 -0800 (Tue, 08 Jan 2008) | 1 line
  
  Revert various changes that break backward compatibility, and also some minor edits.
................
  r42633 | grafik | 2008-01-08 20:34:12 -0800 (Tue, 08 Jan 2008) | 1 line
  
  Revert various changes that break backward compatibility, and also some minor edits.
................
  r42637 | jurko | 2008-01-09 06:36:37 -0800 (Wed, 09 Jan 2008) | 1 line
  
  Updated the test so it passes on Windows. Had to change it to enable action output logging and compensate for the fact that now action names are sent to the output as well. Minor stylistic changes.
................
  r42639 | jurko | 2008-01-09 09:03:45 -0800 (Wed, 09 Jan 2008) | 1 line
  
  Updated the test so it passes on Windows. Had to change it to enable action output logging and compensate for the fact that now action names are sent to the output as well. Minor stylistic changes.
................
  r42641 | eric_niebler | 2008-01-09 12:21:51 -0800 (Wed, 09 Jan 2008) | 1 line
  
  copy the png files to where fop will look for them when building pdf
................
  r42642 | eric_niebler | 2008-01-09 12:33:05 -0800 (Wed, 09 Jan 2008) | 1 line
  
  fix more signed/unsigned warnings
................
  r42644 | turkanis | 2008-01-09 15:13:57 -0800 (Wed, 09 Jan 2008) | 1 line
  
  marked stream_offset_64bit_test as an expected failure on vacpp (iostreams)
................
  r42645 | turkanis | 2008-01-09 15:16:17 -0800 (Wed, 09 Jan 2008) | 1 line
  
  replaced 2 occurrences of the identifier 'restrict' with BOOST_IOSTREAMS_RESTRICT
................
  r42646 | turkanis | 2008-01-09 19:27:51 -0800 (Wed, 09 Jan 2008) | 1 line
  
  added expected failures for Sun and IBM; removed a Borland intermittent failure; removed some obsolete toolsets (iostreams)
................
  r42647 | troyer | 2008-01-10 01:49:16 -0800 (Thu, 10 Jan 2008) | 1 line
  
  Optimizations for Boost.MPI
................
  r42648 | troyer | 2008-01-10 03:54:36 -0800 (Thu, 10 Jan 2008) | 1 line
  
  Undid backward-compatibility breaking change in pair serialization
................
  r42651 | johnmaddock | 2008-01-10 04:10:37 -0800 (Thu, 10 Jan 2008) | 1 line
  
  Apply patch from Issue #1187.
................
  r42657 | anthonyw | 2008-01-10 06:19:36 -0800 (Thu, 10 Jan 2008) | 1 line
  
  removed references to NULL
................
  r42658 | turkanis | 2008-01-10 10:50:19 -0800 (Thu, 10 Jan 2008) | 1 line
  
  marked up two moe expected failures for sun-5.7-5.8 (iostreams)
................
  r42664 | bgubenko | 2008-01-10 13:13:42 -0800 (Thu, 10 Jan 2008) | 1 line
  
  marked iostreams library compose_test for gcc-3.4.6_linux_ia64 : linking exceeds 10 min. limit
................
  r42665 | danieljames | 2008-01-10 14:25:35 -0800 (Thu, 10 Jan 2008) | 2 lines
  
  Initialise svnmerge for merging changes for unordered.
................
  r42666 | danieljames | 2008-01-10 14:30:46 -0800 (Thu, 10 Jan 2008) | 6 lines
  
  Merge latest unordered developments:
  
  Make simple_test test a little more.
  Use doubles for calculating max load factor.
  Some workarounds, mostly for Borland and running the tests.
................
  r42670 | turkanis | 2008-01-10 16:02:36 -0800 (Thu, 10 Jan 2008) | 1 line
  
  merged changes from branches/iostreams_dev, revisions 42645=42660; fix for Intel-darwin; removed dependence of file_descriptor_test and mapped_file_test on library boost_iostreams
................
  r42672 | turkanis | 2008-01-10 17:35:46 -0800 (Thu, 10 Jan 2008) | 1 line
  
  force static runtime-link for intel-darwin
................
  r42674 | johnmaddock | 2008-01-11 01:55:43 -0800 (Fri, 11 Jan 2008) | 1 line
  
  Fix bugs reported by Will Drewry: certain invalid regexes can cause the library to access invalid memory, changed to ensure that the correct exception is thrown long before this happens.
................
  r42676 | jurko | 2008-01-11 05:44:51 -0800 (Fri, 11 Jan 2008) | 1 line
  
  Removed the manual boost-build.jam file creation since that file already exists in the SVN repository and this only overwrote it with the same content minus the copyright notice. Removed a reference to the no longer existing boost_build_v2.html file.
................
  r42677 | johnmaddock | 2008-01-11 05:48:57 -0800 (Fri, 11 Jan 2008) | 1 line
  
  Update for Intel-10.1.
................
  r42684 | turkanis | 2008-01-11 11:12:22 -0800 (Fri, 11 Jan 2008) | 1 line
  
  another attempt to fix linking for compression tests on intel-darwin
................
  r42688 | turkanis | 2008-01-11 14:58:21 -0800 (Fri, 11 Jan 2008) | 1 line
  
  merged changes from iostreams_dev; fixes for IBM and more documentation
................
  r42689 | turkanis | 2008-01-11 18:45:55 -0800 (Fri, 11 Jan 2008) | 1 line
  
  more detailed note for vacpp (iostreams)
................
  r42691 | eric_niebler | 2008-01-11 22:43:28 -0800 (Fri, 11 Jan 2008) | 1 line
  
  new style transforms a-la proto v3
................
  r42693 | nesotto | 2008-01-12 04:38:57 -0800 (Sat, 12 Jan 2008) | 1 line
  
  doc fixes
................
  r42698 | danieljames | 2008-01-12 06:43:40 -0800 (Sat, 12 Jan 2008) | 9 lines
  
  Merge the latest unordered changes. These are concerned with getting the tests
  working on more compilers. The biggest change is that the exception tests have
  been changed to use a very simple exception testing mechanism on top of
  lightweight_test. This was because Boost.Test exception testing isn't working
  on several platforms. I'm trying to set this up so that I can use Boost.Test on
  compilers which it completely supports, and lightweight test on others.
  Boost.Test tests more than my simple exception testing code ever will so it's
  worth using where I can.
................
  r42700 | eric_niebler | 2008-01-12 09:09:17 -0800 (Sat, 12 Jan 2008) | 1 line
  
  missing includes
................
  r42701 | eric_niebler | 2008-01-12 09:40:40 -0800 (Sat, 12 Jan 2008) | 1 line
  
  more msvc-7.1-friendly default_context implementation, more missing headers
................
  r42706 | turkanis | 2008-01-12 12:19:42 -0800 (Sat, 12 Jan 2008) | 1 line
  
  corrected use of feature detection macros for AIX; simplified implementation slightly; updated docs
................
  r42707 | turkanis | 2008-01-12 12:20:35 -0800 (Sat, 12 Jan 2008) | 1 line
  
  removed intel-darwin sepcific code, since it didn't work
................
  r42708 | eric_niebler | 2008-01-12 13:19:45 -0800 (Sat, 12 Jan 2008) | 1 line
  
  port toy_spirit example to proto v3
................
  r42713 | turkanis | 2008-01-12 23:17:07 -0800 (Sat, 12 Jan 2008) | 1 line
  
  improved docs
................
  r42715 | nesotto | 2008-01-13 03:37:41 -0800 (Sun, 13 Jan 2008) | 1 line
  
  fixed #if to #ifdef
................
  r42722 | bgubenko | 2008-01-13 07:52:12 -0800 (Sun, 13 Jan 2008) | 1 line
  
  better note for iostreams library test compose_test on gcc-3.4.6_linux_ia64
................
  r42723 | bgubenko | 2008-01-13 08:12:37 -0800 (Sun, 13 Jan 2008) | 1 line
  
  marked up random library test random_test for gcc-3.4.6_linux_ia64
................
  r42724 | danieljames | 2008-01-13 08:19:26 -0800 (Sun, 13 Jan 2008) | 3 lines
  
  Merge in latest changes to Boost.Unordered. Some compiler workarounds and
  starting to clean up the tests a little.
................
  r42729 | eric_niebler | 2008-01-13 11:39:54 -0800 (Sun, 13 Jan 2008) | 1 line
  
  work around msvc-7.1 bug
................
  r42741 | eric_niebler | 2008-01-13 13:56:56 -0800 (Sun, 13 Jan 2008) | 1 line
  
  boost template instantiation depth on darwin
................
  r42745 | johnmaddock | 2008-01-14 01:46:12 -0800 (Mon, 14 Jan 2008) | 1 line
  
  Ooops, fix broken escape sequence.
................
  r42747 | johnmaddock | 2008-01-14 01:58:36 -0800 (Mon, 14 Jan 2008) | 1 line
  
  Fix documentation typos.
................
  r42750 | chris_kohlhoff | 2008-01-14 05:13:35 -0800 (Mon, 14 Jan 2008) | 2 lines
  
  Fix concept name in comment.
................
  r42751 | johnmaddock | 2008-01-14 05:17:09 -0800 (Mon, 14 Jan 2008) | 1 line
  
  Patch regex concept checks and TR1 library to work with VC9 + MS TR1 feature pack.
................
  r42752 | chris_kohlhoff | 2008-01-14 05:20:06 -0800 (Mon, 14 Jan 2008) | 2 lines
  
  Add missing broken pipe error.
................
  r42753 | chris_kohlhoff | 2008-01-14 05:21:37 -0800 (Mon, 14 Jan 2008) | 3 lines
  
  Don't include sys/time.h when compiling with aCC, as that header does not
  supply pselect(), which is needed for HP-UX/aCC to work correctly.
................
  r42754 | chris_kohlhoff | 2008-01-14 05:22:21 -0800 (Mon, 14 Jan 2008) | 2 lines
  
  Disable noisy and incorrect /Wp64 warnings generated by MSVC.
................
  r42755 | chris_kohlhoff | 2008-01-14 05:24:28 -0800 (Mon, 14 Jan 2008) | 3 lines
  
  Don't call epoll_wait/kevent if there are no old operations (where old means
  added prior to the last epoll_wait/kevent call) needing to be demultiplexed.
................
  r42756 | chris_kohlhoff | 2008-01-14 05:25:24 -0800 (Mon, 14 Jan 2008) | 2 lines
  
  Silence some integer truncation warnings.
................
  r42758 | chris_kohlhoff | 2008-01-14 05:27:52 -0800 (Mon, 14 Jan 2008) | 8 lines
  
  Silence some integer truncation warnings.
  
  Only perform the windows-bug workaround where we use a short timeout with
  GetQueuedCompletionStatus from one thread, i.e. the timer thread.
  
  Keep track of the number of OVERLAPPED-derived operations to ensure that
  they all get cleaned up when the io_service is destroyed.
................
  r42759 | chris_kohlhoff | 2008-01-14 05:29:08 -0800 (Mon, 14 Jan 2008) | 5 lines
  
  Check for truncation when converting buffer size from size_t to openssl's
  int argument.
  
  Try to fix possible thread-safety issues in SSL wrapper.
................
  r42766 | eric_niebler | 2008-01-14 08:49:32 -0800 (Mon, 14 Jan 2008) | 1 line
  
  register mpl::bool_ with typeof
................
  r42767 | dgregor | 2008-01-14 09:01:26 -0800 (Mon, 14 Jan 2008) | 1 line
  
  Improved suggestion for dealing with Qt MOC, from Niels Dekker
................
  r42771 | niels_dekker | 2008-01-14 10:17:30 -0800 (Mon, 14 Jan 2008) | 1 line
  
  Documented value_init workaround to compiler issues, added new introduction, updated to 2003 edition of C++ Standard -- reviewed by Fernando Cacciola
................
  r42773 | guwi17 | 2008-01-14 11:04:43 -0800 (Mon, 14 Jan 2008) | 2 lines
  
  - fixed typo
................
  r42776 | eric_niebler | 2008-01-14 12:26:58 -0800 (Mon, 14 Jan 2008) | 1 line
  
  add skip(), for specifying a skip regex
................
  r42778 | turkanis | 2008-01-14 12:47:17 -0800 (Mon, 14 Jan 2008) | 1 line
  
  overhaul of dual_use filters: close() is now called just once; suppressed Borland/Dinkumware warnings in mapped_file.hpp
................
  r42779 | niels_dekker | 2008-01-14 13:46:20 -0800 (Mon, 14 Jan 2008) | 1 line
  
  Minor "beautifications" of value_init documentation, inc. placing references in order of appearance
................
  r42780 | lbourdev | 2008-01-14 14:06:07 -0800 (Mon, 14 Jan 2008) | 3 lines
  
  Changed size_t to std::size_t
................
  r42781 | lbourdev | 2008-01-14 15:25:10 -0800 (Mon, 14 Jan 2008) | 3 lines
  
  GIL: Changing size_t to std::size_t
................
  r42788 | eric_niebler | 2008-01-14 22:46:39 -0800 (Mon, 14 Jan 2008) | 1 line
  
  code clean-up, begin updating the transform section in proto's docs
................
  r42789 | eric_niebler | 2008-01-14 23:46:51 -0800 (Mon, 14 Jan 2008) | 1 line
  
  try disabling iterator debugging for intel-win toolset
................
  r42797 | t_schwinger | 2008-01-15 11:46:10 -0800 (Tue, 15 Jan 2008) | 3 lines
  
  adds missing #include
................
  r42798 | niels_dekker | 2008-01-15 11:53:28 -0800 (Tue, 15 Jan 2008) | 1 line
  
  value_init doc + test: Added revision date.
................
  r42801 | jurko | 2008-01-15 13:13:52 -0800 (Tue, 15 Jan 2008) | 1 line
  
  Minor stylistic comment changes. Removed trailing spaces.
................
  r42804 | eric_niebler | 2008-01-15 14:06:51 -0800 (Tue, 15 Jan 2008) | 1 line
  
  document call<>, make<> and bind<>
................
  r42807 | turkanis | 2008-01-15 14:54:40 -0800 (Tue, 15 Jan 2008) | 1 line
  
  rewrote treatment of result_of in terms of a new (hopefully temporary) config macro BOOST_IOSTREAMS_NO_RESULT_OF; fixed docs
................
  r42811 | turkanis | 2008-01-15 17:14:04 -0800 (Tue, 15 Jan 2008) | 1 line
  
  reverted last change except for doc fixes; regression was result of test runner's local patch
................
  r42813 | turkanis | 2008-01-15 17:16:36 -0800 (Tue, 15 Jan 2008) | 1 line
  
  botched last commit
................
  r42814 | djenkins | 2008-01-15 22:39:34 -0800 (Tue, 15 Jan 2008) | 1 line
  
  missing include
................
  r42815 | niels_dekker | 2008-01-16 01:35:12 -0800 (Wed, 16 Jan 2008) | 1 line
  
  Added convenience class initialized_value, as announced at http://article.gmane.org/gmane.comp.lib.boost.devel/169833
................
  r42816 | niels_dekker | 2008-01-16 01:37:25 -0800 (Wed, 16 Jan 2008) | 1 line
  
  Added test and documentation for convenience class initialized_value, that was added with changeset [42815]
................
  r42817 | chris_kohlhoff | 2008-01-16 05:46:01 -0800 (Wed, 16 Jan 2008) | 2 lines
  
  Set the openssl callback function for getting a thread ID.
................
  r42818 | anthonyw | 2008-01-16 07:23:36 -0800 (Wed, 16 Jan 2008) | 1 line
  
  Provide tss_cleanup_implemented as a dummy function on Windows CE to allow tests to run
................
  r42821 | t_schwinger | 2008-01-16 11:16:37 -0800 (Wed, 16 Jan 2008) | 3 lines
  
  works around MSVC7.1 problems (hopefully)
................
  r42822 | t_schwinger | 2008-01-16 11:17:09 -0800 (Wed, 16 Jan 2008) | 3 lines
  
  attempts to fix Borland regressions
................
  r42823 | eric_niebler | 2008-01-16 11:24:33 -0800 (Wed, 16 Jan 2008) | 1 line
  
  document when<> and is_callable<>
................
  r42825 | turkanis | 2008-01-16 12:46:56 -0800 (Wed, 16 Jan 2008) | 1 line
  
  replaced __IBMCPP__ with _AIX
................
  r42827 | turkanis | 2008-01-16 16:50:14 -0800 (Wed, 16 Jan 2008) | 1 line
  
  added pgi to toolsets expected to fail seekawble_file_test (iostreams)
................
  r42836 | eric_niebler | 2008-01-17 14:47:54 -0800 (Thu, 17 Jan 2008) | 1 line
  
  stl_iterator does better error handling
................
  r42837 | jurko | 2008-01-17 17:14:17 -0800 (Thu, 17 Jan 2008) | 1 line
  
  Stylistic changes. Removed trailing spaces. Removed empty lines. Corrected comment typos and wording.
................
  r42839 | eric_niebler | 2008-01-17 23:56:31 -0800 (Thu, 17 Jan 2008) | 1 line
  
  tweaks for better doxygen-ated output
................
  r42840 | eric_niebler | 2008-01-17 23:56:59 -0800 (Thu, 17 Jan 2008) | 1 line
  
  updated reference section
................
  r42841 | eric_niebler | 2008-01-17 23:58:48 -0800 (Thu, 17 Jan 2008) | 1 line
  
  add back reference section, document user-defined transforms
................
  r42843 | t_schwinger | 2008-01-18 06:37:41 -0800 (Fri, 18 Jan 2008) | 3 lines
  
  makes member object support work with BCC
................
  r42851 | johnmaddock | 2008-01-18 08:56:57 -0800 (Fri, 18 Jan 2008) | 1 line
  
  Add needed <iostream> include.
................
  r42852 | johnmaddock | 2008-01-18 09:05:35 -0800 (Fri, 18 Jan 2008) | 1 line
  
  We don't have a tr1::hash functor if the std lib is the Apache version.
................
  r42853 | hkaiser | 2008-01-18 09:56:53 -0800 (Fri, 18 Jan 2008) | 1 line
  
  Wave: removed T_DEFINED token id from the library.
................
  r42855 | johnmaddock | 2008-01-18 10:18:17 -0800 (Fri, 18 Jan 2008) | 1 line
  
  Needs to #include <cstring> in order to use std::memset.
................
  r42856 | danieljames | 2008-01-18 11:35:55 -0800 (Fri, 18 Jan 2008) | 2 lines
  
  Merge in some changes to the unordered tests.
................
  r42857 | t_schwinger | 2008-01-18 12:05:56 -0800 (Fri, 18 Jan 2008) | 3 lines
  
  simplifies function_types markup
................
  r42858 | t_schwinger | 2008-01-18 12:52:06 -0800 (Fri, 18 Jan 2008) | 3 lines
  
  attempts to fix BCB 5.9 regression in synthesis/mem_func_ptr_cv_ptr_to_this test
................
  r42859 | t_schwinger | 2008-01-18 13:06:44 -0800 (Fri, 18 Jan 2008) | 3 lines
  
  attempts to fix pathscale failure 
................
  r42868 | niels_dekker | 2008-01-19 12:21:18 -0800 (Sat, 19 Jan 2008) | 1 line
  
  value_init_test now works around Borland 5.82 bug ("Error E2015: Ambiguity..." when using initialized_value), that is fixed with a newer compiler version
................
  r42869 | niels_dekker | 2008-01-19 12:52:04 -0800 (Sat, 19 Jan 2008) | 1 line
  
  Removed local named variable from     value_initialized::operator=, as Fernando Cacciola suggested me to avoid unnecessary named variables.
................
  r42873 | bemandawes | 2008-01-19 18:01:35 -0800 (Sat, 19 Jan 2008) | 1 line
  
  Remove extraneous defines since they are inherited from library build Jamfile
................
  r42877 | johnmaddock | 2008-01-20 01:42:35 -0800 (Sun, 20 Jan 2008) | 1 line
  
  Add include of <eh.h> for msvc.
................
  r42878 | igaztanaga | 2008-01-20 03:54:47 -0800 (Sun, 20 Jan 2008) | 5 lines
  
  Updated Interprocess and Intrusive:
  
  -> Added linear slist to intrusive
  -> Updated all allocators to version 2 allocators in Interprocess
  -> Optimized rbtree_best_fit size overhead to 1 std:size_t.
................
  r42881 | danieljames | 2008-01-20 09:37:21 -0800 (Sun, 20 Jan 2008) | 1 line
  
  Include <new> to get std::bad_alloc.
................
  r42882 | danieljames | 2008-01-20 10:55:57 -0800 (Sun, 20 Jan 2008) | 22 lines
  
  Merged revisions 42856-42881 via svnmerge from 
  https://svn.boost.org/svn/boost/branches/unordered/trunk
  
  ........
    r42880 | danieljames | 2008-01-20 16:10:43 +0000 (Sun, 20 Jan 2008) | 17 lines
    
    Simplify the tests a little:
    
    Add a parameter to random_values to control what sort of values it generates.
    This means that instead of using equivalent_object to test collisions (which
    was a total hack) we now just need another parameter.
    
    This requires some meta programming to act differently for maps and sets.
    Because of this pairs no longer need to be generated so remove the code for
    doing that (which doesn't work on some compilers).
    
    Remove the generator object, just call generate directly.
    
    Remove some of the tests using int containers, they didn't really add to
    anthing other than the compile time (some tests are timing out).
  ........
................
  r42884 | jurko | 2008-01-20 12:18:50 -0800 (Sun, 20 Jan 2008) | 5 lines
  
  Minor stylistic changes:
    * Removed trailing spaces.
    * Added a comment for code discovering the user's home-directories.
    * Removed a stale regex import.
    * Removed an old corpse 'identity' rule found inside the __test__ rule.
................
  r42890 | johnmaddock | 2008-01-21 01:41:17 -0800 (Mon, 21 Jan 2008) | 1 line
  
  Only disable wide character support for HP aCC: for gcc the logic is already taken care of in libstdcpp3.hpp.
................
  r42897 | hkaiser | 2008-01-21 08:13:31 -0800 (Mon, 21 Jan 2008) | 1 line
  
  Removed a duplicate entry.
................
  r42898 | rogeeff | 2008-01-21 09:02:53 -0800 (Mon, 21 Jan 2008) | 1 line
  
  changed output of booleans
................
  r42899 | johnmaddock | 2008-01-21 10:11:09 -0800 (Mon, 21 Jan 2008) | 1 line
  
  Updated type traits library so that everything compiles with -Wall -pedantic with GCC.
................
  r42904 | davedeakins | 2008-01-21 11:38:44 -0800 (Mon, 21 Jan 2008) | 1 line
  
  Don't include <eh.h> for WinCE (since WinCE does not have this header)
................
  r42906 | eric_niebler | 2008-01-21 12:39:35 -0800 (Mon, 21 Jan 2008) | 1 line
  
  minor clean-up
................
  r42909 | rogeeff | 2008-01-21 19:41:23 -0800 (Mon, 21 Jan 2008) | 1 line
  
  missing header
................
  r42911 | igaztanaga | 2008-01-22 08:49:22 -0800 (Tue, 22 Jan 2008) | 1 line
  
  Refactor some allocation code and fix instantiation problem in 64 bit platforms
................
  r42916 | eric_niebler | 2008-01-22 12:42:18 -0800 (Tue, 22 Jan 2008) | 1 line
  
  add concepts section to proto reference
................
  r42917 | hljin | 2008-01-22 14:10:48 -0800 (Tue, 22 Jan 2008) | 1 line
  
  GIL: fixed the problem with std::hex by adding #include <ios>
................
  r42918 | eric_niebler | 2008-01-22 18:23:15 -0800 (Tue, 22 Jan 2008) | 1 line
  
  proto works with boost 1.34.1
................
  r42929 | johnmaddock | 2008-01-23 08:08:44 -0800 (Wed, 23 Jan 2008) | 1 line
  
  Applies fix for issue #1598: added missing #include.
................
  r42931 | igaztanaga | 2008-01-23 11:34:39 -0800 (Wed, 23 Jan 2008) | 1 line
  
  Ticket #1593: [interprocess] 'streamoff' : is not a member of 'std'
................
  r42934 | andreas_huber69 | 2008-01-23 13:46:58 -0800 (Wed, 23 Jan 2008) | 1 line
  
  Fixes #1594
................
  r42935 | eric_niebler | 2008-01-23 13:57:47 -0800 (Wed, 23 Jan 2008) | 1 line
  
  fix dependency issue in Jamfile
................
  r42938 | jano_gaspar | 2008-01-23 15:04:57 -0800 (Wed, 23 Jan 2008) | 1 line
  
  circular_buffer: updated documentation
................
  r42939 | eric_niebler | 2008-01-23 15:25:24 -0800 (Wed, 23 Jan 2008) | 1 line
  
  fix quickbook scanner to recognize the [import ...] block
................
  r42943 | danieljames | 2008-01-23 15:39:59 -0800 (Wed, 23 Jan 2008) | 60 lines
  
  Merged revisions 42882-42941 via svnmerge from 
  https://svn.boost.org/svn/boost/branches/unordered/trunk
  
  ................
    r42887 | danieljames | 2008-01-20 21:32:04 +0000 (Sun, 20 Jan 2008) | 10 lines
    
    Merged revisions 42590-42664,42667-42697,42699-42723,42725-42855,42857-42881 via svnmerge from 
    https://svn.boost.org/svn/boost/trunk
    
    ........
      r42881 | danieljames | 2008-01-20 17:37:21 +0000 (Sun, 20 Jan 2008) | 1 line
      
      Include <new> to get std::bad_alloc.
    ........
  ................
    r42892 | danieljames | 2008-01-21 13:03:16 +0000 (Mon, 21 Jan 2008) | 1 line
    
    On some compilers the Rogue Wave/Apache stdcxx library doesn't have the normal std::distance, but instead has a variant that takes the result as the third parameter so it doesn't have to work out the type from the iterator.
  ................
    r42893 | danieljames | 2008-01-21 13:07:58 +0000 (Mon, 21 Jan 2008) | 1 line
    
    Fix a typo in the last commit.
  ................
    r42895 | danieljames | 2008-01-21 13:33:29 +0000 (Mon, 21 Jan 2008) | 1 line
    
    Remove tabs from the last checkin.
  ................
    r42896 | danieljames | 2008-01-21 15:51:40 +0000 (Mon, 21 Jan 2008) | 1 line
    
    Use Boost config to tell when we have a std::distance function. Also, no need for a macro.
  ................
    r42908 | danieljames | 2008-01-21 21:37:04 +0000 (Mon, 21 Jan 2008) | 1 line
    
    Use boost::long_long_type and boost::ulong_long_type.
  ................
    r42921 | danieljames | 2008-01-23 11:43:35 +0000 (Wed, 23 Jan 2008) | 1 line
    
    Remove some tabs.
  ................
    r42922 | danieljames | 2008-01-23 11:46:28 +0000 (Wed, 23 Jan 2008) | 2 lines
    
    Add missing include. Refs #1596
  ................
    r42923 | danieljames | 2008-01-23 11:52:47 +0000 (Wed, 23 Jan 2008) | 2 lines
    
    Always use void const* for the second parameter of allocate. Refs #1596.
  ................
    r42936 | danieljames | 2008-01-23 22:22:16 +0000 (Wed, 23 Jan 2008) | 1 line
    
    Use Boost style library name in the documentation.
  ................
    r42937 | danieljames | 2008-01-23 22:22:32 +0000 (Wed, 23 Jan 2008) | 1 line
    
    More tabs.
  ................
    r42941 | danieljames | 2008-01-23 23:35:01 +0000 (Wed, 23 Jan 2008) | 1 line
    
    Fix all the allocators.
  ................
................
  r42948 | turkanis | 2008-01-23 22:50:32 -0800 (Wed, 23 Jan 2008) | 1 line
  
  merged changes from iostreams_dev, revisions 42825-42947
................
  r42950 | t_schwinger | 2008-01-24 10:56:27 -0800 (Thu, 24 Jan 2008) | 3 lines
  
  correctsbroken compiler support for MPL
................
  r42951 | eric_niebler | 2008-01-24 13:06:23 -0800 (Thu, 24 Jan 2008) | 1 line
  
  peeker optimization looks inside independent sub-expressions
................
  r42952 | nesotto | 2008-01-24 14:22:35 -0800 (Thu, 24 Jan 2008) | 1 line
  
  test of output iterators
................
  r42953 | nesotto | 2008-01-24 14:26:36 -0800 (Thu, 24 Jan 2008) | 1 line
  
  output iterator test
................
  r42954 | nesotto | 2008-01-24 14:27:27 -0800 (Thu, 24 Jan 2008) | 1 line
  
  output iterators for ptr_containers 
................
  r42957 | t_schwinger | 2008-01-24 16:26:16 -0800 (Thu, 24 Jan 2008) | 3 lines
  
  simplifies preprocessing code
................
  r42958 | t_schwinger | 2008-01-24 16:28:15 -0800 (Thu, 24 Jan 2008) | 3 lines
  
  touched
................
  r42960 | noel_belcourt | 2008-01-24 20:41:16 -0800 (Thu, 24 Jan 2008) | 6 lines
  
  Changed the -soname and -shared options in intel-darwin.jam
  to use -dynamiclib and -install_name, as done in darwin.jam.
  Apparently the Intel compilers on the Mac support the same 
  options as gcc for setting the internal dynamic library name.
................
  r42963 | nesotto | 2008-01-24 23:52:14 -0800 (Thu, 24 Jan 2008) | 1 line
  
  renaming ...
................
  r42964 | nesotto | 2008-01-24 23:52:56 -0800 (Thu, 24 Jan 2008) | 1 line
  
  renaming
................
  r42965 | nesotto | 2008-01-24 23:54:28 -0800 (Thu, 24 Jan 2008) | 1 line
  
  renaming
................
  r42970 | turkanis | 2008-01-25 09:56:25 -0800 (Fri, 25 Jan 2008) | 1 line
  
  merged changes from iostreams_dev, revisions 42947-42962: fixed tickets 1003, 1139, 1140, 1149
................
  r42971 | noel_belcourt | 2008-01-25 11:52:47 -0800 (Fri, 25 Jan 2008) | 2 lines
  
  Fixed a typo to yesterdays patch.
................
  r42972 | dgregor | 2008-01-25 13:07:14 -0800 (Fri, 25 Jan 2008) | 2 lines
  
  Include <ios> to get std::boolalpha. Fixes #1586
................
  r42974 | igaztanaga | 2008-01-25 15:07:51 -0800 (Fri, 25 Jan 2008) | 4 lines
  
  1)Fixed gcc release mode warnings.
  2)Replaced throw with BOOST_RETHROW when BOOST_TRY is used.
  3)Fixed issues with singly linked lists
................
  r42976 | hkaiser | 2008-01-25 17:24:21 -0800 (Fri, 25 Jan 2008) | 2 lines
  
  Wave: Fixed a problem in flex_string::compare() (#include_next was non-functional).
................
  r42977 | hkaiser | 2008-01-25 17:36:20 -0800 (Fri, 25 Jan 2008) | 1 line
  
  Wave: Added new testcase.
................
  r42980 | hkaiser | 2008-01-25 17:44:32 -0800 (Fri, 25 Jan 2008) | 1 line
  
  Wave: Tweaked new testcase.
................
  r42982 | igaztanaga | 2008-01-26 03:52:25 -0800 (Sat, 26 Jan 2008) | 1 line
  
  Refactored common slist functions in a single class
................
  r42984 | noel_belcourt | 2008-01-26 10:35:59 -0800 (Sat, 26 Jan 2008) | 7 lines
  
  Fixes #416
  
  Fixed spelling of Jack Edmonds name and renamed files
  where necessary.  Updated the documentation as well.
  Tested changes by building/running tests in libs/graph/test.
................
  r42985 | noel_belcourt | 2008-01-26 10:51:28 -0800 (Sat, 26 Jan 2008) | 5 lines
  
  Fixes #640
  
  Corrected the mpl push_front html documentation.
................
  r42986 | eric_niebler | 2008-01-26 11:38:44 -0800 (Sat, 26 Jan 2008) | 1 line
  
  optimize repeated searches with patterns that have leading repeats
................
  r42987 | t_schwinger | 2008-01-26 13:50:14 -0800 (Sat, 26 Jan 2008) | 3 lines
  
  attempts to allow some preprocessing with VACPP (IBM)
................
  r42988 | noel_belcourt | 2008-01-26 14:21:57 -0800 (Sat, 26 Jan 2008) | 5 lines
  
  Fixes #1539
  
  Fixed typo in the random documentation.
................
  r42989 | noel_belcourt | 2008-01-26 15:06:24 -0800 (Sat, 26 Jan 2008) | 6 lines
  
  Fixes #965
  
  Patched the XML and will check to ensure the html
  page reflects this change.
................
  r42990 | eric_niebler | 2008-01-26 21:56:46 -0800 (Sat, 26 Jan 2008) | 1 line
  
  updated vcproj
................
  r42991 | eric_niebler | 2008-01-26 21:57:08 -0800 (Sat, 26 Jan 2008) | 1 line
  
  fix typo
................
  r42992 | johnmaddock | 2008-01-27 10:43:35 -0800 (Sun, 27 Jan 2008) | 1 line
  
  Extended leading repeat optimization to more cases.
................
  r42997 | vladimir_prus | 2008-01-28 09:59:27 -0800 (Mon, 28 Jan 2008) | 1 line
  
  Correct speliing of --build-dir in --help output
................
  r43000 | eric_niebler | 2008-01-28 12:03:41 -0800 (Mon, 28 Jan 2008) | 1 line
  
  update acknowledgement of john maddock
................
  r43001 | bgubenko | 2008-01-28 13:27:13 -0800 (Mon, 28 Jan 2008) | 1 line
  
  marked 2 asio library tests for gcc-4.2.1_hpux_ia64 (HP-UX 11.23 with gcc)
................
  r43002 | eric_niebler | 2008-01-28 14:55:30 -0800 (Mon, 28 Jan 2008) | 1 line
  
  doc more concepts, misc clean-up
................
  r43003 | eric_niebler | 2008-01-28 14:56:46 -0800 (Mon, 28 Jan 2008) | 1 line
  
  proto doxygen comments, misc clean-up
................
  r43006 | eric_niebler | 2008-01-28 18:20:45 -0800 (Mon, 28 Jan 2008) | 1 line
  
  more proto doxygen comments, update copyright
................
  r43007 | vladimir_prus | 2008-01-28 22:28:09 -0800 (Mon, 28 Jan 2008) | 1 line
  
  Retain top-level boost-build.jam
................
  r43008 | vladimir_prus | 2008-01-28 22:40:06 -0800 (Mon, 28 Jan 2008) | 4 lines
  
  Disable relinking when <target-os> is either windows or cygwin.
  
  Fixes #1062.
................
  r43009 | eric_niebler | 2008-01-28 23:03:03 -0800 (Mon, 28 Jan 2008) | 1 line
  
  add tests for deep_copy, make_expr, unpack_expr; fix bugs; update more copyrights
................
  r43012 | djenkins | 2008-01-29 08:41:12 -0800 (Tue, 29 Jan 2008) | 1 line
  
  fix typo
................
  r43013 | djenkins | 2008-01-29 08:43:51 -0800 (Tue, 29 Jan 2008) | 1 line
  
  update copyright and misc cleanup
................
  r43014 | bgubenko | 2008-01-29 09:47:01 -0800 (Tue, 29 Jan 2008) | 1 line
  
  marked interprocess library unusable on gcc-4.2.1_hpux_ia64 (until it is ported to HP-UX platform)
................
  r43016 | eric_niebler | 2008-01-29 13:02:52 -0800 (Tue, 29 Jan 2008) | 1 line
  
  make_expr and unpack_expr improvements, fix scary transform::arg_c bug
................
  r43018 | djenkins | 2008-01-29 19:39:02 -0800 (Tue, 29 Jan 2008) | 1 line
  
  use skip directive to simplify example
................
  r43023 | eric_niebler | 2008-01-30 14:10:13 -0800 (Wed, 30 Jan 2008) | 1 line
  
  finally, a make_expr() I can live with
................
  r43024 | eric_niebler | 2008-01-30 14:26:34 -0800 (Wed, 30 Jan 2008) | 1 line
  
  regenerated boostbook reference
................
  r43025 | niels_dekker | 2008-01-30 14:42:23 -0800 (Wed, 30 Jan 2008) | 1 line
  
  value_init: Removed aligned_storage::address() calls, to improve TR1 compatibility, as confirmed by John Maddock. Added internal helper function, wrapper_address(), as discussed with Fernando.
................
  r43026 | eric_niebler | 2008-01-30 15:03:36 -0800 (Wed, 30 Jan 2008) | 1 line
  
  minor tweak to make_expr result_of return type calculation
................
  r43031 | eric_niebler | 2008-01-30 23:36:28 -0800 (Wed, 30 Jan 2008) | 1 line
  
  simplify make_expr.hpp, user docs for make_expr()
................
  r43035 | eric_niebler | 2008-01-31 10:44:17 -0800 (Thu, 31 Jan 2008) | 1 line
  
  minor tweak to fusion value_of and value_at for expressions, for better interop with proto::unpack_expr
................
  r43037 | vladimir_prus | 2008-01-31 11:47:12 -0800 (Thu, 31 Jan 2008) | 1 line
  
  Build in MT mode (as long as wave links to boost.thread)
................
  r43038 | hkaiser | 2008-01-31 12:57:47 -0800 (Thu, 31 Jan 2008) | 1 line
  
  Wave: fixed expanding_function_like_macro()
................
  r43040 | eric_niebler | 2008-01-31 13:12:44 -0800 (Thu, 31 Jan 2008) | 1 line
  
  finish documentation for expression construction utilities
................
  r43041 | hkaiser | 2008-01-31 14:33:43 -0800 (Thu, 31 Jan 2008) | 1 line
  
  Wave: Added additional configuration possibility to allow control threading support.
................
  r43042 | hkaiser | 2008-01-31 14:48:56 -0800 (Thu, 31 Jan 2008) | 1 line
  
  Wave: Added additional configuration possibility to allow control threading support. Updated the documentation.
................
  r43043 | jurko | 2008-01-31 16:27:31 -0800 (Thu, 31 Jan 2008) | 1 line
  
  Reverted changes made in rev 43038 which seem to have been committed by mistake and include some user specific settings in it local to the comitter's environment while this file is intended to be used as generic template for actual user-config.jam files and do nothing in case user does not specify his own settings there.
................
  r43044 | jurko | 2008-01-31 16:44:23 -0800 (Thu, 31 Jan 2008) | 1 line
  
  Minor stylistic spacing changes. Remove trailing spaces.
................
  r43045 | jurko | 2008-01-31 16:46:50 -0800 (Thu, 31 Jan 2008) | 1 line
  
  Corrected outputting native Windows paths so that it works correctly for absolute paths without the drive letter being explicitly specified, e.g. \aaa\bbb or /aaa/bbb.
................
  r43046 | jurko | 2008-01-31 17:49:16 -0800 (Thu, 31 Jan 2008) | 1 line
  
  Added the missing end-of-line character when outputting DEBUG_SEARCH debug messages from file_build1(). This cleans up the -d+6 bjam output a lot.
................
  r43050 | eric_niebler | 2008-02-01 12:30:29 -0800 (Fri, 01 Feb 2008) | 1 line
  
  add future group example
................
  r43052 | noel_belcourt | 2008-02-01 18:41:23 -0800 (Fri, 01 Feb 2008) | 4 lines
  
  Fix a typo in pgi.jam that prevented shared libraries
  from being built correctly.
................
  r43054 | chris_kohlhoff | 2008-02-02 03:37:45 -0800 (Sat, 02 Feb 2008) | 4 lines
  
  Ensure that the workaround for the MSVC secure iterator problem is only
  used when compiling with MSVC. The workaround causes g++'s library debug
  mode to report errors due to the assignment from a singular iterator.
................
  r43055 | chris_kohlhoff | 2008-02-02 03:39:17 -0800 (Sat, 02 Feb 2008) | 2 lines
  
  Fix "possible loss of data" warning when building for Windows 2000 targets.
................
  r43056 | chris_kohlhoff | 2008-02-02 04:02:23 -0800 (Sat, 02 Feb 2008) | 3 lines
  
  The latest Windows SDKs don't support IPv6 when building for Windows 2000,
  so we need to use the SDK emulation in that case.
................
  r43057 | eric_niebler | 2008-02-02 04:27:16 -0800 (Sat, 02 Feb 2008) | 1 line
  
  port test to boost version 1.34.1
................
  r43061 | turkanis | 2008-02-02 14:10:46 -0800 (Sat, 02 Feb 2008) | 1 line
  
  merged changes from iostreams_dev, revisions 42962-43059: updated copyright notices
................
  r43080 | eric_niebler | 2008-02-03 10:40:03 -0800 (Sun, 03 Feb 2008) | 1 line
  
  fix bug found by L. Evans re: fusion and stateful function objects
................
  r43083 | johnmaddock | 2008-02-04 01:13:36 -0800 (Mon, 04 Feb 2008) | 1 line
  
  Added missing file.
................
  r43085 | johnmaddock | 2008-02-04 01:17:35 -0800 (Mon, 04 Feb 2008) | 1 line
  
  Removed dead file.
................
  r43087 | johnmaddock | 2008-02-04 01:20:46 -0800 (Mon, 04 Feb 2008) | 1 line
  
  Removed dead files.
................
  r43089 | johnmaddock | 2008-02-04 01:23:28 -0800 (Mon, 04 Feb 2008) | 1 line
  
  Removed dead files.
................
  r43094 | anthonyw | 2008-02-04 05:16:32 -0800 (Mon, 04 Feb 2008) | 1 line
  
  added test for duration overloads of timed_lock, and added missing implementation to win32 version
................
  r43101 | hkaiser | 2008-02-04 11:21:46 -0800 (Mon, 04 Feb 2008) | 1 line
  
  Wave: trying to fix stdcxx_gcc regression.
................
  r43103 | matias | 2008-02-04 13:01:06 -0800 (Mon, 04 Feb 2008) | 1 line
  
  hooking --> additional information in html docs
................
  r43106 | eric_niebler | 2008-02-04 18:09:51 -0800 (Mon, 04 Feb 2008) | 1 line
  
  fleshing out evaluation.qbk, document transforms of if_, not_, and_ and or_
................
  r43107 | eric_niebler | 2008-02-04 21:33:12 -0800 (Mon, 04 Feb 2008) | 1 line
  
  eliminate warnings under msvc's -W4
................
  r43111 | eric_niebler | 2008-02-04 22:03:01 -0800 (Mon, 04 Feb 2008) | 1 line
  
  fix typo
................
  r43112 | marshall | 2008-02-05 08:07:19 -0800 (Tue, 05 Feb 2008) | 1 line
  
  Fix typo (bug #1434)
................
  r43113 | marshall | 2008-02-05 08:15:35 -0800 (Tue, 05 Feb 2008) | 1 line
  
  Applied patch (fixes bug #1307)
................
  r43117 | dgregor | 2008-02-05 12:51:23 -0800 (Tue, 05 Feb 2008) | 1 line
  
  Fix add_vertex and add_vertices when the CSR graph has vertex properties
................
  r43118 | danieljames | 2008-02-05 12:57:02 -0800 (Tue, 05 Feb 2008) | 13 lines
  
  Merged revisions 42942-43116 via svnmerge from 
  https://svn.boost.org/svn/boost/branches/unordered/trunk
  
  ........
    r42975 | danieljames | 2008-01-26 00:29:32 +0000 (Sat, 26 Jan 2008) | 1 line
    
    Typedef some types before using them, to make life easier for Borland.
  ........
    r43116 | danieljames | 2008-02-05 20:47:44 +0000 (Tue, 05 Feb 2008) | 1 line
    
    Some compilers and libraries combinations have problems with deques of non-assingable types. Using a list instead.
  ........
................
  r43120 | eric_niebler | 2008-02-05 13:07:31 -0800 (Tue, 05 Feb 2008) | 1 line
  
  add missing #include
................
  r43121 | bemandawes | 2008-02-05 18:01:46 -0800 (Tue, 05 Feb 2008) | 1 line
  
  Add circular_buffer to the alphabetic list
................
  r43125 | t_schwinger | 2008-02-06 05:00:08 -0800 (Wed, 06 Feb 2008) | 3 lines
  
  attempts to make synthesis metafunctions work with sun compiler
................
  r43129 | danieljames | 2008-02-06 11:02:38 -0800 (Wed, 06 Feb 2008) | 2 lines
  
  In the boostbook navbar, link FAQ and people to the website.
................
  r43130 | eric_niebler | 2008-02-06 11:57:51 -0800 (Wed, 06 Feb 2008) | 1 line
  
  untabify
................
  r43132 | nesotto | 2008-02-06 14:46:19 -0800 (Wed, 06 Feb 2008) | 1 line
  
  cleanup to pass inspection report
................
  r43133 | nesotto | 2008-02-06 14:46:31 -0800 (Wed, 06 Feb 2008) | 1 line
  
  cleanup to pass inspection report
................
  r43134 | eric_niebler | 2008-02-06 14:57:57 -0800 (Wed, 06 Feb 2008) | 1 line
  
  add handy get() accessors on literal<> wrapper
................
  r43135 | nesotto | 2008-02-06 15:12:21 -0800 (Wed, 06 Feb 2008) | 1 line
  
  cleanup to pass inspection tool
................
  r43136 | eric_niebler | 2008-02-06 16:05:01 -0800 (Wed, 06 Feb 2008) | 1 line
  
  reasonably complete user docs for expression evaluation
................
  r43138 | eric_niebler | 2008-02-07 00:06:29 -0800 (Thu, 07 Feb 2008) | 1 line
  
  tweaks for doxygen 1.5.4, document matches<>
................
  r43141 | johnmaddock | 2008-02-07 01:55:41 -0800 (Thu, 07 Feb 2008) | 1 line
  
  Fix last checked version.
................
  r43143 | johnmaddock | 2008-02-07 02:03:16 -0800 (Thu, 07 Feb 2008) | 1 line
  
  Remove tabs.
................
  r43145 | johnmaddock | 2008-02-07 02:13:31 -0800 (Thu, 07 Feb 2008) | 1 line
  
  Fix min/max usage violation.
................
  r43147 | vladimir_prus | 2008-02-07 02:17:03 -0800 (Thu, 07 Feb 2008) | 2 lines
  
  Attempt to unbreak <library-file>
................
  r43148 | johnmaddock | 2008-02-07 02:24:29 -0800 (Thu, 07 Feb 2008) | 1 line
  
  Added comment to suppress inspect warning.
................
  r43150 | johnmaddock | 2008-02-07 02:29:59 -0800 (Thu, 07 Feb 2008) | 1 line
  
  Added fix for inspection report.
................
  r43152 | vladimir_prus | 2008-02-07 03:04:30 -0800 (Thu, 07 Feb 2008) | 4 lines
  
  Fix <framework> with no path.
  
  Patch from Jon Olsson.
................
  r43154 | bemandawes | 2008-02-07 05:22:34 -0800 (Thu, 07 Feb 2008) | 1 line
  
  Remove obsolete CVS scripts, add 1.35.0 SVN scripts, beginning of docs page
................
  r43155 | nesotto | 2008-02-07 06:41:04 -0800 (Thu, 07 Feb 2008) | 6 lines
  
  
  iterator_range disables msvc warning 4996
      <http://svn.boost.org/trac/boost/ticket/1565>
  
  [range] sub_range assignment issue
      <http://svn.boost.org/trac/boost/ticket/1284> 
................
  r43156 | nesotto | 2008-02-07 06:46:19 -0800 (Thu, 07 Feb 2008) | 1 line
  
  test
................
  r43157 | joaquin | 2008-02-07 08:29:27 -0800 (Thu, 07 Feb 2008) | 1 line
  
  updated according to latest regression tests results, fixed a broken link, typo
................
  r43159 | turkanis | 2008-02-07 09:07:28 -0800 (Thu, 07 Feb 2008) | 1 line
  
  added missing 'self.' qualification
................
  r43165 | dgregor | 2008-02-07 13:08:09 -0800 (Thu, 07 Feb 2008) | 1 line
  
  Support for non-blocking MPI operations in Python, from Andreas Kloeckner
................
  r43166 | dgregor | 2008-02-07 13:09:38 -0800 (Thu, 07 Feb 2008) | 1 line
  
  Note addition of nonblocking operations to the Python interface
................
  r43171 | nesotto | 2008-02-08 01:58:35 -0800 (Fri, 08 Feb 2008) | 1 line
  
  silence of warnings for unused arguments
................
  r43175 | nesotto | 2008-02-08 07:25:01 -0800 (Fri, 08 Feb 2008) | 1 line
  
  missing ) fixed
................
  r43176 | noel_belcourt | 2008-02-08 08:32:35 -0800 (Fri, 08 Feb 2008) | 14 lines
  
  Force PPC Darwin to use fork instead of vfork.  This change
  requires both the parent and child process to explicitly set
  the process group id. Vfork guarantees the child process 
  runs to the exec before it releases the parent process.  
  Now that we use fork instead of vfork, it's possible for the 
  parent to wait on the child process without having the child 
  setpgid on itself.  This eliminates spurious hangs on ppc
  darwin caused by either a race condition between vfork and
  execvp, or a bug in the vfork implementation.
  
  Added a test to ensure we don't try to read from the
  stderr pipe descriptor if the descriptor's not valid.
................
  r43177 | eric_niebler | 2008-02-08 09:11:57 -0800 (Fri, 08 Feb 2008) | 1 line
  
  reserve some c_type bits for dinkumware on windows, fixes #1625
................
  r43179 | noel_belcourt | 2008-02-08 09:53:50 -0800 (Fri, 08 Feb 2008) | 13 lines
  
  I've added the -single_module option to the intel-darwin.link.dll
  action to fix this linker error when linking dylibs:
  
  ld: common symbols not allowed with MH_DYLIB output format with the -multi_module option
  boost/bin.v2/libs/system/build/intel-darwin-9.1/debug/macosx-version-10.4/error_code.o 
    definition of common __ZGVZNK5boost6system14error_category7messageEiE1s (size 16)
  boost/bin.v2/libs/system/build/intel-darwin-9.1/debug/macosx-version-10.4/error_code.o 
    definition of common __ZZNK5boost6system14error_category7messageEiE1s (size 16)
  
  though I would note that the common symbols problem occurs in a number of
  other libraries (test, graph, spirit, ...) as well.
................
  r43188 | danieljames | 2008-02-09 04:29:02 -0800 (Sat, 09 Feb 2008) | 2 lines
  
  Fix a link in the intrusive redirect.
................
  r43189 | danieljames | 2008-02-09 04:37:00 -0800 (Sat, 09 Feb 2008) | 1 line
  
  Fix another redirect link.
................
  r43190 | danieljames | 2008-02-09 04:38:19 -0800 (Sat, 09 Feb 2008) | 1 line
  
  Update link to Jamfile, to link to the version 2 jamfile.
................
  r43191 | danieljames | 2008-02-09 04:39:06 -0800 (Sat, 09 Feb 2008) | 1 line
  
  Fix a link.
................
  r43192 | danieljames | 2008-02-09 04:45:32 -0800 (Sat, 09 Feb 2008) | 2 lines
  
  Add a forwarding header for hash/custom.html as Boost.Bimap links to it.
................
  r43193 | danieljames | 2008-02-09 05:02:45 -0800 (Sat, 09 Feb 2008) | 1 line
  
  Fix the link to the license.
................
  r43199 | eric_niebler | 2008-02-09 12:32:27 -0800 (Sat, 09 Feb 2008) | 1 line
  
  more doxygen comments, const-correctness tweak for fusion::at() on proto expression
................
  r43200 | eric_niebler | 2008-02-09 12:34:33 -0800 (Sat, 09 Feb 2008) | 1 line
  
  document how to access children of proto expressions
................
  r43204 | eric_niebler | 2008-02-09 22:57:24 -0800 (Sat, 09 Feb 2008) | 1 line
  
  fix oops in proto fusion interface
................
  r43205 | eric_niebler | 2008-02-09 23:02:54 -0800 (Sat, 09 Feb 2008) | 1 line
  
  suppress msvc warning
................
  r43206 | danieljames | 2008-02-10 01:55:03 -0800 (Sun, 10 Feb 2008) | 1 line
  
  Fix some broken links.
................
  r43207 | vladimir_prus | 2008-02-10 05:13:41 -0800 (Sun, 10 Feb 2008) | 4 lines
  
  Tolerate argc being zero.
  
  Patch from C. K. Jester-Young.
................
  r43209 | danieljames | 2008-02-10 06:56:22 -0800 (Sun, 10 Feb 2008) | 1 line
  
  Link to people pages on the website, as they've been removed from the download.
................
  r43210 | danieljames | 2008-02-10 07:02:17 -0800 (Sun, 10 Feb 2008) | 1 line
  
  Point links to the pages that used to be in 'more' to the site.
................
  r43212 | danieljames | 2008-02-10 08:10:16 -0800 (Sun, 10 Feb 2008) | 1 line
  
  Fix links on the home page as well.
................
  r43213 | danieljames | 2008-02-10 08:21:22 -0800 (Sun, 10 Feb 2008) | 1 line
  
  Generated documentation which is no longer generated.
................
  r43220 | eric_niebler | 2008-02-10 19:48:41 -0800 (Sun, 10 Feb 2008) | 1 line
  
  include config.hpp and workaround.hpp before uses of BOOST_WORKAROUND and BOOST_MSVC
................
  r43221 | chris_kohlhoff | 2008-02-11 05:59:44 -0800 (Mon, 11 Feb 2008) | 2 lines
  
  Need to define _XOPEN_SOURCE_EXTENDED when compiling for HP-UX.
................
  r43226 | djenkins | 2008-02-11 12:49:19 -0800 (Mon, 11 Feb 2008) | 1 line
  
  cleanup using local<> and skip()
................
  r43239 | turkanis | 2008-02-12 21:43:39 -0800 (Tue, 12 Feb 2008) | 1 line
  
  fixed return value of read(), to correctly handle eof
................
  r43240 | turkanis | 2008-02-12 21:47:44 -0800 (Tue, 12 Feb 2008) | 1 line
  
  merged changes from iostreams_dev, revisions 43059-43238: better debug output for mapped file; fixed large_file_test.cpp under UNICODE on Windows
................
  r43241 | turkanis | 2008-02-13 11:38:52 -0800 (Wed, 13 Feb 2008) | 1 line
  
  added markup for stdcxx failures (iostreams)
................
  r43243 | turkanis | 2008-02-13 11:42:10 -0800 (Wed, 13 Feb 2008) | 1 line
  
  switched from <wchar.h> to <cwchar>, for stdcxx (which is conforming in this case)
................
  r43246 | matias | 2008-02-14 09:33:12 -0800 (Thu, 14 Feb 2008) | 1 line
  
  remove local admonitions
................
  r43247 | matias | 2008-02-14 09:43:52 -0800 (Thu, 14 Feb 2008) | 1 line
  
  optional docs fixes
................
  r43248 | matias | 2008-02-14 09:44:21 -0800 (Thu, 14 Feb 2008) | 1 line
  
  redirect optional docs to new version
................
  r43251 | matias | 2008-02-14 10:08:16 -0800 (Thu, 14 Feb 2008) | 1 line
  
  conversion docs fixes
................
  r43252 | matias | 2008-02-14 10:09:34 -0800 (Thu, 14 Feb 2008) | 1 line
  
  redirect to new conversion docs
................
  r43253 | matias | 2008-02-14 10:19:34 -0800 (Thu, 14 Feb 2008) | 1 line
  
  redirect optional and numeric/conversion docs to new version
................
  r43254 | matias | 2008-02-14 11:03:55 -0800 (Thu, 14 Feb 2008) | 1 line
  
  bimap doc fixes
................
  r43255 | matias | 2008-02-14 11:05:04 -0800 (Thu, 14 Feb 2008) | 1 line
  
  fix tabs in files
................
  r43256 | matias | 2008-02-14 11:22:15 -0800 (Thu, 14 Feb 2008) | 1 line
  
  fix tabs in files
................
  r43260 | matias | 2008-02-14 13:24:11 -0800 (Thu, 14 Feb 2008) | 1 line
  
  add missing images
................
  r43262 | hkaiser | 2008-02-14 14:01:54 -0800 (Thu, 14 Feb 2008) | 1 line
  
  Fixed a whitespace insertion glitch, where whitespace got inserted unconditionally between two operators even if one of these was a comma.
................
  r43264 | hkaiser | 2008-02-14 15:52:33 -0800 (Thu, 14 Feb 2008) | 1 line
  
  Wave: More fixes to whitespace insertion engine.
................
  r43266 | hkaiser | 2008-02-15 06:35:36 -0800 (Fri, 15 Feb 2008) | 1 line
  
  Wave: More fixes to whitespace insertion engine.
................
  r43269 | pdimov | 2008-02-15 10:40:36 -0800 (Fri, 15 Feb 2008) | 1 line
  
  Added support for &&, ||
................
  r43272 | andreas_huber69 | 2008-02-16 02:13:08 -0800 (Sat, 16 Feb 2008) | 1 line
  
  Updated statechart markup
................
  r43274 | andreas_huber69 | 2008-02-16 02:19:49 -0800 (Sat, 16 Feb 2008) | 2 lines
  
  Silenced GCC 4.0.1 warning (patch supplied by Euan)
  <http://thread.gmane.org/gmane.comp.lib.boost.devel/171071>
................
  r43280 | jurko | 2008-02-16 08:50:42 -0800 (Sat, 16 Feb 2008) | 1 line
  
  Corrected comments related to the allowed linker & linker-type values. Minor stylistic changes.
................
  r43281 | jurko | 2008-02-16 08:53:33 -0800 (Sat, 16 Feb 2008) | 1 line
  
  Added support for compiling C++ programs without RTTI support using the gcc toolset.
................
  r43282 | jurko | 2008-02-16 09:03:54 -0800 (Sat, 16 Feb 2008) | 1 line
  
  Made the msvc toolset always explicitly enable or disable rtti support based on the <rtti> feature value instead of only setting it if <rtti>on and depending on it being disabled by default. The original behaviour did not work well with msvc 8.0 for which there was not way to disable rtti support as that compiler enables rtti support by default.
................
  r43283 | bemandawes | 2008-02-16 18:01:32 -0800 (Sat, 16 Feb 2008) | 1 line
  
  Show output of example program
................
  r43290 | hkaiser | 2008-02-17 08:45:08 -0800 (Sun, 17 Feb 2008) | 1 line
  
  Wave: Extended a workaround to newest Intel compiler version (Linux V10.1)
................
  r43292 | nesotto | 2008-02-17 08:49:38 -0800 (Sun, 17 Feb 2008) | 1 line
  
  support for comparinson operators
................
  r43293 | nesotto | 2008-02-17 08:50:02 -0800 (Sun, 17 Feb 2008) | 1 line
  
  support for comparison operators
................
  r43294 | hkaiser | 2008-02-17 09:00:20 -0800 (Sun, 17 Feb 2008) | 1 line
  
  Wave: Fixed test cases to reflect recent changes to whitespace insertion.
................
  r43296 | eric_niebler | 2008-02-17 12:53:18 -0800 (Sun, 17 Feb 2008) | 1 line
  
  proto documentation improvements
................
  r43299 | turkanis | 2008-02-17 21:48:13 -0800 (Sun, 17 Feb 2008) | 1 line
  
  merged changes from iostreams_dev, revisions 43243-43298: overhaul of category_of and close(): stringstream is now dual_seekable; standard file streams and string streams are closable; public Boost.Iostreams streams and streambufs are closable; close() pops filtering streams and streambufs
................
  r43300 | eric_niebler | 2008-02-17 22:16:27 -0800 (Sun, 17 Feb 2008) | 1 line
  
  remove dependence on boost.lambda, make numeric function objects work with std binders
................
  r43301 | chris_kohlhoff | 2008-02-18 05:31:26 -0800 (Mon, 18 Feb 2008) | 2 lines
  
  Fix printing of error messages.
................
  r43302 | chris_kohlhoff | 2008-02-18 05:33:23 -0800 (Mon, 18 Feb 2008) | 2 lines
  
  Only define _XOPEN_SOURCE_EXTENDED when building with gcc on HP-UX.
................
  r43303 | chris_kohlhoff | 2008-02-18 05:35:15 -0800 (Mon, 18 Feb 2008) | 3 lines
  
  Add missing #include of socket_types.hpp needed for the SSL unit tests
  to compile successfully on Windows.
................
  r43306 | eric_niebler | 2008-02-18 10:29:29 -0800 (Mon, 18 Feb 2008) | 1 line
  
  remove post_construct docs, fix link to boost.parameter library
................
  r43308 | niels_dekker | 2008-02-18 14:11:19 -0800 (Mon, 18 Feb 2008) | 1 line
  
  Fixed the assignment of value_initialized<T> for T being a C-style array. (The previous version would trigger a compile error in this case.)
................
  r43309 | niels_dekker | 2008-02-18 14:13:21 -0800 (Mon, 18 Feb 2008) | 1 line
  
  Tested the assignment of value_initialized<T>, for T being a C-style array. Related to the fix of changeset [43308]
................
  r43310 | eric_niebler | 2008-02-18 15:03:23 -0800 (Mon, 18 Feb 2008) | 1 line
  
  some doxygen comments for proto/traits.hpp
................
  r43311 | eric_niebler | 2008-02-18 21:56:52 -0800 (Mon, 18 Feb 2008) | 1 line
  
  more proto documentation tweaks, remove unnecessary result_of::arg_c instantiation
................
  r43312 | eric_niebler | 2008-02-18 23:14:37 -0800 (Mon, 18 Feb 2008) | 1 line
  
  fix droppable accumulators
................
  r43314 | eric_niebler | 2008-02-18 23:33:30 -0800 (Mon, 18 Feb 2008) | 1 line
  
  darn, back out bad droppable changes
................
  r43316 | pdimov | 2008-02-19 05:18:58 -0800 (Tue, 19 Feb 2008) | 1 line
  
  Fixes #1590.
................
  r43317 | pdimov | 2008-02-19 06:01:13 -0800 (Tue, 19 Feb 2008) | 1 line
  
  Fixes #1444.
................
  r43318 | pdimov | 2008-02-19 06:26:36 -0800 (Tue, 19 Feb 2008) | 1 line
  
  Fix #398, as long as the macros BOOST_NO_STD_TYPEINFO and BOOST_NO_IOSTREAM are defined. I don't know how Boost.Config needs to be changed to autodetect eVC4 and set these on its own.
................
  r43319 | pdimov | 2008-02-19 06:51:10 -0800 (Tue, 19 Feb 2008) | 1 line
  
  Fix #1641.
................
  r43320 | pdimov | 2008-02-19 06:59:28 -0800 (Tue, 19 Feb 2008) | 1 line
  
  Fix #1646.
................
  r43321 | pdimov | 2008-02-19 07:09:10 -0800 (Tue, 19 Feb 2008) | 1 line
  
  Fix #1642.
................
  r43322 | nesotto | 2008-02-19 07:10:05 -0800 (Tue, 19 Feb 2008) | 1 line
  
  fixed problem with operator()() when the value_type was abstract.
................
  r43323 | pdimov | 2008-02-19 07:40:58 -0800 (Tue, 19 Feb 2008) | 1 line
  
  Fix #1643.
................
  r43325 | turkanis | 2008-02-19 11:34:07 -0800 (Tue, 19 Feb 2008) | 1 line
  
  stringstreams are no longer closable; the semantics of close() for these devices was illconsidered
................
  r43328 | turkanis | 2008-02-19 16:09:06 -0800 (Tue, 19 Feb 2008) | 1 line
  
  menu fix from iostreams_dev
................
  r43329 | turkanis | 2008-02-19 19:20:17 -0800 (Tue, 19 Feb 2008) | 1 line
  
  markup for pgi-7.0 (iostreams)
................
  r43330 | bemandawes | 2008-02-20 05:46:49 -0800 (Wed, 20 Feb 2008) | 1 line
  
  Add .z7 archive generation
................
  r43332 | grafik | 2008-02-20 09:32:09 -0800 (Wed, 20 Feb 2008) | 1 line
  
  New readme page for now standalone release.
................
  r43334 | grafik | 2008-02-20 11:15:16 -0800 (Wed, 20 Feb 2008) | 1 line
  
  Fix link to getting started docs.
................
  r43335 | grafik | 2008-02-20 14:50:03 -0800 (Wed, 20 Feb 2008) | 1 line
  
  Add the <python.interpreter> to all requirements to allow other toolsets to use the currently configured python instead of relying on python being in the path.
................
  r43336 | grafik | 2008-02-20 15:01:43 -0800 (Wed, 20 Feb 2008) | 1 line
  
  Use the configured python interpreter instead of assuming it's in the path.
................
  r43337 | grafik | 2008-02-20 15:03:28 -0800 (Wed, 20 Feb 2008) | 1 line
  
  Add missing, and assumed, white background for screen rendering.
................
  r43338 | grafik | 2008-02-20 15:26:58 -0800 (Wed, 20 Feb 2008) | 1 line
  
  Doc cleanups.
................
  r43344 | eric_niebler | 2008-02-20 23:18:24 -0800 (Wed, 20 Feb 2008) | 1 line
  
  More Proto documentation
................
  r43346 | johnmaddock | 2008-02-21 02:37:59 -0800 (Thu, 21 Feb 2008) | 3 lines
  
  Fix typo in example.
  Added links to PDF versions of the docs.
  Regenerated all the docs to fix people links.
................
  r43347 | johnmaddock | 2008-02-21 03:53:59 -0800 (Thu, 21 Feb 2008) | 1 line
  
  Update main overview page.
................
  r43349 | bemandawes | 2008-02-21 04:46:11 -0800 (Thu, 21 Feb 2008) | 1 line
  
  Fix typo; .z7 should be .7z
................
  r43351 | johnmaddock | 2008-02-21 04:58:15 -0800 (Thu, 21 Feb 2008) | 1 line
  
  Added link to PDF docs, and regenerated.
................
  r43354 | johnmaddock | 2008-02-21 05:51:18 -0800 (Thu, 21 Feb 2008) | 1 line
  
  Added link to PDF docs, and regenerated.
................
  r43357 | johnmaddock | 2008-02-21 08:49:59 -0800 (Thu, 21 Feb 2008) | 1 line
  
  Added link to PDF docs.
................
  r43359 | johnmaddock | 2008-02-21 09:01:26 -0800 (Thu, 21 Feb 2008) | 1 line
  
  Regenerated docs to fix links.
................
  r43361 | bemandawes | 2008-02-21 12:11:32 -0800 (Thu, 21 Feb 2008) | 1 line
  
  Fix still another typo
................
  r43362 | eric_niebler | 2008-02-21 12:12:02 -0800 (Thu, 21 Feb 2008) | 1 line
  
  doxygen comments for proto::when<>
................
  r43363 | eric_niebler | 2008-02-21 16:42:12 -0800 (Thu, 21 Feb 2008) | 1 line
  
  fix crash when actions are in keep() expressions
................
  r43364 | eric_niebler | 2008-02-21 18:01:46 -0800 (Thu, 21 Feb 2008) | 1 line
  
  doxygen comments
................
  r43365 | grafik | 2008-02-21 21:26:39 -0800 (Thu, 21 Feb 2008) | 1 line
  
  Rename readme.html to index.html, and add forwarding index.htm for backward compatibility.
................
  r43368 | danieljames | 2008-02-22 01:21:22 -0800 (Fri, 22 Feb 2008) | 2 lines
  
  Update the index.html link in the navbar.
................
  r43371 | grafik | 2008-02-22 08:25:21 -0800 (Fri, 22 Feb 2008) | 1 line
  
  Remove obsolete getting started files. They where replaced by more/getting_started/*.
................
  r43377 | chris_kohlhoff | 2008-02-22 14:43:54 -0800 (Fri, 22 Feb 2008) | 2 lines
  
  Use the correct vector of timer queues when dispatching timers.
................
  r43390 | turkanis | 2008-02-22 16:05:49 -0800 (Fri, 22 Feb 2008) | 2 lines
  
  Ported change from iostreams_dev
................
  r43391 | turkanis | 2008-02-22 16:06:24 -0800 (Fri, 22 Feb 2008) | 2 lines
  
  Ported changes from iostreams_dev
................
  r43392 | turkanis | 2008-02-22 16:07:13 -0800 (Fri, 22 Feb 2008) | 1 line
  
  merged changes from iostreams_dev, revisions 43327-43389
................
  r43393 | turkanis | 2008-02-22 16:11:07 -0800 (Fri, 22 Feb 2008) | 1 line
  
  merged changes from iostreams_dev
................
  r43395 | turkanis | 2008-02-22 22:07:59 -0800 (Fri, 22 Feb 2008) | 1 line
  
  updated to test close() on filtering streambufs
................
  r43399 | turkanis | 2008-02-22 23:44:58 -0800 (Fri, 22 Feb 2008) | 1 line
  
  merged changes from iostreams_dev
................
  r43402 | bemandawes | 2008-02-23 06:04:02 -0800 (Sat, 23 Feb 2008) | 1 line
  
  Give the 1st and 2nd level index.html files a common look-and-feel.
................
  r43405 | vladimir_prus | 2008-02-24 04:59:04 -0800 (Sun, 24 Feb 2008) | 3 lines
  
  Recognize that fact, for that for intel-win, <runtime-debuggin>
  matters and should be added to the library name.
................
  r43409 | bemandawes | 2008-02-24 16:53:26 -0800 (Sun, 24 Feb 2008) | 1 line
  
  Fix html boo boo
................
  r43410 | schoepflin | 2008-02-25 00:37:10 -0800 (Mon, 25 Feb 2008) | 1 line
  
  Added missing template keyword.
................
  r43411 | t_schwinger | 2008-02-25 03:45:51 -0800 (Mon, 25 Feb 2008) | 3 lines
  
  removes unnecessary escaping
................
  r43412 | t_schwinger | 2008-02-25 03:47:59 -0800 (Mon, 25 Feb 2008) | 3 lines
  
  removes unnecessary comment
................
  r43416 | hkaiser | 2008-02-26 11:25:05 -0800 (Tue, 26 Feb 2008) | 1 line
  
  Wave: Fixed expanding_function_like_macro preprocessing hook.
................
  r43417 | danieljames | 2008-02-26 14:04:55 -0800 (Tue, 26 Feb 2008) | 2 lines
  
  Fix a link to Boost.Bimap.
................
  r43418 | danieljames | 2008-02-26 14:07:25 -0800 (Tue, 26 Feb 2008) | 2 lines
  
  Change another link that's no longer in the repository to link to the website.
................
  r43419 | hkaiser | 2008-02-26 14:36:36 -0800 (Tue, 26 Feb 2008) | 1 line
  
  Fixed a compilation problem on pathscale
................
  r43421 | eric_niebler | 2008-02-27 10:48:22 -0800 (Wed, 27 Feb 2008) | 1 line
  
  partially revert breaking change to independent sub-expressions until I can make a proper fix
................
  r43422 | danieljames | 2008-02-27 10:51:14 -0800 (Wed, 27 Feb 2008) | 1 line
  
  Fix broken copyright urls. Fixes #1573.
................
  r43423 | danieljames | 2008-02-27 11:22:01 -0800 (Wed, 27 Feb 2008) | 1 line
  
  Fix incorrect links to copyright of the form 'http:#www.boost.org
................
  r43424 | eric_niebler | 2008-02-27 11:39:43 -0800 (Wed, 27 Feb 2008) | 1 line
  
  fix bug in use_simple_repeat calculation
................
  r43428 | eric_niebler | 2008-02-27 16:03:15 -0800 (Wed, 27 Feb 2008) | 1 line
  
  add test case for use_simple_repeat fix
................
  r43433 | eric_niebler | 2008-02-28 14:47:12 -0800 (Thu, 28 Feb 2008) | 1 line
  
  fix oops
................
  r43434 | johnmaddock | 2008-02-29 01:49:42 -0800 (Fri, 29 Feb 2008) | 1 line
  
  Apply fixes to issue #1658 which fixes some broken URL's.
................
  r43435 | johnmaddock | 2008-02-29 01:58:30 -0800 (Fri, 29 Feb 2008) | 1 line
  
  Fix broken link as per report #1658.
................
  r43437 | chris_kohlhoff | 2008-02-29 04:57:57 -0800 (Fri, 29 Feb 2008) | 2 lines
  
  Add missing tie().
................
  r43438 | schoepflin | 2008-02-29 07:13:41 -0800 (Fri, 29 Feb 2008) | 2 lines
  
  Added expected failure markup for the test weighted_tail_variate_means on Tru64/CXX.
................
  r43441 | eric_niebler | 2008-03-01 11:32:56 -0800 (Sat, 01 Mar 2008) | 1 line
  
  add map_assign example
................
  r43458 | turkanis | 2008-03-02 22:20:14 -0800 (Sun, 02 Mar 2008) | 1 line
  
  merged changes from iostreams_dev, revisions 43399-43457
................
  r43461 | anthonyw | 2008-03-03 00:44:42 -0800 (Mon, 03 Mar 2008) | 1 line
  
  Test and fix for issue #1665
................
  r43464 | anthonyw | 2008-03-03 02:52:44 -0800 (Mon, 03 Mar 2008) | 1 line
  
  thread constructor now accepts up to three additional arguments to pass to thread function
................
  r43467 | danieljames | 2008-03-03 04:10:35 -0800 (Mon, 03 Mar 2008) | 2 lines
  
  Tell subversion that date_time.doc is a text file, not a word document.
................
  r43468 | danieljames | 2008-03-03 04:11:25 -0800 (Mon, 03 Mar 2008) | 1 line
  
  Fix license link in date_time.doc
................
  r43469 | chris_kohlhoff | 2008-03-03 05:21:05 -0800 (Mon, 03 Mar 2008) | 4 lines
  
  Disable use of CancelIo by default, due to the possibility of silent
  failure on some system configurations. Swallow error returned by CancelIoEx
  if there are no operations to be cancelled.
................
  r43470 | chris_kohlhoff | 2008-03-03 05:27:06 -0800 (Mon, 03 Mar 2008) | 2 lines
  
  Add missing 'boost_' prefix to helper namespace.
................
  r43471 | chris_kohlhoff | 2008-03-03 05:36:35 -0800 (Mon, 03 Mar 2008) | 2 lines
  
  Regenerate documentation.
................
  r43472 | chris_kohlhoff | 2008-03-03 06:05:35 -0800 (Mon, 03 Mar 2008) | 1 line
  
  Update copyright notices.
................
  r43473 | chris_kohlhoff | 2008-03-03 06:13:01 -0800 (Mon, 03 Mar 2008) | 2 lines
  
  Update copyright notices.
................
  r43476 | eric_niebler | 2008-03-03 11:44:54 -0800 (Mon, 03 Mar 2008) | 1 line
  
  add Map Assign example to documentation
................
  r43478 | eric_niebler | 2008-03-03 11:47:47 -0800 (Mon, 03 Mar 2008) | 1 line
  
  second attempt at fixing actions in independent expressions
................
  r43484 | eric_niebler | 2008-03-03 15:48:17 -0800 (Mon, 03 Mar 2008) | 1 line
  
  handle static regexes with actions nested in dynamic independent subexpressions
................
  r43485 | emildotchevski | 2008-03-03 17:41:17 -0800 (Mon, 03 Mar 2008) | 1 line
  
  boost exception
................
  r43496 | eric_niebler | 2008-03-04 10:51:07 -0800 (Tue, 04 Mar 2008) | 1 line
  
  rename numeric::empty to numeric::default_, fixes #1650
................
  r43501 | eric_niebler | 2008-03-04 11:31:57 -0800 (Tue, 04 Mar 2008) | 1 line
  
  eliminate msvc level 4 warnings, fixes #1631
................
  r43502 | eric_niebler | 2008-03-04 11:42:36 -0800 (Tue, 04 Mar 2008) | 1 line
  
  add Dave Jenkin's evil static/dynamic actions in keep test case
................
  r43503 | eric_niebler | 2008-03-04 13:09:47 -0800 (Tue, 04 Mar 2008) | 1 line
  
  work around msvc bug 331418, fixes #1652
................
  r43506 | eric_niebler | 2008-03-04 15:01:17 -0800 (Tue, 04 Mar 2008) | 1 line
  
  fix bad interaction between boyer-moore optimization and partial match feature, fixes #1564
................
  r43508 | eric_niebler | 2008-03-04 22:32:39 -0800 (Tue, 04 Mar 2008) | 1 line
  
  add BOOST_REVERSE_FOREACH, fixes #1071
................
  r43509 | eric_niebler | 2008-03-04 23:12:03 -0800 (Tue, 04 Mar 2008) | 1 line
  
  fix bug iterating over abstract base
................


[SVN r43519]
2008-03-05 20:37:04 +00:00
Eric Niebler
87ba6f6af9 development version of proto for new-style transforms
[SVN r38539]
2007-08-08 21:34:10 +00:00
Vladimir Prus
797b5756cf Update for V2
[SVN r38520]
2007-08-08 19:16:43 +00:00
Peter Dimov
bd4da55f0f Rvalue support
[SVN r38299]
2007-07-29 20:33:46 +00:00
Daniel James
47bf3df0ae Merge fixed links from RC_1_34_0.
[SVN r36660]
2007-01-07 23:50:56 +00:00
Jaakko Järvi
ff0929e6e3 fixed bug 1444052
[SVN r36200]
2006-11-29 19:21:46 +00:00
Jaakko Järvi
9b925abaff added ->* to the table of actions for return types deduction
[SVN r36199]
2006-11-29 18:54:18 +00:00
Beman Dawes
bf50f2fe7f Add copyright, license
[SVN r35905]
2006-11-07 19:11:57 +00:00
Daryle Walker
85630d55a6 Correct placement of base class declaration
[SVN r34533]
2006-07-14 08:04:08 +00:00
Peter Dimov
2e8c4eb8f3 is_placeholder, is_bind_expression added.
[SVN r34468]
2006-07-06 13:47:26 +00:00
Jaakko Järvi
24e8602cf1 typo
[SVN r31518]
2005-10-31 20:11:23 +00:00
Jaakko Järvi
7f77f987c1 Fixed typos in comments
[SVN r30381]
2005-08-02 17:43:37 +00:00
Jaakko Järvi
d854239945 Patch by Jonathan Wakely to expand special handling of GCC when used in
debug mode.


[SVN r28684]
2005-05-06 05:08:32 +00:00
Jaakko Järvi
4aef261258 added a flag to the test makefile
[SVN r28683]
2005-05-06 05:06:11 +00:00
Jaakko Järvi
6b67606f40 class to struct
[SVN r27493]
2005-02-24 05:27:28 +00:00
Stefan Slapeta
b0ce56c74f replaced BOOST_TEST
[SVN r27057]
2005-02-03 13:55:45 +00:00
Aleksey Gurtovoy
9e45d49139 merge RC_1_32_0 fixes
[SVN r26328]
2004-11-28 03:35:12 +00:00
Jaakko Järvi
e9ed0829b2 gcc 3.4. does not distinguish between bind overloads for function refrerences, and just const T&.
Not sure who is right, but now bind function overloads are special cased for g++ 3.4.


[SVN r25466]
2004-09-28 19:02:16 +00:00
Jaakko Järvi
17df366d20 added explicit qualification to var to avoid conflict with pthreads
[SVN r25042]
2004-09-13 15:13:59 +00:00
Aleksey Gurtovoy
485bcbdcd8 merge new MPL version from 'mplbook' branch
[SVN r24874]
2004-09-02 15:41:37 +00:00
John Maddock
023996e106 Updated to use the BSL (using permissions supplied in more/blanket-permission.txt)
[SVN r24804]
2004-08-29 10:29:46 +00:00
Douglas Gregor
3bd135028e Move to BSL
[SVN r24447]
2004-08-12 17:16:41 +00:00
Douglas Gregor
b6b0b9a03f Moved to BSL
[SVN r24446]
2004-08-12 17:13:07 +00:00
Douglas Gregor
0f0c53b1f9 Converted to Boost Software License, Version 1.0
[SVN r24096]
2004-07-27 03:43:34 +00:00
Rene Rivera
24ff929eb1 Remove tabs in file.
[SVN r24043]
2004-07-25 17:12:17 +00:00
Jaakko Järvi
5031c63f73 .
[SVN r23654]
2004-07-16 22:56:09 +00:00
Jaakko Järvi
a7ac9a8991 Back to minimal.hpp
[SVN r23653]
2004-07-16 22:05:56 +00:00
Jaakko Järvi
8a19479625 modernizing...
[SVN r23640]
2004-07-16 17:30:45 +00:00
Jaakko Järvi
4add858581 temporarily backing out from previous changes, problems with VC7.1
[SVN r23475]
2004-07-13 01:16:43 +00:00
Jaakko Järvi
14b8227ca6 adding overloads to cope with rvalue temporaries
[SVN r23401]
2004-07-07 20:31:02 +00:00
Jaakko Järvi
5ecd79ed2e .
[SVN r23397]
2004-07-07 20:02:29 +00:00
Jaakko Järvi
d718b75da3 Converting to boostbook
[SVN r23396]
2004-07-07 19:43:52 +00:00
Jaakko Järvi
f9689cc6a4 Converting to Boost Book
[SVN r23384]
2004-07-06 20:56:36 +00:00
Eric Niebler
a80b8a59a0 remove std_min and std_max, update minmax coding guidelines
[SVN r23162]
2004-06-23 04:49:48 +00:00
Jaakko Järvi
b99048eab3 Fix for gcc 3.4
[SVN r22673]
2004-04-20 18:05:05 +00:00
Jaakko Järvi
ec6cc563b1 patch for gcc3.4
[SVN r22575]
2004-04-01 00:00:55 +00:00
Jaakko Järvi
0196c57a0a A few typos
[SVN r22414]
2004-03-01 14:13:05 +00:00
Eric Niebler
282825b784 remove minmax hack from win32.hpp and fix all places that could be affected by the minmax macros
[SVN r22394]
2004-02-26 18:27:02 +00:00
Jaakko Järvi
b8d328c0fc Now BLL supports result_type too, Thanks Peter D.!
[SVN r22380]
2004-02-24 22:06:14 +00:00
Peter Dimov
c5704cd6e3 Enable ::result_type recognition
[SVN r22379]
2004-02-24 20:03:32 +00:00
Peter Dimov
6f607b3eef *_1 support for smart pointers
[SVN r22376]
2004-02-24 13:13:03 +00:00
Jaakko Järvi
8bb8820adb fixed a small typo in destructor example
[SVN r22304]
2004-02-17 15:53:35 +00:00
Jaakko Järvi
89fb84d751 supressed some gcc3.4 warnings, making it more explicit that a few
template functions return void


[SVN r21503]
2004-01-05 15:34:29 +00:00
Rene Rivera
be2b0df062 Fix tabs in file.
[SVN r21399]
2003-12-26 23:26:49 +00:00
Jaakko Järvi
666a3eca2d patch by Jim Apple to fix things here and there
[SVN r21213]
2003-12-10 19:15:05 +00:00
Jaakko Järvi
95d865285e new test for algorithms
[SVN r21212]
2003-12-10 19:12:06 +00:00
Jaakko Järvi
ec38046886 added a citation
[SVN r20326]
2003-10-09 19:30:59 +00:00
Jaakko Järvi
c713dc5e0c fixed a typo, thanks Dave A
[SVN r20295]
2003-10-07 20:55:29 +00:00
Jaakko Järvi
ff04032656 a typo fix
[SVN r18993]
2003-07-09 14:35:19 +00:00
Jaakko Järvi
6f63b3770f fixed a bad example
[SVN r18616]
2003-05-30 19:26:56 +00:00
Jaakko Järvi
22e7b9c779 fixed empty args to macros warnings
[SVN r18501]
2003-05-22 21:00:48 +00:00
Jaakko Järvi
68be6f6563 a fix for gcc 2.95.2
[SVN r18500]
2003-05-22 18:27:40 +00:00
Jaakko Järvi
02314ab550 typo
[SVN r17652]
2003-02-26 05:11:50 +00:00
Jaakko Järvi
9f032a7301 licences were missing, now added
[SVN r17236]
2003-02-05 15:47:51 +00:00
Jaakko Järvi
da56b773a0 licence fixes ...
[SVN r17235]
2003-02-05 15:41:29 +00:00
Jaakko Järvi
cd605ff48d licence fixe
[SVN r17234]
2003-02-05 15:40:23 +00:00
Jaakko Järvi
641babedf8 added a link
[SVN r17232]
2003-02-05 14:58:37 +00:00
Jaakko Järvi
f9a6b38845 remvoded tabs
[SVN r16828]
2003-01-09 14:15:09 +00:00
Jaakko Järvi
846a406b7a bugfix, added a missing sig template
[SVN r16094]
2002-11-04 16:25:33 +00:00
Jaakko Järvi
29794ee654 added more tests for different arities of member functions
[SVN r16093]
2002-11-04 16:24:38 +00:00
Jaakko Järvi
f74aae1241 bugfixes
[SVN r16025]
2002-10-30 21:10:03 +00:00
Jaakko Järvi
624a204462 a bug fixed
[SVN r15886]
2002-10-10 22:03:49 +00:00
Jaakko Järvi
b635d13d2c a typo fix
[SVN r15656]
2002-10-02 22:43:10 +00:00
Jaakko Järvi
403d82da66 changed a list to a vector (sort requires random access iterator) in one example
[SVN r15575]
2002-09-30 20:28:27 +00:00
Jaakko Järvi
0f29970c8b changing to the new boost::function style
[SVN r15510]
2002-09-25 16:56:06 +00:00
Jaakko Järvi
05b9bd64c4 converting to the new boost::function style
[SVN r15508]
2002-09-25 16:46:42 +00:00
Jaakko Järvi
e1b36955b7 changed <include> to <sysinclude>
[SVN r15306]
2002-09-13 16:46:08 +00:00
Paul Mensonides
c6030ac58d pp-lib update
[SVN r15214]
2002-09-08 22:03:22 +00:00
Beman Dawes
e6edfdf997 Initial commit
[SVN r14896]
2002-08-15 17:47:47 +00:00
Jaakko Järvi
aabd832db1 added a Jamfile to run tests locally
[SVN r14856]
2002-08-14 20:56:59 +00:00
Jaakko Järvi
2aec95e806 added a forgotten sig-template to 9-argument case
[SVN r14837]
2002-08-14 14:59:24 +00:00
Jaakko Järvi
95b82465e0 added docs for bind(&A::data_member, ... support
[SVN r14746]
2002-08-08 20:09:26 +00:00
Jaakko Järvi
c5dafd3db8 volatile support for bind(&A::data_member
[SVN r14745]
2002-08-08 19:54:58 +00:00
Jaakko Järvi
fefd81ede1 adding support for bind(&A::data_member, _1)
[SVN r14744]
2002-08-08 17:01:47 +00:00
Jaakko Järvi
a120795474 added support for bind(&A::data_member, _1) syntax
[SVN r14743]
2002-08-08 16:58:09 +00:00
Jaakko Järvi
94292237b4 bugfix: name conflict in template template parameter
[SVN r14699]
2002-08-05 16:16:00 +00:00
Jaakko Järvi
fbe72097b4 bugfix in make_void
[SVN r14042]
2002-05-24 19:33:24 +00:00
Jaakko Järvi
2f24d3f261 added tests for empty case statements
[SVN r14015]
2002-05-22 19:48:02 +00:00
Jaakko Järvi
e057f63a54 added tests for emtpy catch blocks
[SVN r14014]
2002-05-22 19:47:35 +00:00
Jaakko Järvi
6f32c54b5d indentation changes
[SVN r14013]
2002-05-22 19:46:57 +00:00
Jaakko Järvi
3d659d2c3b bugfix in empty case_statements
[SVN r14012]
2002-05-22 19:44:07 +00:00
Jaakko Järvi
e9721da0d0 bugfix on do_nothing_action case
[SVN r14011]
2002-05-22 19:42:33 +00:00
Jaakko Järvi
f329a3bf68 bugfix in empty catch blocks
[SVN r14010]
2002-05-22 19:41:46 +00:00
Jaakko Järvi
a396be0bf6 added u to an int literal to get rid of a warning for comparin unsigned and
signed


[SVN r13861]
2002-05-14 17:00:57 +00:00
Jaakko Järvi
eeb2c53b56 added dummy uses of arguments to prevent unused argument errors
[SVN r13860]
2002-05-14 16:59:33 +00:00
Jaakko Järvi
fcf0d30c4e removing tabs
[SVN r13782]
2002-05-09 17:08:29 +00:00
Jaakko Järvi
d65bfa94ca converted tabs to spaces
[SVN r13781]
2002-05-09 17:05:16 +00:00
Jaakko Järvi
2942562072 name changes to get under 31 chars
[SVN r13763]
2002-05-08 22:14:14 +00:00
Jaakko Järvi
01031ccddd renamimg files to get under 31 chars
[SVN r13761]
2002-05-08 22:09:24 +00:00
Jaakko Järvi
efdcc46d3a renaming file to get under 31 characters
[SVN r13760]
2002-05-08 22:07:14 +00:00
Jaakko Järvi
d60ae200a6 using ice_and, ice_or instead of && and || in compile time expressions
[SVN r13756]
2002-05-08 20:02:31 +00:00
Jaakko Järvi
ff11fbb20e ok
[SVN r13751]
2002-05-08 15:56:14 +00:00
Jaakko Järvi
705c230963 adding the docbook xml files that generate the documentation
[SVN r13750]
2002-05-08 15:53:15 +00:00
Jaakko Järvi
cd444c824a added documentation for algorithm.hpp and numeric.hpp
[SVN r13749]
2002-05-08 15:42:48 +00:00
Jaakko Järvi
50d9654200 added algorithm.hpp and numeric.hpp instructions
[SVN r13748]
2002-05-08 15:39:45 +00:00
Jaakko Järvi
937816e76e added a comment
[SVN r13734]
2002-05-07 22:24:22 +00:00
Jaakko Järvi
bc350d53bf added a config parameter for not handling the ::template correctly
[SVN r13733]
2002-05-07 22:22:01 +00:00
Jaakko Järvi
34133ee940 do not include member_ptr.hpp for compilers that cannot handle it
[SVN r13732]
2002-05-07 22:20:08 +00:00
Jaakko Järvi
38ffca82c9 removed some tests if sstreams not available
[SVN r13731]
2002-05-07 22:16:41 +00:00
Jaakko Järvi
1a2fb78541 inner product etc.
[SVN r13730]
2002-05-07 21:51:33 +00:00
Jaakko Järvi
b6d1367cec added tests for stringstreams and << >> operators
[SVN r13654]
2002-05-03 22:02:37 +00:00
Jaakko Järvi
ec9ba2becf fixed a bug in stringstream and fstream << >> operators
[SVN r13652]
2002-05-03 19:13:48 +00:00
Jaakko Järvi
2bdf3738c1 added all STL algorithms, removed has_sig
[SVN r13651]
2002-05-03 19:10:35 +00:00
Jaakko Järvi
c11fb1fe36 removed one struct/class inconsistency
[SVN r13559]
2002-04-24 12:43:53 +00:00
Jaakko Järvi
59ad507d3f adding lambda tests to the main trunk
[SVN r13538]
2002-04-19 19:49:20 +00:00
Jaakko Järvi
10c4216ddc lambda docs to the main trunk
[SVN r13536]
2002-04-19 19:45:20 +00:00
Jaakko Järvi
15baf78a58 Into the maintrunk
[SVN r13524]
2002-04-19 19:29:57 +00:00
Jaakko Järvi
f2b02864f9 lambda_development branch creation
[SVN r11711]
2001-11-15 20:47:16 +00:00
63 changed files with 24490 additions and 0 deletions

5
doc/Jamfile.v2 Normal file
View File

@@ -0,0 +1,5 @@
project boost/doc ;
import boostbook : boostbook ;
boostbook lambda-doc : lambda.xml ;

7
doc/detail/README Normal file
View File

@@ -0,0 +1,7 @@
- lambda_doc.xml is a DocBook xml file from which the lambda docs are
generated
- lambda_doc_chunks.xsl loads the stylesheets that generate a separate
html-file for each section
- lambda_doc.xsl loads stylesheets that generate one big html-file
(you need to edit the paths in these files to make them work)

3456
doc/detail/lambda_doc.xml Executable file

File diff suppressed because it is too large Load Diff

19
doc/detail/lambda_doc.xsl Normal file
View File

@@ -0,0 +1,19 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'
xmlns="http://www.w3.org/TR/xhtml1/transitional"
exclude-result-prefixes="#default">
<xsl:import href="/u/jajarvi/dtd/docbook-xsl/html/docbook.xsl"/>
<!-- Add other variable definitions here -->
<xsl:variable name="shade.verbatim">0</xsl:variable>
<xsl:variable name="section.autolabel">1</xsl:variable>
<xsl:variable name="bibliography.collection">lambda_bib.xml</xsl:variable>
</xsl:stylesheet>

View File

@@ -0,0 +1,19 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'
xmlns="http://www.w3.org/TR/xhtml1/transitional"
exclude-result-prefixes="#default">
<xsl:import href="/u/jajarvi/dtd/docbook-xsl/html/chunk.xsl"/>
<!-- Add other variable definitions here -->
<xsl:variable name="shade.verbatim">0</xsl:variable>
<xsl:variable name="section.autolabel">1</xsl:variable>
<xsl:variable name="bibliography.collection">lambda_bib.xml</xsl:variable>
</xsl:stylesheet>

12
doc/index.html Normal file
View File

@@ -0,0 +1,12 @@
<html>
<head>
<meta http-equiv="refresh" content="0; URL=../../../doc/html/lambda.html">
</head>
<body>
Automatic redirection failed, please go to <a href="../../../doc/html/lambda.html">www.boost.org/doc/html/lambda.html</a>&nbsp;<hr>
<p>© Copyright Beman Dawes, 2001</p>
<p>Distributed under the Boost Software License, Version 1.0. (See accompanying
file <a href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy
at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
</body>
</html>

3452
doc/lambda.xml Normal file

File diff suppressed because it is too large Load Diff

0
dummy
View File

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,19 @@
// -- bind.hpp -- Boost Lambda Library --------------------------------------
// Copyright (C) 1999-2001 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Gary Powell (gwpowell@hotmail.com)
//
// Distributed under 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)
//
// For more information, see http://www.boost.org
#ifndef BOOST_LAMBDA_BIND_HPP
#define BOOST_LAMBDA_BIND_HPP
#include "boost/lambda/core.hpp"
#include "boost/lambda/detail/bind_functions.hpp"
#endif

View File

@@ -0,0 +1,219 @@
// - casts.hpp -- BLambda Library -------------
//
// Copyright (C) 2000 Gary Powell (powellg@amazon.com)
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see http://www.boost.org
// -----------------------------------------------
#if !defined(BOOST_LAMBDA_CASTS_HPP)
#define BOOST_LAMBDA_CASTS_HPP
#include <typeinfo>
namespace boost {
namespace lambda {
template<class T> class cast_action;
template<class T> class static_cast_action;
template<class T> class dynamic_cast_action;
template<class T> class const_cast_action;
template<class T> class reinterpret_cast_action;
class typeid_action;
class sizeof_action;
// Cast actions
template<class T> class cast_action<static_cast_action<T> >
{
public:
template<class RET, class Arg1>
static RET apply(Arg1 &a1) {
return static_cast<RET>(a1);
}
};
template<class T> class cast_action<dynamic_cast_action<T> > {
public:
template<class RET, class Arg1>
static RET apply(Arg1 &a1) {
return dynamic_cast<RET>(a1);
}
};
template<class T> class cast_action<const_cast_action<T> > {
public:
template<class RET, class Arg1>
static RET apply(Arg1 &a1) {
return const_cast<RET>(a1);
}
};
template<class T> class cast_action<reinterpret_cast_action<T> > {
public:
template<class RET, class Arg1>
static RET apply(Arg1 &a1) {
return reinterpret_cast<RET>(a1);
}
};
// typedid action
class typeid_action {
public:
template<class RET, class Arg1>
static RET apply(Arg1 &a1) {
return typeid(a1);
}
};
// sizeof action
class sizeof_action
{
public:
template<class RET, class Arg1>
static RET apply(Arg1 &a1) {
return sizeof(a1);
}
};
// return types of casting lambda_functors (all "T" type.)
template<template <class> class cast_type, class T, class A>
struct return_type_N<cast_action< cast_type<T> >, A> {
typedef T type;
};
// return type of typeid_action
template<class A>
struct return_type_N<typeid_action, A> {
typedef std::type_info const & type;
};
// return type of sizeof_action
template<class A>
struct return_type_N<sizeof_action, A> {
typedef std::size_t type;
};
// the four cast & typeid overloads.
// casts can take ordinary variables (not just lambda functors)
// static_cast
template <class T, class Arg1>
inline const lambda_functor<
lambda_functor_base<
action<1, cast_action<static_cast_action<T> > >,
tuple<typename const_copy_argument <const Arg1>::type>
>
>
ll_static_cast(const Arg1& a1) {
return
lambda_functor_base<
action<1, cast_action<static_cast_action<T> > >,
tuple<typename const_copy_argument <const Arg1>::type>
>
( tuple<typename const_copy_argument <const Arg1>::type>(a1));
}
// dynamic_cast
template <class T, class Arg1>
inline const lambda_functor<
lambda_functor_base<
action<1, cast_action<dynamic_cast_action<T> > >,
tuple<typename const_copy_argument <const Arg1>::type>
>
>
ll_dynamic_cast(const Arg1& a1) {
return
lambda_functor_base<
action<1, cast_action<dynamic_cast_action<T> > >,
tuple<typename const_copy_argument <const Arg1>::type>
>
( tuple<typename const_copy_argument <const Arg1>::type>(a1));
}
// const_cast
template <class T, class Arg1>
inline const lambda_functor<
lambda_functor_base<
action<1, cast_action<const_cast_action<T> > >,
tuple<typename const_copy_argument <const Arg1>::type>
>
>
ll_const_cast(const Arg1& a1) {
return
lambda_functor_base<
action<1, cast_action<const_cast_action<T> > >,
tuple<typename const_copy_argument <const Arg1>::type>
>
( tuple<typename const_copy_argument <const Arg1>::type>(a1));
}
// reinterpret_cast
template <class T, class Arg1>
inline const lambda_functor<
lambda_functor_base<
action<1, cast_action<reinterpret_cast_action<T> > >,
tuple<typename const_copy_argument <const Arg1>::type>
>
>
ll_reinterpret_cast(const Arg1& a1) {
return
lambda_functor_base<
action<1, cast_action<reinterpret_cast_action<T> > >,
tuple<typename const_copy_argument <const Arg1>::type>
>
( tuple<typename const_copy_argument <const Arg1>::type>(a1));
}
// typeid
// can be applied to a normal variable as well (can refer to a polymorphic
// class object)
template <class Arg1>
inline const lambda_functor<
lambda_functor_base<
action<1, typeid_action>,
tuple<typename const_copy_argument <const Arg1>::type>
>
>
ll_typeid(const Arg1& a1) {
return
lambda_functor_base<
action<1, typeid_action>,
tuple<typename const_copy_argument <const Arg1>::type>
>
( tuple<typename const_copy_argument <const Arg1>::type>(a1));
}
// sizeof(expression)
// Always takes a lambda expression (if not, built in sizeof will do)
template <class Arg1>
inline const lambda_functor<
lambda_functor_base<
action<1, sizeof_action>,
tuple<lambda_functor<Arg1> >
>
>
ll_sizeof(const lambda_functor<Arg1>& a1) {
return
lambda_functor_base<
action<1, sizeof_action>,
tuple<lambda_functor<Arg1> >
>
( tuple<lambda_functor<Arg1> >(a1));
}
} // namespace lambda
} // namespace boost
#endif

View File

@@ -0,0 +1,274 @@
/*=============================================================================
Adaptable closures
Phoenix V0.9
Copyright (c) 2001-2002 Joel de Guzman
Distributed under 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)
URL: http://spirit.sourceforge.net/
==============================================================================*/
#ifndef PHOENIX_CLOSURES_HPP
#define PHOENIX_CLOSURES_HPP
///////////////////////////////////////////////////////////////////////////////
#include "boost/lambda/core.hpp"
///////////////////////////////////////////////////////////////////////////////
namespace boost {
namespace lambda {
///////////////////////////////////////////////////////////////////////////////
//
// Adaptable closures
//
// The framework will not be complete without some form of closures
// support. Closures encapsulate a stack frame where local
// variables are created upon entering a function and destructed
// upon exiting. Closures provide an environment for local
// variables to reside. Closures can hold heterogeneous types.
//
// Phoenix closures are true hardware stack based closures. At the
// very least, closures enable true reentrancy in lambda functions.
// A closure provides access to a function stack frame where local
// variables reside. Modeled after Pascal nested stack frames,
// closures can be nested just like nested functions where code in
// inner closures may access local variables from in-scope outer
// closures (accessing inner scopes from outer scopes is an error
// and will cause a run-time assertion failure).
//
// There are three (3) interacting classes:
//
// 1) closure:
//
// At the point of declaration, a closure does not yet create a
// stack frame nor instantiate any variables. A closure declaration
// declares the types and names[note] of the local variables. The
// closure class is meant to be subclassed. It is the
// responsibility of a closure subclass to supply the names for
// each of the local variable in the closure. Example:
//
// struct my_closure : closure<int, string, double> {
//
// member1 num; // names the 1st (int) local variable
// member2 message; // names the 2nd (string) local variable
// member3 real; // names the 3rd (double) local variable
// };
//
// my_closure clos;
//
// Now that we have a closure 'clos', its local variables can be
// accessed lazily using the dot notation. Each qualified local
// variable can be used just like any primitive actor (see
// primitives.hpp). Examples:
//
// clos.num = 30
// clos.message = arg1
// clos.real = clos.num * 1e6
//
// The examples above are lazily evaluated. As usual, these
// expressions return composite actors that will be evaluated
// through a second function call invocation (see operators.hpp).
// Each of the members (clos.xxx) is an actor. As such, applying
// the operator() will reveal its identity:
//
// clos.num() // will return the current value of clos.num
//
// *** [note] Acknowledgement: Juan Carlos Arevalo-Baeza (JCAB)
// introduced and initilally implemented the closure member names
// that uses the dot notation.
//
// 2) closure_member
//
// The named local variables of closure 'clos' above are actually
// closure members. The closure_member class is an actor and
// conforms to its conceptual interface. member1..memberN are
// predefined typedefs that correspond to each of the listed types
// in the closure template parameters.
//
// 3) closure_frame
//
// When a closure member is finally evaluated, it should refer to
// an actual instance of the variable in the hardware stack.
// Without doing so, the process is not complete and the evaluated
// member will result to an assertion failure. Remember that the
// closure is just a declaration. The local variables that a
// closure refers to must still be instantiated.
//
// The closure_frame class does the actual instantiation of the
// local variables and links these variables with the closure and
// all its members. There can be multiple instances of
// closure_frames typically situated in the stack inside a
// function. Each closure_frame instance initiates a stack frame
// with a new set of closure local variables. Example:
//
// void foo()
// {
// closure_frame<my_closure> frame(clos);
// /* do something */
// }
//
// where 'clos' is an instance of our closure 'my_closure' above.
// Take note that the usage above precludes locally declared
// classes. If my_closure is a locally declared type, we can still
// use its self_type as a paramater to closure_frame:
//
// closure_frame<my_closure::self_type> frame(clos);
//
// Upon instantiation, the closure_frame links the local variables
// to the closure. The previous link to another closure_frame
// instance created before is saved. Upon destruction, the
// closure_frame unlinks itself from the closure and relinks the
// preceding closure_frame prior to this instance.
//
// The local variables in the closure 'clos' above is default
// constructed in the stack inside function 'foo'. Once 'foo' is
// exited, all of these local variables are destructed. In some
// cases, default construction is not desirable and we need to
// initialize the local closure variables with some values. This
// can be done by passing in the initializers in a compatible
// tuple. A compatible tuple is one with the same number of
// elements as the destination and where each element from the
// destination can be constructed from each corresponding element
// in the source. Example:
//
// tuple<int, char const*, int> init(123, "Hello", 1000);
// closure_frame<my_closure> frame(clos, init);
//
// Here now, our closure_frame's variables are initialized with
// int: 123, char const*: "Hello" and int: 1000.
//
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//
// closure_frame class
//
///////////////////////////////////////////////////////////////////////////////
template <typename ClosureT>
class closure_frame : public ClosureT::tuple_t {
public:
closure_frame(ClosureT& clos)
: ClosureT::tuple_t(), save(clos.frame), frame(clos.frame)
{ clos.frame = this; }
template <typename TupleT>
closure_frame(ClosureT& clos, TupleT const& init)
: ClosureT::tuple_t(init), save(clos.frame), frame(clos.frame)
{ clos.frame = this; }
~closure_frame()
{ frame = save; }
private:
closure_frame(closure_frame const&); // no copy
closure_frame& operator=(closure_frame const&); // no assign
closure_frame* save;
closure_frame*& frame;
};
///////////////////////////////////////////////////////////////////////////////
//
// closure_member class
//
///////////////////////////////////////////////////////////////////////////////
template <int N, typename ClosureT>
class closure_member {
public:
typedef typename ClosureT::tuple_t tuple_t;
closure_member()
: frame(ClosureT::closure_frame_ref()) {}
template <typename TupleT>
struct sig {
typedef typename detail::tuple_element_as_reference<
N, typename ClosureT::tuple_t
>::type type;
};
template <class Ret, class A, class B, class C>
// typename detail::tuple_element_as_reference
// <N, typename ClosureT::tuple_t>::type
Ret
call(A&, B&, C&) const
{
assert(frame);
return boost::tuples::get<N>(*frame);
}
private:
typename ClosureT::closure_frame_t*& frame;
};
///////////////////////////////////////////////////////////////////////////////
//
// closure class
//
///////////////////////////////////////////////////////////////////////////////
template <
typename T0 = null_type,
typename T1 = null_type,
typename T2 = null_type,
typename T3 = null_type,
typename T4 = null_type
>
class closure {
public:
typedef tuple<T0, T1, T2, T3, T4> tuple_t;
typedef closure<T0, T1, T2, T3, T4> self_t;
typedef closure_frame<self_t> closure_frame_t;
closure()
: frame(0) { closure_frame_ref(&frame); }
closure_frame_t& context() { assert(frame); return frame; }
closure_frame_t const& context() const { assert(frame); return frame; }
typedef lambda_functor<closure_member<0, self_t> > member1;
typedef lambda_functor<closure_member<1, self_t> > member2;
typedef lambda_functor<closure_member<2, self_t> > member3;
typedef lambda_functor<closure_member<3, self_t> > member4;
typedef lambda_functor<closure_member<4, self_t> > member5;
private:
closure(closure const&); // no copy
closure& operator=(closure const&); // no assign
template <int N, typename ClosureT>
friend struct closure_member;
template <typename ClosureT>
friend class closure_frame;
static closure_frame_t*&
closure_frame_ref(closure_frame_t** frame_ = 0)
{
static closure_frame_t** frame = 0;
if (frame_ != 0)
frame = frame_;
return *frame;
}
closure_frame_t* frame;
};
}}
// namespace
#endif

View File

@@ -0,0 +1,237 @@
// - construct.hpp -- Lambda Library -------------
//
// Copyright (C) 2000 Gary Powell (powellg@amazon.com)
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see http://www.boost.org
//
// -----------------------------------------------
#if !defined(BOOST_LAMBDA_CONSTRUCT_HPP)
#define BOOST_LAMBDA_CONSTRUCT_HPP
namespace boost {
namespace lambda {
// constructor is used together with bind. constructor<A> creates a bindable
// function object that passes its arguments forward to a constructor call
// of type A
template<class T> struct constructor {
template <class U> struct sig { typedef T type; };
T operator()() const {
return T();
}
template<class A1>
T operator()(A1& a1) const {
return T(a1);
}
template<class A1, class A2>
T operator()(A1& a1, A2& a2) const {
return T(a1, a2);
}
template<class A1, class A2, class A3>
T operator()(A1& a1, A2& a2, A3& a3) const {
return T(a1, a2, a3);
}
template<class A1, class A2, class A3, class A4>
T operator()(A1& a1, A2& a2, A3& a3, A4& a4) const {
return T(a1, a2, a3, a4);
}
template<class A1, class A2, class A3, class A4, class A5>
T operator()(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) const {
return T(a1, a2, a3, a4, a5);
}
template<class A1, class A2, class A3, class A4, class A5, class A6>
T operator()(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) const {
return T(a1, a2, a3, a4, a5, a6);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7>
T operator()(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) const {
return T(a1, a2, a3, a4, a5, a6, a7);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
T operator()(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) const {
return T(a1, a2, a3, a4, a5, a6, a7, a8);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
T operator()(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8, A9& a9) const {
return T(a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10>
T operator()(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8, A9& a9, A10& a10) const {
return T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
}
};
namespace detail {
// A standard conforming compiler could disambiguate between
// A1* and A1&, but not all compilers do that, so we need the
// helpers
template <bool IsPointer>
struct destructor_helper {
template<class A1>
static void exec(A1& a1) {
// remove all the qualifiers, not sure whether it is necessary
typedef typename boost::remove_cv<A1>::type plainA1;
a1.~plainA1();
}
};
template <>
struct destructor_helper<true> {
template<class A1>
static void exec(A1* a1) {
typedef typename boost::remove_cv<A1>::type plainA1;
(*a1).~plainA1();
}
};
}
// destructor funtion object
struct destructor {
template <class T> struct sig { typedef void type; };
template<class A1>
void operator()(A1& a1) const {
typedef typename boost::remove_cv<A1>::type plainA1;
detail::destructor_helper<boost::is_pointer<plainA1>::value>::exec(a1);
}
};
// new_ptr is used together with bind.
// note: placement new is not supported
template<class T> struct new_ptr {
template <class U> struct sig { typedef T* type; };
T* operator()() const {
return new T();
}
template<class A1>
T* operator()(A1& a1) const {
return new T(a1);
}
template<class A1, class A2>
T* operator()(A1& a1, A2& a2) const {
return new T(a1, a2);
}
template<class A1, class A2, class A3>
T* operator()(A1& a1, A2& a2, A3& a3) const {
return new T(a1, a2, a3);
}
template<class A1, class A2, class A3, class A4>
T* operator()(A1& a1, A2& a2, A3& a3, A4& a4) const {
return new T(a1, a2, a3, a4);
}
template<class A1, class A2, class A3, class A4, class A5>
T* operator()(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) const {
return new T(a1, a2, a3, a4, a5);
}
template<class A1, class A2, class A3, class A4, class A5, class A6>
T* operator()(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) const {
return new T(a1, a2, a3, a4, a5, a6);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7>
T* operator()(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) const {
return new T(a1, a2, a3, a4, a5, a6, a7);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
T* operator()(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) const {
return new T(a1, a2, a3, a4, a5, a6, a7, a8);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
T* operator()(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8, A9& a9) const {
return new T(a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10>
T* operator()(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8, A9& a9, A10& a10) const {
return new T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
}
};
// delete_ptr return void
struct delete_ptr {
template <class U> struct sig { typedef void type; };
template <class A1>
void operator()(A1& a1) const {
delete a1;
}
};
// new_array is used together with bind.
template<class T> struct new_array {
template <class U> struct sig { typedef T* type; };
T* operator()(int size) const {
return new T[size];
}
};
// delete_ptr return void
struct delete_array {
template <class U> struct sig { typedef void type; };
template <class A1>
void operator()(A1& a1) const {
delete[] a1;
}
};
} // namespace lambda
} // namespace boost
#endif

View File

@@ -0,0 +1,22 @@
// -- control_structures.hpp -- Boost Lambda Library --------------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see www.boost.org
#ifndef BOOST_LAMBDA_CONTROL_STRUCTURES_HPP
#define BOOST_LAMBDA_CONTROL_STRUCTURES_HPP
#include "boost/lambda/core.hpp"
// Arithmetic type promotion needed for if_then_else_return
#include "boost/lambda/detail/operator_actions.hpp"
#include "boost/lambda/detail/operator_return_type_traits.hpp"
#include "boost/lambda/detail/control_structures_impl.hpp"
#endif

View File

@@ -0,0 +1,79 @@
// -- core.hpp -- Boost Lambda Library -------------------------------------
//
// Copyright (C) 2000 Gary Powell (powellg@amazon.com)
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see www.boost.org
//
// Includes the core of LL, without any real features for client:
//
// tuples, lambda functors, return type deduction templates,
// argument substitution mechanism (select functions)
//
// Some functionality comes as well:
// Assignment and subscript operators, as well as function
// call operator for placeholder variables.
// -------------------------------------------------------------------------
#ifndef BOOST_LAMBDA_CORE_HPP
#define BOOST_LAMBDA_CORE_HPP
#include "boost/type_traits/transform_traits.hpp"
#include "boost/type_traits/cv_traits.hpp"
#include "boost/tuple/tuple.hpp"
// inject some of the tuple names into lambda
namespace boost {
namespace lambda {
using ::boost::tuples::tuple;
using ::boost::tuples::null_type;
} // lambda
} // boost
#include "boost/lambda/detail/lambda_config.hpp"
#include "boost/lambda/detail/lambda_fwd.hpp"
#include "boost/lambda/detail/arity_code.hpp"
#include "boost/lambda/detail/actions.hpp"
#include "boost/lambda/detail/lambda_traits.hpp"
#include "boost/lambda/detail/function_adaptors.hpp"
#include "boost/lambda/detail/return_type_traits.hpp"
#include "boost/lambda/detail/select_functions.hpp"
#include "boost/lambda/detail/lambda_functor_base.hpp"
#include "boost/lambda/detail/lambda_functors.hpp"
#include "boost/lambda/detail/ret.hpp"
namespace boost {
namespace lambda {
namespace {
// These are constants types and need to be initialised
boost::lambda::placeholder1_type free1 = boost::lambda::placeholder1_type();
boost::lambda::placeholder2_type free2 = boost::lambda::placeholder2_type();
boost::lambda::placeholder3_type free3 = boost::lambda::placeholder3_type();
boost::lambda::placeholder1_type& _1 = free1;
boost::lambda::placeholder2_type& _2 = free2;
boost::lambda::placeholder3_type& _3 = free3;
// _1, _2, ... naming scheme by Peter Dimov
} // unnamed
} // lambda
} // boost
#endif //BOOST_LAMBDA_CORE_HPP

View File

@@ -0,0 +1,174 @@
// -- Boost Lambda Library - actions.hpp ----------------------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
// For more information, see www.boost.org
// ----------------------------------------------------------------
#ifndef BOOST_LAMBDA_ACTIONS_HPP
#define BOOST_LAMBDA_ACTIONS_HPP
namespace boost {
namespace lambda {
template<int Arity, class Act> class action;
// these need to be defined here, since the corresponding lambda
// functions are members of lambda_functor classes
class assignment_action {};
class subscript_action {};
template <class Action> class other_action;
// action for specifying the explicit return type
template <class RET> class explicit_return_type_action {};
// action for preventing the expansion of a lambda expression
struct protect_action {};
// must be defined here, comma is a special case
struct comma_action {};
// actions, for which the existence of protect is checked in return type
// deduction.
template <class Action> struct is_protectable {
BOOST_STATIC_CONSTANT(bool, value = false);
};
// NOTE: comma action is protectable. Other protectable actions
// are listed in operator_actions.hpp
template<> struct is_protectable<other_action<comma_action> > {
BOOST_STATIC_CONSTANT(bool, value = true);
};
namespace detail {
// this type is used in return type deductions to signal that deduction
// did not find a result. It does not necessarily mean an error, it commonly
// means that something else should be tried.
class unspecified {};
}
// function action is a special case: bind functions can be called with
// the return type specialized explicitly e.g. bind<int>(foo);
// If this call syntax is used, the return type is stored in the latter
// argument of function_action template. Otherwise the argument gets the type
// 'unspecified'.
// This argument is only relevant in the return type deduction code
template <int I, class Result_type = detail::unspecified>
class function_action {};
template<class T> class function_action<1, T> {
public:
template<class RET, class A1>
static RET apply(A1& a1) {
return function_adaptor<typename boost::remove_cv<A1>::type>::
template apply<RET>(a1);
}
};
template<class T> class function_action<2, T> {
public:
template<class RET, class A1, class A2>
static RET apply(A1& a1, A2& a2) {
return function_adaptor<typename boost::remove_cv<A1>::type>::
template apply<RET>(a1, a2);
}
};
template<class T> class function_action<3, T> {
public:
template<class RET, class A1, class A2, class A3>
static RET apply(A1& a1, A2& a2, A3& a3) {
return function_adaptor<typename boost::remove_cv<A1>::type>::
template apply<RET>(a1, a2, a3);
}
};
template<class T> class function_action<4, T> {
public:
template<class RET, class A1, class A2, class A3, class A4>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4) {
return function_adaptor<typename boost::remove_cv<A1>::type>::
template apply<RET>(a1, a2, a3, a4);
}
};
template<class T> class function_action<5, T> {
public:
template<class RET, class A1, class A2, class A3, class A4, class A5>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
return function_adaptor<typename boost::remove_cv<A1>::type>::
template apply<RET>(a1, a2, a3, a4, a5);
}
};
template<class T> class function_action<6, T> {
public:
template<class RET, class A1, class A2, class A3, class A4, class A5,
class A6>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
return function_adaptor<typename boost::remove_cv<A1>::type>::
template apply<RET>(a1, a2, a3, a4, a5, a6);
}
};
template<class T> class function_action<7, T> {
public:
template<class RET, class A1, class A2, class A3, class A4, class A5,
class A6, class A7>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
return function_adaptor<typename boost::remove_cv<A1>::type>::
template apply<RET>(a1, a2, a3, a4, a5, a6, a7);
}
};
template<class T> class function_action<8, T> {
public:
template<class RET, class A1, class A2, class A3, class A4, class A5,
class A6, class A7, class A8>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7,
A8& a8) {
return function_adaptor<typename boost::remove_cv<A1>::type>::
template apply<RET>(a1, a2, a3, a4, a5, a6, a7, a8);
}
};
template<class T> class function_action<9, T> {
public:
template<class RET, class A1, class A2, class A3, class A4, class A5,
class A6, class A7, class A8, class A9>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7,
A8& a8, A9& a9) {
return function_adaptor<typename boost::remove_cv<A1>::type>::
template apply<RET>(a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
};
template<class T> class function_action<10, T> {
public:
template<class RET, class A1, class A2, class A3, class A4, class A5,
class A6, class A7, class A8, class A9, class A10>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7,
A8& a8, A9& a9, A10& a10) {
return function_adaptor<typename boost::remove_cv<A1>::type>::
template apply<RET>(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
}
};
} // namespace lambda
} // namespace boost
#endif

View File

@@ -0,0 +1,110 @@
// -- Boost Lambda Library -------------------------------------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// --------------------------------------------------
#ifndef BOOST_LAMBDA_ARITY_CODE_HPP
#define BOOST_LAMBDA_ARITY_CODE_HPP
#include "boost/type_traits/cv_traits.hpp"
#include "boost/type_traits/transform_traits.hpp"
namespace boost {
namespace lambda {
// These constants state, whether a lambda_functor instantiation results from
// an expression which contains no placeholders (NONE),
// only free1 placeholders (FIRST),
// free2 placeholders and maybe free1 placeholders (SECOND),
// free3 and maybe free1 and free2 placeholders (THIRD),
// freeE placeholders and maybe free1 and free2 (EXCEPTION).
// RETHROW means, that a rethrow expression is used somewhere in the lambda_functor.
enum { NONE = 0x00, // Notice we are using bits as flags here.
FIRST = 0x01,
SECOND = 0x02,
THIRD = 0x04,
EXCEPTION = 0x08,
RETHROW = 0x10};
template<class T>
struct get_tuple_arity;
namespace detail {
template <class T> struct get_arity_;
} // end detail;
template <class T> struct get_arity {
BOOST_STATIC_CONSTANT(int, value = detail::get_arity_<typename boost::remove_cv<typename boost::remove_reference<T>::type>::type>::value);
};
namespace detail {
template<class T>
struct get_arity_ {
BOOST_STATIC_CONSTANT(int, value = 0);
};
template<class T>
struct get_arity_<lambda_functor<T> > {
BOOST_STATIC_CONSTANT(int, value = get_arity<T>::value);
};
template<class Action, class Args>
struct get_arity_<lambda_functor_base<Action, Args> > {
BOOST_STATIC_CONSTANT(int, value = get_tuple_arity<Args>::value);
};
template<int I>
struct get_arity_<placeholder<I> > {
BOOST_STATIC_CONSTANT(int, value = I);
};
} // detail
template<class T>
struct get_tuple_arity {
BOOST_STATIC_CONSTANT(int, value = get_arity<typename T::head_type>::value | get_tuple_arity<typename T::tail_type>::value);
};
template<>
struct get_tuple_arity<null_type> {
BOOST_STATIC_CONSTANT(int, value = 0);
};
// Does T have placeholder<I> as it's subexpression?
template<class T, int I>
struct has_placeholder {
BOOST_STATIC_CONSTANT(bool, value = (get_arity<T>::value & I) != 0);
};
template<int I, int J>
struct includes_placeholder {
BOOST_STATIC_CONSTANT(bool, value = (J & I) != 0);
};
template<int I, int J>
struct lacks_placeholder {
BOOST_STATIC_CONSTANT(bool, value = ((J & I) == 0));
};
} // namespace lambda
} // namespace boost
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
// Boost Lambda Library -- control_constructs_common.hpp -------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// --------------------------------------------------------------------------
#if !defined(BOOST_CONTROL_CONSTRUCTS_COMMON_HPP)
#define BOOST_CONTROL_CONSTRUCTS_COMMON_HPP
namespace boost {
namespace lambda {
// special types of lambda functors, used with control structures
// to guarantee that they are composed correctly.
template<class Tag, class LambdaFunctor>
class tagged_lambda_functor;
template<class Tag, class Args>
class tagged_lambda_functor<Tag, lambda_functor<Args> >
: public lambda_functor<Args>
{
public:
tagged_lambda_functor(const Args& a) : lambda_functor<Args>(a) {}
tagged_lambda_functor(const lambda_functor<Args>& a)
: lambda_functor<Args>(a) {}
// for the no body cases in control structures.
tagged_lambda_functor() : lambda_functor<Args>() {}
};
} // lambda
} // boost
#endif // BOOST_CONTROL_CONSTRUCTS_COMMON_HPP

View File

@@ -0,0 +1,550 @@
// Boost Lambda Library -- control_structures_impl.hpp ---------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// --------------------------------------------------------------------------
#if !defined(BOOST_LAMBDA_CONTROL_CONSTRUCTS_HPP)
#define BOOST_LAMBDA_CONTROL_CONSTRUCTS_HPP
namespace boost {
namespace lambda {
// -- void return control actions ----------------------
class forloop_action {};
class forloop_no_body_action {};
class ifthen_action {};
class ifthenelse_action {};
class whileloop_action {};
class whileloop_no_body_action {};
class dowhileloop_action {};
class dowhileloop_no_body_action {};
// -- nonvoid return control actions ----------------------
class ifthenelsereturn_action {};
// For loop
template <class Arg1, class Arg2, class Arg3, class Arg4>
inline const
lambda_functor<
lambda_functor_base<
forloop_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2>,
lambda_functor<Arg3>, lambda_functor<Arg4> >
>
>
for_loop(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2,
const lambda_functor<Arg3>& a3, const lambda_functor<Arg4>& a4) {
return
lambda_functor_base<
forloop_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2>,
lambda_functor<Arg3>, lambda_functor<Arg4> >
>
( tuple<lambda_functor<Arg1>, lambda_functor<Arg2>,
lambda_functor<Arg3>, lambda_functor<Arg4> >(a1, a2, a3, a4)
);
}
// No body case.
template <class Arg1, class Arg2, class Arg3>
inline const
lambda_functor<
lambda_functor_base<
forloop_no_body_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2>, lambda_functor<Arg3> >
>
>
for_loop(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2,
const lambda_functor<Arg3>& a3) {
return
lambda_functor_base<
forloop_no_body_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2>,
lambda_functor<Arg3> >
>
( tuple<lambda_functor<Arg1>, lambda_functor<Arg2>,
lambda_functor<Arg3> >(a1, a2, a3) );
}
// While loop
template <class Arg1, class Arg2>
inline const
lambda_functor<
lambda_functor_base<
whileloop_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
>
>
while_loop(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2) {
return
lambda_functor_base<
whileloop_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
>
( tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >(a1, a2));
}
// No body case.
template <class Arg1>
inline const
lambda_functor<
lambda_functor_base<
whileloop_no_body_action,
tuple<lambda_functor<Arg1> >
>
>
while_loop(const lambda_functor<Arg1>& a1) {
return
lambda_functor_base<
whileloop_no_body_action,
tuple<lambda_functor<Arg1> >
>
( tuple<lambda_functor<Arg1> >(a1) );
}
// Do While loop
template <class Arg1, class Arg2>
inline const
lambda_functor<
lambda_functor_base<
dowhileloop_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
>
>
do_while_loop(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2) {
return
lambda_functor_base<
dowhileloop_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
>
( tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >(a1, a2));
}
// No body case.
template <class Arg1>
inline const
lambda_functor<
lambda_functor_base<
dowhileloop_no_body_action,
tuple<lambda_functor<Arg1> >
>
>
do_while_loop(const lambda_functor<Arg1>& a1) {
return
lambda_functor_base<
dowhileloop_no_body_action,
tuple<lambda_functor<Arg1> >
>
( tuple<lambda_functor<Arg1> >(a1));
}
// If Then
template <class Arg1, class Arg2>
inline const
lambda_functor<
lambda_functor_base<
ifthen_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
>
>
if_then(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2) {
return
lambda_functor_base<
ifthen_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
>
( tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >(a1, a2) );
}
// If then else
template <class Arg1, class Arg2, class Arg3>
inline const
lambda_functor<
lambda_functor_base<
ifthenelse_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2>, lambda_functor<Arg3> >
>
>
if_then_else(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2,
const lambda_functor<Arg3>& a3) {
return
lambda_functor_base<
ifthenelse_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2>, lambda_functor<Arg3> >
>
(tuple<lambda_functor<Arg1>, lambda_functor<Arg2>, lambda_functor<Arg3> >
(a1, a2, a3) );
}
// Our version of operator?:()
template <class Arg1, class Arg2, class Arg3>
inline const
lambda_functor<
lambda_functor_base<
other_action<ifthenelsereturn_action>,
tuple<lambda_functor<Arg1>,
typename const_copy_argument<Arg2>::type,
typename const_copy_argument<Arg3>::type>
>
>
if_then_else_return(const lambda_functor<Arg1>& a1,
const Arg2 & a2,
const Arg3 & a3) {
return
lambda_functor_base<
other_action<ifthenelsereturn_action>,
tuple<lambda_functor<Arg1>,
typename const_copy_argument<Arg2>::type,
typename const_copy_argument<Arg3>::type>
> ( tuple<lambda_functor<Arg1>,
typename const_copy_argument<Arg2>::type,
typename const_copy_argument<Arg3>::type> (a1, a2, a3) );
}
namespace detail {
// return type specialization for conditional expression begins -----------
// start reading below and move upwards
// PHASE 6:1
// check if A is conbertible to B and B to A
template<int Phase, bool AtoB, bool BtoA, bool SameType, class A, class B>
struct return_type_2_ifthenelsereturn;
// if A can be converted to B and vice versa -> ambiguous
template<int Phase, class A, class B>
struct return_type_2_ifthenelsereturn<Phase, true, true, false, A, B> {
typedef
detail::return_type_deduction_failure<return_type_2_ifthenelsereturn> type;
// ambiguous type in conditional expression
};
// if A can be converted to B and vice versa and are of same type
template<int Phase, class A, class B>
struct return_type_2_ifthenelsereturn<Phase, true, true, true, A, B> {
typedef A type;
};
// A can be converted to B
template<int Phase, class A, class B>
struct return_type_2_ifthenelsereturn<Phase, true, false, false, A, B> {
typedef B type;
};
// B can be converted to A
template<int Phase, class A, class B>
struct return_type_2_ifthenelsereturn<Phase, false, true, false, A, B> {
typedef A type;
};
// neither can be converted. Then we drop the potential references, and
// try again
template<class A, class B>
struct return_type_2_ifthenelsereturn<1, false, false, false, A, B> {
// it is safe to add const, since the result will be an rvalue and thus
// const anyway. The const are needed eg. if the types
// are 'const int*' and 'void *'. The remaining type should be 'const void*'
typedef const typename boost::remove_reference<A>::type plainA;
typedef const typename boost::remove_reference<B>::type plainB;
// TODO: Add support for volatile ?
typedef typename
return_type_2_ifthenelsereturn<
2,
boost::is_convertible<plainA,plainB>::value,
boost::is_convertible<plainB,plainA>::value,
boost::is_same<plainA,plainB>::value,
plainA,
plainB>::type type;
};
// PHASE 6:2
template<class A, class B>
struct return_type_2_ifthenelsereturn<2, false, false, false, A, B> {
typedef
detail::return_type_deduction_failure<return_type_2_ifthenelsereturn> type;
// types_do_not_match_in_conditional_expression
};
// PHASE 5: now we know that types are not arithmetic.
template<class A, class B>
struct non_numeric_types {
typedef typename
return_type_2_ifthenelsereturn<
1, // phase 1
is_convertible<A,B>::value,
is_convertible<B,A>::value,
is_same<A,B>::value,
A,
B>::type type;
};
// PHASE 4 :
// the base case covers arithmetic types with differing promote codes
// use the type deduction of arithmetic_actions
template<int CodeA, int CodeB, class A, class B>
struct arithmetic_or_not {
typedef typename
return_type_2<arithmetic_action<plus_action>, A, B>::type type;
// plus_action is just a random pick, has to be a concrete instance
};
// this case covers the case of artihmetic types with the same promote codes.
// non numeric deduction is used since e.g. integral promotion is not
// performed with operator ?:
template<int CodeA, class A, class B>
struct arithmetic_or_not<CodeA, CodeA, A, B> {
typedef typename non_numeric_types<A, B>::type type;
};
// if either A or B has promote code -1 it is not an arithmetic type
template<class A, class B>
struct arithmetic_or_not <-1, -1, A, B> {
typedef typename non_numeric_types<A, B>::type type;
};
template<int CodeB, class A, class B>
struct arithmetic_or_not <-1, CodeB, A, B> {
typedef typename non_numeric_types<A, B>::type type;
};
template<int CodeA, class A, class B>
struct arithmetic_or_not <CodeA, -1, A, B> {
typedef typename non_numeric_types<A, B>::type type;
};
// PHASE 3 : Are the types same?
// No, check if they are arithmetic or not
template <class A, class B>
struct same_or_not {
typedef typename detail::remove_reference_and_cv<A>::type plainA;
typedef typename detail::remove_reference_and_cv<B>::type plainB;
typedef typename
arithmetic_or_not<
detail::promote_code<plainA>::value,
detail::promote_code<plainB>::value,
A,
B>::type type;
};
// Yes, clear.
template <class A> struct same_or_not<A, A> {
typedef A type;
};
} // detail
// PHASE 2 : Perform first the potential array_to_pointer conversion
template<class A, class B>
struct return_type_2<other_action<ifthenelsereturn_action>, A, B> {
typedef typename detail::array_to_pointer<A>::type A1;
typedef typename detail::array_to_pointer<B>::type B1;
typedef typename
boost::add_const<typename detail::same_or_not<A1, B1>::type>::type type;
};
// PHASE 1 : Deduction is based on the second and third operand
// return type specialization for conditional expression ends -----------
// Control loop lambda_functor_base specializations.
// Specialization for for_loop.
template<class Args>
class
lambda_functor_base<forloop_action, Args> {
public:
Args args;
template <class T> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
for(detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
detail::select(boost::tuples::get<2>(args), CALL_ACTUAL_ARGS))
detail::select(boost::tuples::get<3>(args), CALL_ACTUAL_ARGS);
}
};
// No body case
template<class Args>
class
lambda_functor_base<forloop_no_body_action, Args> {
public:
Args args;
template <class T> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
for(detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
detail::select(boost::tuples::get<2>(args), CALL_ACTUAL_ARGS)) {}
}
};
// Specialization for while_loop.
template<class Args>
class
lambda_functor_base<whileloop_action, Args> {
public:
Args args;
template <class T> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
while(detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS))
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
}
};
// No body case
template<class Args>
class
lambda_functor_base<whileloop_no_body_action, Args> {
public:
Args args;
template <class T> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
while(detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS)) {}
}
};
// Specialization for do_while_loop.
// Note that the first argument is the condition.
template<class Args>
class
lambda_functor_base<dowhileloop_action, Args> {
public:
Args args;
template <class T> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
do {
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
} while (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) );
}
};
// No body case
template<class Args>
class
lambda_functor_base<dowhileloop_no_body_action, Args> {
public:
Args args;
template <class T> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
do {} while (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) );
}
};
// Specialization for if_then.
template<class Args>
class
lambda_functor_base<ifthen_action, Args> {
public:
Args args;
template <class T> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
if (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS)) detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
}
};
// Specialization for if_then_else.
template<class Args>
class
lambda_functor_base<ifthenelse_action, Args> {
public:
Args args;
template <class T> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
if (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS))
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
else
detail::select(boost::tuples::get<2>(args), CALL_ACTUAL_ARGS);
}
};
// Specialization of lambda_functor_base for if_then_else_return.
template<class Args>
class
lambda_functor_base<other_action<ifthenelsereturn_action>, Args> {
public:
Args args;
template <class SigArgs> struct sig {
private:
typedef typename detail::nth_return_type_sig<1, Args, SigArgs>::type ret1;
typedef typename detail::nth_return_type_sig<2, Args, SigArgs>::type ret2;
public:
typedef typename return_type_2<
other_action<ifthenelsereturn_action>, ret1, ret2
>::type type;
};
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
return (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS)) ?
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS)
:
detail::select(boost::tuples::get<2>(args), CALL_ACTUAL_ARGS);
}
};
} // lambda
} // boost
#endif // BOOST_LAMBDA_CONTROL_CONSTRUCTS_HPP

View File

@@ -0,0 +1,640 @@
// Boost Lambda Library - function_adaptors.hpp ----------------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see www.boost.org
#ifndef BOOST_LAMBDA_FUNCTION_ADAPTORS_HPP
#define BOOST_LAMBDA_FUNCTION_ADAPTORS_HPP
#include "boost/type_traits/same_traits.hpp"
namespace boost {
namespace lambda {
template <class Func> struct function_adaptor {
// we do not know the return type off-hand, we must ask it from Func
template <class Args> class sig {
typedef typename Args::head_type F;
typedef typename detail::remove_reference_and_cv<Func>::type plainF;
public:
// To sig we pass a cons list, where the head is the function object type
// itself (potentially cv-qualified)
// and the tail contains the types of the actual arguments to be passed
// to the function object. The arguments can be cv qualified
// as well.
typedef typename plainF::template sig<Args>::type type;
};
template<class RET, class A1>
static RET apply(A1& a1) {
return a1();
}
template<class RET, class A1, class A2>
static RET apply(A1& a1, A2& a2) {
return a1(a2);
}
template<class RET, class A1, class A2, class A3>
static RET apply(A1& a1, A2& a2, A3& a3) {
return a1(a2, a3);
}
template<class RET, class A1, class A2, class A3, class A4>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4) {
return a1(a2, a3, a4);
}
template<class RET, class A1, class A2, class A3, class A4, class A5>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
return a1(a2, a3, a4, a5);
}
template<class RET, class A1, class A2, class A3, class A4, class A5, class A6>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
return a1(a2, a3, a4, a5, a6);
}
template<class RET, class A1, class A2, class A3, class A4, class A5, class A6,
class A7>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6,
A7& a7) {
return a1(a2, a3, a4, a5, a6, a7);
}
template<class RET, class A1, class A2, class A3, class A4, class A5, class A6,
class A7, class A8>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6,
A7& a7, A8& a8) {
return a1(a2, a3, a4, a5, a6, a7, a8);
}
template<class RET, class A1, class A2, class A3, class A4, class A5, class A6,
class A7, class A8, class A9>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6,
A7& a7, A8& a8, A9& a9) {
return a1(a2, a3, a4, a5, a6, a7, a8, a9);
}
template<class RET, class A1, class A2, class A3, class A4, class A5, class A6,
class A7, class A8, class A9, class A10>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6,
A7& a7, A8& a8, A9& a9, A10& a10) {
return a1(a2, a3, a4, a5, a6, a7, a8, a9, a10);
}
};
template <class Func> struct function_adaptor<const Func>; // error
// -- function adaptors with data member access
template <class Object, class T>
struct function_adaptor<T Object::*> {
// typedef detail::unspecified type;
// T can have qualifiers and can be a reference type
// We get the return type by adding const, if the object through which
// the data member is accessed is const, and finally adding a reference
template<class Args> class sig {
typedef typename boost::tuples::element<1, Args>::type argument_type;
typedef typename detail::IF<boost::is_const<argument_type>::value,
typename boost::add_const<T>::type,
T
>::RET properly_consted_return_type;
typedef typename detail::IF<
boost::is_volatile<properly_consted_return_type>::value,
typename boost::add_volatile<properly_consted_return_type>::type,
properly_consted_return_type
>::RET properly_cvd_return_type;
public:
typedef typename
boost::add_reference<properly_cvd_return_type>::type type;
};
template <class RET>
static RET apply( T Object::*data, Object& o) {
return o.*data;
}
template <class RET>
static RET apply( T Object::*data, const Object& o) {
return o.*data;
}
template <class RET>
static RET apply( T Object::*data, volatile Object& o) {
return o.*data;
}
template <class RET>
static RET apply( T Object::*data, const volatile Object& o) {
return o.*data;
}
template <class RET>
static RET apply( T Object::*data, Object* o) {
return o->*data;
}
template <class RET>
static RET apply( T Object::*data, const Object* o) {
return o->*data;
}
template <class RET>
static RET apply( T Object::*data, volatile Object* o) {
return o->*data;
}
template <class RET>
static RET apply( T Object::*data, const volatile Object* o) {
return o->*data;
}
};
// -- function adaptors with 1 argument apply
template <class Result>
struct function_adaptor<Result (void)> {
template<class T> struct sig { typedef Result type; };
template <class RET>
static Result apply(Result (*func)()) {
return func();
}
};
template <class Result>
struct function_adaptor<Result (*)(void)> {
template<class T> struct sig { typedef Result type; };
template <class RET>
static Result apply(Result (*func)()) {
return func();
}
};
// -- function adaptors with 2 argument apply
template <class Object, class Result>
struct function_adaptor<Result (Object::*)() const> {
template<class T> struct sig { typedef Result type; };
template <class RET>
static Result apply( Result (Object::*func)() const, const Object* o) {
return (o->*func)();
}
template <class RET>
static Result apply( Result (Object::*func)() const, const Object& o) {
return (o.*func)();
}
};
template <class Object, class Result>
struct function_adaptor<Result (Object::*)()> {
template<class T> struct sig { typedef Result type; };
template <class RET>
static Result apply( Result (Object::*func)(), Object* o) {
return (o->*func)();
}
template <class RET>
static Result apply( Result (Object::*func)(), Object& o) {
return (o.*func)();
}
};
template <class Arg1, class Result>
struct function_adaptor<Result (Arg1)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1>
static Result apply(Result (*func)(Arg1), A1& a1) {
return func(a1);
}
};
template <class Arg1, class Result>
struct function_adaptor<Result (*)(Arg1)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1>
static Result apply(Result (*func)(Arg1), A1& a1) {
return func(a1);
}
};
// -- function adaptors with 3 argument apply
template <class Object, class Arg1, class Result>
struct function_adaptor<Result (Object::*)(Arg1) const> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1>
static Result apply( Result (Object::*func)(Arg1) const, const Object* o,
A1& a1) {
return (o->*func)(a1);
}
template <class RET, class A1>
static Result apply( Result (Object::*func)(Arg1) const, const Object& o,
A1& a1) {
return (o.*func)(a1);
}
};
template <class Object, class Arg1, class Result>
struct function_adaptor<Result (Object::*)(Arg1)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1>
static Result apply( Result (Object::*func)(Arg1), Object* o, A1& a1) {
return (o->*func)(a1);
}
template <class RET, class A1>
static Result apply( Result (Object::*func)(Arg1), Object& o, A1& a1) {
return (o.*func)(a1);
}
};
template <class Arg1, class Arg2, class Result>
struct function_adaptor<Result (Arg1, Arg2)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2>
static Result apply(Result (*func)(Arg1, Arg2), A1& a1, A2& a2) {
return func(a1, a2);
}
};
template <class Arg1, class Arg2, class Result>
struct function_adaptor<Result (*)(Arg1, Arg2)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2>
static Result apply(Result (*func)(Arg1, Arg2), A1& a1, A2& a2) {
return func(a1, a2);
}
};
// -- function adaptors with 4 argument apply
template <class Object, class Arg1, class Arg2, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2) const> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2>
static Result apply( Result (Object::*func)(Arg1, Arg2) const, const Object* o, A1& a1, A2& a2) {
return (o->*func)(a1, a2);
}
template <class RET, class A1, class A2>
static Result apply( Result (Object::*func)(Arg1, Arg2) const, const Object& o, A1& a1, A2& a2) {
return (o.*func)(a1, a2);
}
};
template <class Object, class Arg1, class Arg2, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2>
static Result apply( Result (Object::*func)(Arg1, Arg2), Object* o, A1& a1, A2& a2) {
return (o->*func)(a1, a2);
}
template <class RET, class A1, class A2>
static Result apply( Result (Object::*func)(Arg1, Arg2), Object& o, A1& a1, A2& a2) {
return (o.*func)(a1, a2);
}
};
template <class Arg1, class Arg2, class Arg3, class Result>
struct function_adaptor<Result (Arg1, Arg2, Arg3)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3>
static Result apply(Result (*func)(Arg1, Arg2, Arg3), A1& a1, A2& a2, A3& a3) {
return func(a1, a2, a3);
}
};
template <class Arg1, class Arg2, class Arg3, class Result>
struct function_adaptor<Result (*)(Arg1, Arg2, Arg3)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3>
static Result apply(Result (*func)(Arg1, Arg2, Arg3), A1& a1, A2& a2, A3& a3) {
return func(a1, a2, a3);
}
};
// -- function adaptors with 5 argument apply
template <class Object, class Arg1, class Arg2, class Arg3, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3) const> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3) const, const Object* o, A1& a1, A2& a2, A3& a3) {
return (o->*func)(a1, a2, a3);
}
template <class RET, class A1, class A2, class A3>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3) const, const Object& o, A1& a1, A2& a2, A3& a3) {
return (o.*func)(a1, a2, a3);
}
};
template <class Object, class Arg1, class Arg2, class Arg3, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3), Object* o, A1& a1, A2& a2, A3& a3) {
return (o->*func)(a1, a2, a3);
}
template <class RET, class A1, class A2, class A3>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3), Object& o, A1& a1, A2& a2, A3& a3) {
return (o.*func)(a1, a2, a3);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Result>
struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4), A1& a1, A2& a2, A3& a3, A4& a4) {
return func(a1, a2, a3, a4);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Result>
struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4), A1& a1, A2& a2, A3& a3, A4& a4) {
return func(a1, a2, a3, a4);
}
};
// -- function adaptors with 6 argument apply
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4) const> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4) {
return (o->*func)(a1, a2, a3, a4);
}
template <class RET, class A1, class A2, class A3, class A4>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4) {
return (o.*func)(a1, a2, a3, a4);
}
};
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4), Object* o, A1& a1, A2& a2, A3& a3, A4& a4) {
return (o->*func)(a1, a2, a3, a4);
}
template <class RET, class A1, class A2, class A3, class A4>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4), Object& o, A1& a1, A2& a2, A3& a3, A4& a4) {
return (o.*func)(a1, a2, a3, a4);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result>
struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
return func(a1, a2, a3, a4, a5);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result>
struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
return func(a1, a2, a3, a4, a5);
}
};
// -- function adaptors with 7 argument apply
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5) const> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
return (o->*func)(a1, a2, a3, a4, a5);
}
template <class RET, class A1, class A2, class A3, class A4, class A5>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
return (o.*func)(a1, a2, a3, a4, a5);
}
};
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
return (o->*func)(a1, a2, a3, a4, a5);
}
template <class RET, class A1, class A2, class A3, class A4, class A5>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
return (o.*func)(a1, a2, a3, a4, a5);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result>
struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
return func(a1, a2, a3, a4, a5, a6);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result>
struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
return func(a1, a2, a3, a4, a5, a6);
}
};
// -- function adaptors with 8 argument apply
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
return (o->*func)(a1, a2, a3, a4, a5, a6);
}
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
return (o.*func)(a1, a2, a3, a4, a5, a6);
}
};
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
return (o->*func)(a1, a2, a3, a4, a5, a6);
}
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
return (o.*func)(a1, a2, a3, a4, a5, a6);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result>
struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
return func(a1, a2, a3, a4, a5, a6, a7);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result>
struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
return func(a1, a2, a3, a4, a5, a6, a7);
}
};
// -- function adaptors with 9 argument apply
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
return (o->*func)(a1, a2, a3, a4, a5, a6, a7);
}
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
return (o.*func)(a1, a2, a3, a4, a5, a6, a7);
}
};
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
return (o->*func)(a1, a2, a3, a4, a5, a6, a7);
}
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
return (o.*func)(a1, a2, a3, a4, a5, a6, a7);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result>
struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
return func(a1, a2, a3, a4, a5, a6, a7, a8);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result>
struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
return func(a1, a2, a3, a4, a5, a6, a7, a8);
}
};
// -- function adaptors with 10 argument apply
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
return (o->*func)(a1, a2, a3, a4, a5, a6, a7, a8);
}
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
return (o.*func)(a1, a2, a3, a4, a5, a6, a7, a8);
}
};
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
return (o->*func)(a1, a2, a3, a4, a5, a6, a7, a8);
}
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
return (o.*func)(a1, a2, a3, a4, a5, a6, a7, a8);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Arg9, class Result>
struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8, A9& a9) {
return func(a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Arg9, class Result>
struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8, A9& a9) {
return func(a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
};
} // namespace lambda
} // namespace boost
#endif

View File

@@ -0,0 +1,104 @@
// Boost Lambda Library - is_instance_of.hpp ---------------------
// Copyright (C) 2001 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// ---------------------------------------------------------------
#ifndef BOOST_LAMBDA_IS_INSTANCE_OF
#define BOOST_LAMBDA_IS_INSTANCE_OF
#include "boost/config.hpp" // for BOOST_STATIC_CONSTANT
#include "boost/type_traits/conversion_traits.hpp" // for is_convertible
#include "boost/preprocessor/enum_shifted_params.hpp"
#include "boost/preprocessor/repeat_2nd.hpp"
// is_instance_of --------------------------------
//
// is_instance_of_n<A, B>::value is true, if type A is
// an instantiation of a template B, or A derives from an instantiation
// of template B
//
// n is the number of template arguments for B
//
// Example:
// is_instance_of_2<std::istream, basic_stream>::value == true
// The original implementation was somewhat different, with different versions
// for different compilers. However, there was still a problem
// with gcc.3.0.2 and 3.0.3 compilers, which didn't think regard
// is_instance_of_N<...>::value was a constant.
// John Maddock suggested the way around this problem by building
// is_instance_of templates using boost::is_convertible.
// Now we only have one version of is_instance_of templates, which delagate
// all the nasty compiler tricks to is_convertible.
#define BOOST_LAMBDA_CLASS(z, N,A) BOOST_PP_COMMA_IF(N) class
#define BOOST_LAMBDA_CLASS_ARG(z, N,A) BOOST_PP_COMMA_IF(N) class A##N
#define BOOST_LAMBDA_ARG(z, N,A) BOOST_PP_COMMA_IF(N) A##N
#define BOOST_LAMBDA_CLASS_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_CLASS, NAME)
#define BOOST_LAMBDA_CLASS_ARG_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_CLASS_ARG, NAME)
#define BOOST_LAMBDA_ARG_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_ARG, NAME)
namespace boost {
namespace lambda {
#define BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE(INDEX) \
\
namespace detail { \
\
template <template<BOOST_LAMBDA_CLASS_LIST(INDEX,T)> class F> \
struct BOOST_PP_CAT(conversion_tester_,INDEX) { \
template<BOOST_LAMBDA_CLASS_ARG_LIST(INDEX,A)> \
BOOST_PP_CAT(conversion_tester_,INDEX) \
(const F<BOOST_LAMBDA_ARG_LIST(INDEX,A)>&); \
}; \
\
} /* end detail */ \
\
template <class From, template <BOOST_LAMBDA_CLASS_LIST(INDEX,T)> class To> \
struct BOOST_PP_CAT(is_instance_of_,INDEX) \
{ \
private: \
typedef ::boost::is_convertible< \
From, \
BOOST_PP_CAT(detail::conversion_tester_,INDEX)<To> \
> helper_type; \
\
public: \
BOOST_STATIC_CONSTANT(bool, value = helper_type::value); \
};
#define BOOST_LAMBDA_HELPER(z, N, A) BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE( BOOST_PP_INC(N) )
// Generate the traits for 1-4 argument templates
BOOST_PP_REPEAT_2ND(4,BOOST_LAMBDA_HELPER,FOO)
#undef BOOST_LAMBDA_HELPER
#undef BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE
#undef BOOST_LAMBDA_CLASS
#undef BOOST_LAMBDA_ARG
#undef BOOST_LAMBDA_CLASS_ARG
#undef BOOST_LAMBDA_CLASS_LIST
#undef BOOST_LAMBDA_ARG_LIST
#undef BOOST_LAMBDA_CLASS_ARG_LIST
} // lambda
} // boost
#endif

View File

@@ -0,0 +1,48 @@
// Boost Lambda Library - lambda_config.hpp ------------------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// ---------------------------------------------------------------
#ifndef BOOST_LAMBDA_LAMBDA_CONFIG_HPP
#define BOOST_LAMBDA_LAMBDA_CONFIG_HPP
// add to boost/config.hpp
// for now
# if defined __GNUC__
# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
# define BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T
# define BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING
# endif
# if (__GNUC__ == 2 && __GNUC_MINOR__ <= 97)
# define BOOST_NO_TEMPLATED_STREAMS
# define BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING
# endif
# if (__GNUC__ == 2 && __GNUC_MINOR__ <= 95)
# define BOOST_LAMBDA_FAILS_IN_TEMPLATE_KEYWORD_AFTER_SCOPE_OPER
# endif
# endif // __GNUC__
#if defined __KCC
#define BOOST_NO_FDECL_TEMPLATES_AS_TEMPLATE_TEMPLATE_PARAMS
#endif // __KCC
#endif

View File

@@ -0,0 +1,599 @@
// Boost Lambda Library lambda_functor_base.hpp -----------------------------
//
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// ------------------------------------------------------------
#ifndef BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_HPP
#define BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_HPP
namespace boost {
namespace lambda {
// for return type deductions we wrap bound argument to this class,
// which fulfils the base class contract for lambda_functors
template <class T>
class identity {
T elem;
public:
typedef T element_t;
// take all parameters as const references. Note that non-const references
// stay as they are.
typedef typename boost::add_reference<
typename boost::add_const<T>::type
>::type par_t;
explicit identity(par_t t) : elem(t) {}
template <typename SigArgs>
struct sig { typedef element_t type; };
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return elem; }
};
template <class T>
inline lambda_functor<identity<T&> > var(T& t) { return identity<T&>(t); }
// for lambda functors, var is an identity operator. It was forbidden
// at some point, but we might want to var something that can be a
// non-lambda functor or a lambda functor.
template <class T>
lambda_functor<T> var(const lambda_functor<T>& t) { return t; }
template <class T> struct var_type {
typedef lambda_functor<identity<T&> > type;
};
template <class T>
inline
lambda_functor<identity<typename bound_argument_conversion<const T>::type> >
constant(const T& t) {
return identity<typename bound_argument_conversion<const T>::type>(t);
}
template <class T>
lambda_functor<T> constant(const lambda_functor<T>& t) { return t; }
template <class T> struct constant_type {
typedef
lambda_functor<
identity<typename bound_argument_conversion<const T>::type>
> type;
};
template <class T>
inline lambda_functor<identity<const T&> > constant_ref(const T& t) {
return identity<const T&>(t);
}
template <class T>
lambda_functor<T> constant_ref(const lambda_functor<T>& t) { return t; }
template <class T> struct constant_ref_type {
typedef
lambda_functor<identity<const T&> > type;
};
// as_lambda_functor turns any types to lambda functors
// non-lambda_functors will be bound argument types
template <class T>
struct as_lambda_functor {
typedef typename
detail::remove_reference_and_cv<T>::type plain_T;
typedef typename
detail::IF<is_lambda_functor<plain_T>::value,
plain_T,
lambda_functor<
identity<typename bound_argument_conversion<T>::type>
>
>::RET type;
};
// turns arbitrary objects into lambda functors
template <class T>
inline
lambda_functor<identity<typename bound_argument_conversion<const T>::type> >
to_lambda_functor(const T& t) {
return identity<typename bound_argument_conversion<const T>::type>(t);
}
template <class T>
inline lambda_functor<T>
to_lambda_functor(const lambda_functor<T>& t) {
return t;
}
namespace detail {
// In a call constify_rvals<T>::go(x)
// x should be of type T. If T is a non-reference type, do
// returns x as const reference.
// Otherwise the type doesn't change.
// The purpose of this class is to avoid
// 'cannot bind temporaries to non-const references' errors.
template <class T> struct constify_rvals {
template<class U>
static inline const U& go(const U& u) { return u; }
};
template <class T> struct constify_rvals<T&> {
template<class U>
static inline U& go(U& u) { return u; }
};
// check whether one of the elements of a tuple (cons list) is of type
// null_type. Needed, because the compiler goes ahead and instantiates
// sig template for nullary case even if the nullary operator() is not
// called
template <class T> struct is_null_type
{ BOOST_STATIC_CONSTANT(bool, value = false); };
template <> struct is_null_type<null_type>
{ BOOST_STATIC_CONSTANT(bool, value = true); };
template<class Tuple> struct has_null_type {
BOOST_STATIC_CONSTANT(bool, value = (is_null_type<typename Tuple::head_type>::value || has_null_type<typename Tuple::tail_type>::value));
};
template<> struct has_null_type<null_type> {
BOOST_STATIC_CONSTANT(bool, value = false);
};
// helpers -------------------
template<class Args, class SigArgs>
class deduce_argument_types_ {
typedef typename as_lambda_functor<typename Args::head_type>::type lf_t;
typedef typename lf_t::inherited::template sig<SigArgs>::type el_t;
public:
typedef
boost::tuples::cons<
el_t,
typename deduce_argument_types_<typename Args::tail_type, SigArgs>::type
> type;
};
template<class SigArgs>
class deduce_argument_types_<null_type, SigArgs> {
public:
typedef null_type type;
};
// // note that tuples cannot have plain function types as elements.
// // Hence, all other types will be non-const, except references to
// // functions.
// template <class T> struct remove_reference_except_from_functions {
// typedef typename boost::remove_reference<T>::type t;
// typedef typename detail::IF<boost::is_function<t>::value, T, t>::RET type;
// };
template<class Args, class SigArgs>
class deduce_non_ref_argument_types_ {
typedef typename as_lambda_functor<typename Args::head_type>::type lf_t;
typedef typename lf_t::inherited::template sig<SigArgs>::type el_t;
public:
typedef
boost::tuples::cons<
// typename detail::remove_reference_except_from_functions<el_t>::type,
typename boost::remove_reference<el_t>::type,
typename deduce_non_ref_argument_types_<typename Args::tail_type, SigArgs>::type
> type;
};
template<class SigArgs>
class deduce_non_ref_argument_types_<null_type, SigArgs> {
public:
typedef null_type type;
};
// -------------
// take stored Args and Open Args, and return a const list with
// deduced elements (real return types)
template<class Args, class SigArgs>
class deduce_argument_types {
typedef typename deduce_argument_types_<Args, SigArgs>::type t1;
public:
typedef typename detail::IF<
has_null_type<t1>::value, null_type, t1
>::RET type;
};
// take stored Args and Open Args, and return a const list with
// deduced elements (references are stripped from the element types)
template<class Args, class SigArgs>
class deduce_non_ref_argument_types {
typedef typename deduce_non_ref_argument_types_<Args, SigArgs>::type t1;
public:
typedef typename detail::IF<
has_null_type<t1>::value, null_type, t1
>::RET type;
};
template <int N, class Args, class SigArgs>
struct nth_return_type_sig {
typedef typename
as_lambda_functor<
typename boost::tuples::element<N, Args>::type
// typename tuple_element_as_reference<N, Args>::type
>::type lf_type;
typedef typename lf_type::inherited::template sig<SigArgs>::type type;
};
template<int N, class Tuple> struct element_or_null {
typedef typename boost::tuples::element<N, Tuple>::type type;
};
template<int N> struct element_or_null<N, null_type> {
typedef null_type type;
};
} // end detail
// -- lambda_functor base ---------------------
// the explicit_return_type_action case -----------------------------------
template<class RET, class Args>
class lambda_functor_base<explicit_return_type_action<RET>, Args>
{
public:
Args args;
explicit lambda_functor_base(const Args& a) : args(a) {}
template <class SigArgs> struct sig { typedef RET type; };
template<class RET_, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const
{
return detail::constify_rvals<RET>::go(
detail::r_select<RET>::go(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS));
}
};
// the protect_action case -----------------------------------
template<class Args>
class lambda_functor_base<protect_action, Args>
{
public:
Args args;
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const
{
CALL_USE_ARGS;
return boost::tuples::get<0>(args);
}
template<class SigArgs> struct sig {
// typedef typename detail::tuple_element_as_reference<0, SigArgs>::type type;
typedef typename boost::tuples::element<0, Args>::type type;
};
};
// Do nothing --------------------------------------------------------
class do_nothing_action {};
template<class Args>
class lambda_functor_base<do_nothing_action, Args> {
// Args args;
public:
// explicit lambda_functor_base(const Args& a) {}
lambda_functor_base() {}
template<class RET, CALL_TEMPLATE_ARGS> RET call(CALL_FORMAL_ARGS) const {
return CALL_USE_ARGS;
}
template<class SigArgs> struct sig { typedef void type; };
};
// These specializations provide a shorter notation to define actions.
// These lambda_functor_base instances take care of the recursive evaluation
// of the arguments and pass the evaluated arguments to the apply function
// of an action class. To make action X work with these classes, one must
// instantiate the lambda_functor_base as:
// lambda_functor_base<action<ARITY, X>, Args>
// Where ARITY is the arity of the apply function in X
// The return type is queried as:
// return_type_N<X, EvaluatedArgumentTypes>::type
// for which there must be a specialization.
// Function actions, casts, throws,... all go via these classes.
template<class Act, class Args>
class lambda_functor_base<action<0, Act>, Args>
{
public:
// Args args; not needed
explicit lambda_functor_base(const Args& a) {}
template<class SigArgs> struct sig {
typedef typename return_type_N<Act, null_type>::type type;
};
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
CALL_USE_ARGS;
return Act::template apply<RET>();
}
};
#if defined BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART
#error "Multiple defines of BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART"
#endif
#define BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(ARITY) \
template<class Act, class Args> \
class lambda_functor_base<action<ARITY, Act>, Args> \
{ \
public: \
Args args; \
\
explicit lambda_functor_base(const Args& a) : args(a) {} \
\
template<class SigArgs> struct sig { \
typedef typename \
detail::deduce_non_ref_argument_types<Args, SigArgs>::type rets_t; \
public: \
typedef typename \
return_type_N_prot<Act, rets_t>::type type; \
}; \
\
\
template<class RET, CALL_TEMPLATE_ARGS> \
RET call(CALL_FORMAL_ARGS) const { \
using boost::tuples::get; \
using detail::constify_rvals; \
using detail::r_select; \
using detail::element_or_null; \
using detail::deduce_argument_types;
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(1)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(2)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(3)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
typedef typename element_or_null<2, rets_t>::type rt2;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(4)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
typedef typename element_or_null<2, rets_t>::type rt2;
typedef typename element_or_null<3, rets_t>::type rt3;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(5)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
typedef typename element_or_null<2, rets_t>::type rt2;
typedef typename element_or_null<3, rets_t>::type rt3;
typedef typename element_or_null<4, rets_t>::type rt4;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(6)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
typedef typename element_or_null<2, rets_t>::type rt2;
typedef typename element_or_null<3, rets_t>::type rt3;
typedef typename element_or_null<4, rets_t>::type rt4;
typedef typename element_or_null<5, rets_t>::type rt5;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(7)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
typedef typename element_or_null<2, rets_t>::type rt2;
typedef typename element_or_null<3, rets_t>::type rt3;
typedef typename element_or_null<4, rets_t>::type rt4;
typedef typename element_or_null<5, rets_t>::type rt5;
typedef typename element_or_null<6, rets_t>::type rt6;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(8)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
typedef typename element_or_null<2, rets_t>::type rt2;
typedef typename element_or_null<3, rets_t>::type rt3;
typedef typename element_or_null<4, rets_t>::type rt4;
typedef typename element_or_null<5, rets_t>::type rt5;
typedef typename element_or_null<6, rets_t>::type rt6;
typedef typename element_or_null<7, rets_t>::type rt7;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(9)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
typedef typename element_or_null<2, rets_t>::type rt2;
typedef typename element_or_null<3, rets_t>::type rt3;
typedef typename element_or_null<4, rets_t>::type rt4;
typedef typename element_or_null<5, rets_t>::type rt5;
typedef typename element_or_null<6, rets_t>::type rt6;
typedef typename element_or_null<7, rets_t>::type rt7;
typedef typename element_or_null<8, rets_t>::type rt8;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt8>::go(r_select<rt8>::go(get<8>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(10)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
typedef typename element_or_null<2, rets_t>::type rt2;
typedef typename element_or_null<3, rets_t>::type rt3;
typedef typename element_or_null<4, rets_t>::type rt4;
typedef typename element_or_null<5, rets_t>::type rt5;
typedef typename element_or_null<6, rets_t>::type rt6;
typedef typename element_or_null<7, rets_t>::type rt7;
typedef typename element_or_null<8, rets_t>::type rt8;
typedef typename element_or_null<9, rets_t>::type rt9;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt8>::go(r_select<rt8>::go(get<8>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt9>::go(r_select<rt9>::go(get<9>(args), CALL_ACTUAL_ARGS))
);
}
};
#undef BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART
} // namespace lambda
} // namespace boost
#endif

View File

@@ -0,0 +1,275 @@
// Boost Lambda Library - lambda_functors.hpp -------------------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see http://www.boost.org
// ------------------------------------------------
#ifndef BOOST_LAMBDA_LAMBDA_FUNCTORS_HPP
#define BOOST_LAMBDA_LAMBDA_FUNCTORS_HPP
namespace boost {
namespace lambda {
// -- lambda_functor --------------------------------------------
// --------------------------------------------------------------
//inline const null_type const_null_type() { return null_type(); }
namespace detail {
namespace {
static const null_type constant_null_type = null_type();
} // unnamed
} // detail
class unused {};
#define cnull_type() detail::constant_null_type
// -- free variables types --------------------------------------------------
// helper to work around the case where the nullary return type deduction
// is always performed, even though the functor is not nullary
namespace detail {
template<int N, class Tuple> struct get_element_or_null_type {
typedef typename
detail::tuple_element_as_reference<N, Tuple>::type type;
};
template<int N> struct get_element_or_null_type<N, null_type> {
typedef null_type type;
};
}
template <int I> struct placeholder;
template<> struct placeholder<FIRST> {
template<class SigArgs> struct sig {
typedef typename detail::get_element_or_null_type<0, SigArgs>::type type;
};
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
BOOST_STATIC_ASSERT(boost::is_reference<RET>::value);
CALL_USE_ARGS; // does nothing, prevents warnings for unused args
return a;
}
};
template<> struct placeholder<SECOND> {
template<class SigArgs> struct sig {
typedef typename detail::get_element_or_null_type<1, SigArgs>::type type;
};
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return b; }
};
template<> struct placeholder<THIRD> {
template<class SigArgs> struct sig {
typedef typename detail::get_element_or_null_type<2, SigArgs>::type type;
};
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return c; }
};
template<> struct placeholder<EXCEPTION> {
template<class SigArgs> struct sig {
typedef typename detail::get_element_or_null_type<3, SigArgs>::type type;
};
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return env; }
};
typedef const lambda_functor<placeholder<FIRST> > placeholder1_type;
typedef const lambda_functor<placeholder<SECOND> > placeholder2_type;
typedef const lambda_functor<placeholder<THIRD> > placeholder3_type;
///////////////////////////////////////////////////////////////////////////////
// free variables are lambda_functors. This is to allow uniform handling with
// other lambda_functors.
// -------------------------------------------------------------------
// -- lambda_functor NONE ------------------------------------------------
template <class T>
class lambda_functor : public T
{
BOOST_STATIC_CONSTANT(int, arity_bits = get_arity<T>::value);
public:
typedef T inherited;
lambda_functor() {}
lambda_functor(const lambda_functor& l) : inherited(l) {}
lambda_functor(const T& t) : inherited(t) {}
template <class SigArgs> struct sig {
typedef typename inherited::template
sig<typename SigArgs::tail_type>::type type;
};
// Note that this return type deduction template is instantiated, even
// if the nullary
// operator() is not called at all. One must make sure that it does not fail.
typedef typename
inherited::template sig<null_type>::type
nullary_return_type;
nullary_return_type operator()() const {
return inherited::template
call<nullary_return_type>
(cnull_type(), cnull_type(), cnull_type(), cnull_type());
}
template<class A>
typename inherited::template sig<tuple<A&> >::type
operator()(A& a) const {
return inherited::template call<
typename inherited::template sig<tuple<A&> >::type
>(a, cnull_type(), cnull_type(), cnull_type());
}
template<class A>
typename inherited::template sig<tuple<A const&> >::type
operator()(A const& a) const {
return inherited::template call<
typename inherited::template sig<tuple<A const&> >::type
>(a, cnull_type(), cnull_type(), cnull_type());
}
template<class A, class B>
typename inherited::template sig<tuple<A&, B&> >::type
operator()(A& a, B& b) const {
return inherited::template call<
typename inherited::template sig<tuple<A&, B&> >::type
>(a, b, cnull_type(), cnull_type());
}
template<class A, class B>
typename inherited::template sig<tuple<A const&, B&> >::type
operator()(A const& a, B& b) const {
return inherited::template call<
typename inherited::template sig<tuple<A const&, B&> >::type
>(a, b, cnull_type(), cnull_type());
}
template<class A, class B>
typename inherited::template sig<tuple<A&, B const&> >::type
operator()(A& a, B const& b) const {
return inherited::template call<
typename inherited::template sig<tuple<A&, B const&> >::type
>(a, b, cnull_type(), cnull_type());
}
template<class A, class B>
typename inherited::template sig<tuple<A const&, B const&> >::type
operator()(A const& a, B const& b) const {
return inherited::template call<
typename inherited::template sig<tuple<A const&, B const&> >::type
>(a, b, cnull_type(), cnull_type());
}
template<class A, class B, class C>
typename inherited::template sig<tuple<A&, B&, C&> >::type
operator()(A& a, B& b, C& c) const
{
return inherited::template call<
typename inherited::template sig<tuple<A&, B&, C&> >::type
>(a, b, c, cnull_type());
}
template<class A, class B, class C>
typename inherited::template sig<tuple<A const&, B const&, C const&> >::type
operator()(A const& a, B const& b, C const& c) const
{
return inherited::template call<
typename inherited::template sig<tuple<A const&, B const&, C const&> >::type
>(a, b, c, cnull_type());
}
// for internal calls with env
template<CALL_TEMPLATE_ARGS>
typename inherited::template sig<tuple<CALL_REFERENCE_TYPES> >::type
internal_call(CALL_FORMAL_ARGS) const {
return inherited::template
call<typename inherited::template
sig<tuple<CALL_REFERENCE_TYPES> >::type>(CALL_ACTUAL_ARGS);
}
template<class A>
const lambda_functor<lambda_functor_base<
other_action<assignment_action>,
boost::tuple<lambda_functor,
typename const_copy_argument <const A>::type> > >
operator=(const A& a) const {
return lambda_functor_base<
other_action<assignment_action>,
boost::tuple<lambda_functor,
typename const_copy_argument <const A>::type> >
( boost::tuple<lambda_functor,
typename const_copy_argument <const A>::type>(*this, a) );
}
template<class A>
const lambda_functor<lambda_functor_base<
other_action<subscript_action>,
boost::tuple<lambda_functor,
typename const_copy_argument <const A>::type> > >
operator[](const A& a) const {
return lambda_functor_base<
other_action<subscript_action>,
boost::tuple<lambda_functor,
typename const_copy_argument <const A>::type> >
( boost::tuple<lambda_functor,
typename const_copy_argument <const A>::type>(*this, a ) );
}
};
} // namespace lambda
} // namespace boost
// is_placeholder
#include <boost/is_placeholder.hpp>
namespace boost
{
template<> struct is_placeholder< lambda::lambda_functor< lambda::placeholder<lambda::FIRST> > >
{
enum _vt { value = 1 };
};
template<> struct is_placeholder< lambda::lambda_functor< lambda::placeholder<lambda::SECOND> > >
{
enum _vt { value = 2 };
};
template<> struct is_placeholder< lambda::lambda_functor< lambda::placeholder<lambda::THIRD> > >
{
enum _vt { value = 3 };
};
} // namespace boost
#endif

View File

@@ -0,0 +1,74 @@
// lambda_fwd.hpp - Boost Lambda Library -------------------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// -------------------------------------------------------
#ifndef BOOST_LAMBDA_FWD_HPP
#define BOOST_LAMBDA_FWD_HPP
namespace boost {
namespace lambda {
namespace detail {
template<class T> struct generate_error;
}
// -- placeholders --------------------------------------------
template <int I> struct placeholder;
// function_adaptors
template <class Func>
struct function_adaptor;
template <int I, class Act> class action;
template <class Base>
class lambda_functor;
template <class Act, class Args>
class lambda_functor_base;
} // namespace lambda
} // namespace boost
// #define CALL_TEMPLATE_ARGS class A, class Env
// #define CALL_FORMAL_ARGS A& a, Env& env
// #define CALL_ACTUAL_ARGS a, env
// #define CALL_ACTUAL_ARGS_NO_ENV a
// #define CALL_REFERENCE_TYPES A&, Env&
// #define CALL_PLAIN_TYPES A, Env
#define CALL_TEMPLATE_ARGS class A, class B, class C, class Env
#define CALL_FORMAL_ARGS A& a, B& b, C& c, Env& env
#define CALL_ACTUAL_ARGS a, b, c, env
#define CALL_ACTUAL_ARGS_NO_ENV a, b, c
#define CALL_REFERENCE_TYPES A&, B&, C&, Env&
#define CALL_PLAIN_TYPES A, B, C, Env
namespace boost {
namespace lambda {
namespace detail {
template<class A1, class A2, class A3, class A4>
void do_nothing(A1&, A2&, A3&, A4&) {}
} // detail
} // lambda
} // boost
// prevent the warnings from unused arguments
#define CALL_USE_ARGS \
::boost::lambda::detail::do_nothing(a, b, c, env)
#endif

View File

@@ -0,0 +1,527 @@
// - lambda_traits.hpp --- Boost Lambda Library ----------------------------
//
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// -------------------------------------------------------------------------
#ifndef BOOST_LAMBDA_LAMBDA_TRAITS_HPP
#define BOOST_LAMBDA_LAMBDA_TRAITS_HPP
#include "boost/type_traits/transform_traits.hpp"
#include "boost/type_traits/cv_traits.hpp"
#include "boost/type_traits/function_traits.hpp"
#include "boost/type_traits/object_traits.hpp"
namespace boost {
namespace lambda {
// -- if construct ------------------------------------------------
// Proposed by Krzysztof Czarnecki and Ulrich Eisenecker
namespace detail {
template <bool If, class Then, class Else> struct IF { typedef Then RET; };
template <class Then, class Else> struct IF<false, Then, Else> {
typedef Else RET;
};
// An if construct that doesn't instantiate the non-matching template:
// Called as:
// IF_type<condition, A, B>::type
// The matching template must define the typeded 'type'
// I.e. A::type if condition is true, B::type if condition is false
// Idea from Vesa Karvonen (from C&E as well I guess)
template<class T>
struct IF_type_
{
typedef typename T::type type;
};
template<bool C, class T, class E>
struct IF_type
{
typedef typename
IF_type_<typename IF<C, T, E>::RET >::type type;
};
// helper that can be used to give typedef T to some type
template <class T> struct identity_mapping { typedef T type; };
// An if construct for finding an integral constant 'value'
// Does not instantiate the non-matching branch
// Called as IF_value<condition, A, B>::value
// If condition is true A::value must be defined, otherwise B::value
template<class T>
struct IF_value_
{
BOOST_STATIC_CONSTANT(int, value = T::value);
};
template<bool C, class T, class E>
struct IF_value
{
BOOST_STATIC_CONSTANT(int, value = (IF_value_<typename IF<C, T, E>::RET>::value));
};
// --------------------------------------------------------------
// removes reference from other than function types:
template<class T> class remove_reference_if_valid
{
typedef typename boost::remove_reference<T>::type plainT;
public:
typedef typename IF<
boost::is_function<plainT>::value,
T,
plainT
>::RET type;
};
template<class T> struct remove_reference_and_cv {
typedef typename boost::remove_cv<
typename boost::remove_reference<T>::type
>::type type;
};
// returns a reference to the element of tuple T
template<int N, class T> struct tuple_element_as_reference {
typedef typename
boost::tuples::access_traits<
typename boost::tuples::element<N, T>::type
>::non_const_type type;
};
// returns the cv and reverence stripped type of a tuple element
template<int N, class T> struct tuple_element_stripped {
typedef typename
remove_reference_and_cv<
typename boost::tuples::element<N, T>::type
>::type type;
};
// is_lambda_functor -------------------------------------------------
template <class T> struct is_lambda_functor_ {
BOOST_STATIC_CONSTANT(bool, value = false);
};
template <class Arg> struct is_lambda_functor_<lambda_functor<Arg> > {
BOOST_STATIC_CONSTANT(bool, value = true);
};
} // end detail
template <class T> struct is_lambda_functor {
BOOST_STATIC_CONSTANT(bool,
value =
detail::is_lambda_functor_<
typename detail::remove_reference_and_cv<T>::type
>::value);
};
namespace detail {
// -- parameter_traits_ ---------------------------------------------
// An internal parameter type traits class that respects
// the reference_wrapper class.
// The conversions performed are:
// references -> compile_time_error
// T1 -> T2,
// reference_wrapper<T> -> T&
// const array -> ref to const array
// array -> ref to array
// function -> ref to function
// ------------------------------------------------------------------------
template<class T1, class T2>
struct parameter_traits_ {
typedef T2 type;
};
// Do not instantiate with reference types
template<class T, class Any> struct parameter_traits_<T&, Any> {
typedef typename
generate_error<T&>::
parameter_traits_class_instantiated_with_reference_type type;
};
// Arrays can't be stored as plain types; convert them to references
template<class T, int n, class Any> struct parameter_traits_<T[n], Any> {
typedef T (&type)[n];
};
template<class T, int n, class Any>
struct parameter_traits_<const T[n], Any> {
typedef const T (&type)[n];
};
template<class T, int n, class Any>
struct parameter_traits_<volatile T[n], Any> {
typedef volatile T (&type)[n];
};
template<class T, int n, class Any>
struct parameter_traits_<const volatile T[n], Any> {
typedef const volatile T (&type)[n];
};
template<class T, class Any>
struct parameter_traits_<boost::reference_wrapper<T>, Any >{
typedef T& type;
};
template<class T, class Any>
struct parameter_traits_<const boost::reference_wrapper<T>, Any >{
typedef T& type;
};
template<class T, class Any>
struct parameter_traits_<volatile boost::reference_wrapper<T>, Any >{
typedef T& type;
};
template<class T, class Any>
struct parameter_traits_<const volatile boost::reference_wrapper<T>, Any >{
typedef T& type;
};
template<class Any>
struct parameter_traits_<void, Any> {
typedef void type;
};
template<class Arg, class Any>
struct parameter_traits_<lambda_functor<Arg>, Any > {
typedef lambda_functor<Arg> type;
};
template<class Arg, class Any>
struct parameter_traits_<const lambda_functor<Arg>, Any > {
typedef lambda_functor<Arg> type;
};
// Are the volatile versions needed?
template<class Arg, class Any>
struct parameter_traits_<volatile lambda_functor<Arg>, Any > {
typedef lambda_functor<Arg> type;
};
template<class Arg, class Any>
struct parameter_traits_<const volatile lambda_functor<Arg>, Any > {
typedef lambda_functor<Arg> type;
};
} // end namespace detail
// ------------------------------------------------------------------------
// traits classes for lambda expressions (bind functions, operators ...)
// must be instantiated with non-reference types
// The default is const plain type -------------------------
// const T -> const T,
// T -> const T,
// references -> compile_time_error
// reference_wrapper<T> -> T&
// array -> const ref array
template<class T>
struct const_copy_argument {
typedef typename
detail::parameter_traits_<
T,
typename detail::IF<boost::is_function<T>::value, T&, const T>::RET
>::type type;
};
// T may be a function type. Without the IF test, const would be added
// to a function type, which is illegal.
// all arrays are converted to const.
// This traits template is used for 'const T&' parameter passing
// and thus the knowledge of the potential
// non-constness of an actual argument is lost.
template<class T, int n> struct const_copy_argument <T[n]> {
typedef const T (&type)[n];
};
template<class T, int n> struct const_copy_argument <volatile T[n]> {
typedef const volatile T (&type)[n];
};
template<class T>
struct const_copy_argument<T&> {};
// do not instantiate with references
// typedef typename detail::generate_error<T&>::references_not_allowed type;
template<>
struct const_copy_argument<void> {
typedef void type;
};
// Does the same as const_copy_argument, but passes references through as such
template<class T>
struct bound_argument_conversion {
typedef typename const_copy_argument<T>::type type;
};
template<class T>
struct bound_argument_conversion<T&> {
typedef T& type;
};
// The default is non-const reference -------------------------
// const T -> const T&,
// T -> T&,
// references -> compile_time_error
// reference_wrapper<T> -> T&
template<class T>
struct reference_argument {
typedef typename detail::parameter_traits_<T, T&>::type type;
};
template<class T>
struct reference_argument<T&> {
typedef typename detail::generate_error<T&>::references_not_allowed type;
};
template<class Arg>
struct reference_argument<lambda_functor<Arg> > {
typedef lambda_functor<Arg> type;
};
template<class Arg>
struct reference_argument<const lambda_functor<Arg> > {
typedef lambda_functor<Arg> type;
};
// Are the volatile versions needed?
template<class Arg>
struct reference_argument<volatile lambda_functor<Arg> > {
typedef lambda_functor<Arg> type;
};
template<class Arg>
struct reference_argument<const volatile lambda_functor<Arg> > {
typedef lambda_functor<Arg> type;
};
template<>
struct reference_argument<void> {
typedef void type;
};
namespace detail {
// Array to pointer conversion
template <class T>
struct array_to_pointer {
typedef T type;
};
template <class T, int N>
struct array_to_pointer <const T[N]> {
typedef const T* type;
};
template <class T, int N>
struct array_to_pointer <T[N]> {
typedef T* type;
};
template <class T, int N>
struct array_to_pointer <const T (&) [N]> {
typedef const T* type;
};
template <class T, int N>
struct array_to_pointer <T (&) [N]> {
typedef T* type;
};
// ---------------------------------------------------------------------------
// The call_traits for bind
// Respects the reference_wrapper class.
// These templates are used outside of bind functions as well.
// the bind_tuple_mapper provides a shorter notation for default
// bound argument storing semantics, if all arguments are treated
// uniformly.
// from template<class T> foo(const T& t) : bind_traits<const T>::type
// from template<class T> foo(T& t) : bind_traits<T>::type
// Conversions:
// T -> const T,
// cv T -> cv T,
// T& -> T&
// reference_wrapper<T> -> T&
// const reference_wrapper<T> -> T&
// array -> const ref array
// make bound arguments const, this is a deliberate design choice, the
// purpose is to prevent side effects to bound arguments that are stored
// as copies
template<class T>
struct bind_traits {
typedef const T type;
};
template<class T>
struct bind_traits<T&> {
typedef T& type;
};
// null_types are an exception, we always want to store them as non const
// so that other templates can assume that null_type is always without const
template<>
struct bind_traits<null_type> {
typedef null_type type;
};
// the bind_tuple_mapper, bind_type_generators may
// introduce const to null_type
template<>
struct bind_traits<const null_type> {
typedef null_type type;
};
// Arrays can't be stored as plain types; convert them to references.
// All arrays are converted to const. This is because bind takes its
// parameters as const T& and thus the knowledge of the potential
// non-constness of actual argument is lost.
template<class T, int n> struct bind_traits <T[n]> {
typedef const T (&type)[n];
};
template<class T, int n>
struct bind_traits<const T[n]> {
typedef const T (&type)[n];
};
template<class T, int n> struct bind_traits<volatile T[n]> {
typedef const volatile T (&type)[n];
};
template<class T, int n>
struct bind_traits<const volatile T[n]> {
typedef const volatile T (&type)[n];
};
template<class T>
struct bind_traits<reference_wrapper<T> >{
typedef T& type;
};
template<class T>
struct bind_traits<const reference_wrapper<T> >{
typedef T& type;
};
template<>
struct bind_traits<void> {
typedef void type;
};
template <
class T0 = null_type, class T1 = null_type, class T2 = null_type,
class T3 = null_type, class T4 = null_type, class T5 = null_type,
class T6 = null_type, class T7 = null_type, class T8 = null_type,
class T9 = null_type
>
struct bind_tuple_mapper {
typedef
tuple<typename bind_traits<T0>::type,
typename bind_traits<T1>::type,
typename bind_traits<T2>::type,
typename bind_traits<T3>::type,
typename bind_traits<T4>::type,
typename bind_traits<T5>::type,
typename bind_traits<T6>::type,
typename bind_traits<T7>::type,
typename bind_traits<T8>::type,
typename bind_traits<T9>::type> type;
};
// bind_traits, except map const T& -> const T
// this is needed e.g. in currying. Const reference arguments can
// refer to temporaries, so it is not safe to store them as references.
template <class T> struct remove_const_reference {
typedef typename bind_traits<T>::type type;
};
template <class T> struct remove_const_reference<const T&> {
typedef const T type;
};
// maps the bind argument types to the resulting lambda functor type
template <
class T0 = null_type, class T1 = null_type, class T2 = null_type,
class T3 = null_type, class T4 = null_type, class T5 = null_type,
class T6 = null_type, class T7 = null_type, class T8 = null_type,
class T9 = null_type
>
class bind_type_generator {
typedef typename
detail::bind_tuple_mapper<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9
>::type args_t;
BOOST_STATIC_CONSTANT(int, nof_elems = boost::tuples::length<args_t>::value);
typedef
action<
nof_elems,
function_action<nof_elems>
> action_type;
public:
typedef
lambda_functor<
lambda_functor_base<
action_type,
args_t
>
> type;
};
} // detail
template <class T> inline const T& make_const(const T& t) { return t; }
} // end of namespace lambda
} // end of namespace boost
#endif // BOOST_LAMBDA_TRAITS_HPP

View File

@@ -0,0 +1,737 @@
// Boost Lambda Library -- member_ptr.hpp ---------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000 Gary Powell (gary.powell@sierra.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// --------------------------------------------------------------------------
#if !defined(BOOST_LAMBDA_MEMBER_PTR_HPP)
#define BOOST_LAMBDA_MEMBER_PTR_HPP
namespace boost {
namespace lambda {
class member_pointer_action {};
namespace detail {
// the boost type_traits member_pointer traits are not enough,
// need to know more details.
template<class T>
struct member_pointer {
typedef typename boost::add_reference<T>::type type;
typedef detail::unspecified class_type;
typedef detail::unspecified qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = false);
};
template<class T, class U>
struct member_pointer<T U::*> {
typedef typename boost::add_reference<T>::type type;
typedef U class_type;
typedef U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = true);
BOOST_STATIC_CONSTANT(bool, is_function_member = false);
};
template<class T, class U>
struct member_pointer<const T U::*> {
typedef typename boost::add_reference<const T>::type type;
typedef U class_type;
typedef const U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = true);
BOOST_STATIC_CONSTANT(bool, is_function_member = false);
};
template<class T, class U>
struct member_pointer<volatile T U::*> {
typedef typename boost::add_reference<volatile T>::type type;
typedef U class_type;
typedef volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = true);
BOOST_STATIC_CONSTANT(bool, is_function_member = false);
};
template<class T, class U>
struct member_pointer<const volatile T U::*> {
typedef typename boost::add_reference<const volatile T>::type type;
typedef U class_type;
typedef const volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = true);
BOOST_STATIC_CONSTANT(bool, is_function_member = false);
};
// -- nonconst member functions --
template<class T, class U>
struct member_pointer<T (U::*)()> {
typedef T type;
typedef U class_type;
typedef U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1>
struct member_pointer<T (U::*)(A1)> {
typedef T type;
typedef U class_type;
typedef U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2>
struct member_pointer<T (U::*)(A1, A2)> {
typedef T type;
typedef U class_type;
typedef U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3>
struct member_pointer<T (U::*)(A1, A2, A3)> {
typedef T type;
typedef U class_type;
typedef U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4>
struct member_pointer<T (U::*)(A1, A2, A3, A4)> {
typedef T type;
typedef U class_type;
typedef U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5)> {
typedef T type;
typedef U class_type;
typedef U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5,
class A6>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6)> {
typedef T type;
typedef U class_type;
typedef U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5,
class A6, class A7>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7)> {
typedef T type;
typedef U class_type;
typedef U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5,
class A6, class A7, class A8>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8)> {
typedef T type;
typedef U class_type;
typedef U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5,
class A6, class A7, class A8, class A9>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
typedef T type;
typedef U class_type;
typedef U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
// -- const member functions --
template<class T, class U>
struct member_pointer<T (U::*)() const> {
typedef T type;
typedef U class_type;
typedef const U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1>
struct member_pointer<T (U::*)(A1) const> {
typedef T type;
typedef U class_type;
typedef const U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2>
struct member_pointer<T (U::*)(A1, A2) const> {
typedef T type;
typedef U class_type;
typedef const U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3>
struct member_pointer<T (U::*)(A1, A2, A3) const> {
typedef T type;
typedef U class_type;
typedef const U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4>
struct member_pointer<T (U::*)(A1, A2, A3, A4) const> {
typedef T type;
typedef U class_type;
typedef const U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5) const> {
typedef T type;
typedef U class_type;
typedef const U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5,
class A6>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6) const> {
typedef T type;
typedef U class_type;
typedef const U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5,
class A6, class A7>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7) const> {
typedef T type;
typedef U class_type;
typedef const U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5,
class A6, class A7, class A8>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8) const> {
typedef T type;
typedef U class_type;
typedef const U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5,
class A6, class A7, class A8, class A9>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8, A9) const> {
typedef T type;
typedef U class_type;
typedef const U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
// -- volatile --
template<class T, class U>
struct member_pointer<T (U::*)() volatile> {
typedef T type;
typedef U class_type;
typedef volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1>
struct member_pointer<T (U::*)(A1) volatile> {
typedef T type;
typedef U class_type;
typedef volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2>
struct member_pointer<T (U::*)(A1, A2) volatile> {
typedef T type;
typedef U class_type;
typedef volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3>
struct member_pointer<T (U::*)(A1, A2, A3) volatile> {
typedef T type;
typedef U class_type;
typedef volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4>
struct member_pointer<T (U::*)(A1, A2, A3, A4) volatile> {
typedef T type;
typedef U class_type;
typedef volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5) volatile> {
typedef T type;
typedef U class_type;
typedef volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5,
class A6>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6) volatile> {
typedef T type;
typedef U class_type;
typedef volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5,
class A6, class A7>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7) volatile> {
typedef T type;
typedef U class_type;
typedef volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5,
class A6, class A7, class A8>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8) volatile> {
typedef T type;
typedef U class_type;
typedef volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5,
class A6, class A7, class A8, class A9>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8, A9) volatile> {
typedef T type;
typedef U class_type;
typedef volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
// -- const volatile
template<class T, class U>
struct member_pointer<T (U::*)() const volatile> {
typedef T type;
typedef U class_type;
typedef const volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1>
struct member_pointer<T (U::*)(A1) const volatile> {
typedef T type;
typedef U class_type;
typedef const volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2>
struct member_pointer<T (U::*)(A1, A2) const volatile> {
typedef T type;
typedef U class_type;
typedef const volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3>
struct member_pointer<T (U::*)(A1, A2, A3) const volatile> {
typedef T type;
typedef U class_type;
typedef const volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4>
struct member_pointer<T (U::*)(A1, A2, A3, A4) const volatile> {
typedef T type;
typedef U class_type;
typedef const volatile U qualified_class_type;
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5) const volatile> {
typedef T type;
typedef U class_type;
typedef const volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5,
class A6>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6) const volatile> {
typedef T type;
typedef U class_type;
typedef const volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5,
class A6, class A7>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7) const volatile> {
typedef T type;
typedef U class_type;
typedef const volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5,
class A6, class A7, class A8>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8) const volatile> {
typedef T type;
typedef U class_type;
typedef const volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
template<class T, class U, class A1, class A2, class A3, class A4, class A5,
class A6, class A7, class A8, class A9>
struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8, A9) const volatile> {
typedef T type;
typedef U class_type;
typedef const volatile U qualified_class_type;
BOOST_STATIC_CONSTANT(bool, is_data_member = false);
BOOST_STATIC_CONSTANT(bool, is_function_member = true);
};
} // detail
namespace detail {
// this class holds a pointer to a member function and the object.
// when called, it just calls the member function with the parameters
// provided
// It would have been possible to use existing lambda_functors to represent
// a bound member function like this, but to have a separate template is
// safer, since now this functor doesn't mix and match with lambda_functors
// only thing you can do with this is to call it
// note that previously instantiated classes
// (other_action<member_pointer_action> and member_pointer_action_helper
// guarantee, that A and B are
// such types, that for objects a and b of corresponding types, a->*b leads
// to the builtin ->* to be called. So types that would end in a call to
// a user defined ->* do not create a member_pointer_caller object.
template<class RET, class A, class B>
class member_pointer_caller {
A a; B b;
public:
member_pointer_caller(const A& aa, const B& bb) : a(aa), b(bb) {}
RET operator()() const { return (a->*b)(); }
template<class A1>
RET operator()(const A1& a1) const { return (a->*b)(a1); }
template<class A1, class A2>
RET operator()(const A1& a1, const A2& a2) const { return (a->*b)(a1, a2); }
template<class A1, class A2, class A3>
RET operator()(const A1& a1, const A2& a2, const A3& a3) const {
return (a->*b)(a1, a2, a3);
}
template<class A1, class A2, class A3, class A4>
RET operator()(const A1& a1, const A2& a2, const A3& a3,
const A4& a4) const {
return (a->*b)(a1, a2, a3, a4);
}
template<class A1, class A2, class A3, class A4, class A5>
RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
const A5& a5) const {
return (a->*b)(a1, a2, a3, a4, a5);
}
template<class A1, class A2, class A3, class A4, class A5, class A6>
RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
const A5& a5, const A6& a6) const {
return (a->*b)(a1, a2, a3, a4, a5, a6);
}
template<class A1, class A2, class A3, class A4, class A5, class A6,
class A7>
RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
const A5& a5, const A6& a6, const A7& a7) const {
return (a->*b)(a1, a2, a3, a4, a5, a6, a7);
}
template<class A1, class A2, class A3, class A4, class A5, class A6,
class A7, class A8>
RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
const A5& a5, const A6& a6, const A7& a7,
const A8& a8) const {
return (a->*b)(a1, a2, a3, a4, a5, a6, a7, a8);
}
template<class A1, class A2, class A3, class A4, class A5, class A6,
class A7, class A8, class A9>
RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
const A5& a5, const A6& a6, const A7& a7,
const A8& a8, const A9& a9) const {
return (a->*b)(a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
};
// helper templates for return type deduction and action classes
// different cases for data member, function member, neither
// true-true case
template <bool Is_data_member, bool Is_function_member>
struct member_pointer_action_helper;
// cannot be both, no body provided
// data member case
// this means, that B is a data member and A is a pointer type,
// so either built-in ->* should be called, or there is an error
template <>
struct member_pointer_action_helper<true, false> {
public:
template<class RET, class A, class B>
static RET apply(A& a, B& b) {
return a->*b;
}
template<class A, class B>
struct return_type {
private:
typedef typename detail::remove_reference_and_cv<B>::type plainB;
typedef typename detail::member_pointer<plainB>::type type0;
// we remove the reference now, as we may have to add cv:s
typedef typename boost::remove_reference<type0>::type type1;
// A is a reference to pointer
// remove the top level cv qualifiers and reference
typedef typename
detail::remove_reference_and_cv<A>::type non_ref_A;
// A is a pointer type, so take the type pointed to
typedef typename ::boost::remove_pointer<non_ref_A>::type non_pointer_A;
public:
// For non-reference types, we must add const and/or volatile if
// the pointer type has these qualifiers
// If the member is a reference, these do not have any effect
// (cv T == T if T is a reference type)
typedef typename detail::IF<
::boost::is_const<non_pointer_A>::value,
typename ::boost::add_const<type1>::type,
type1
>::RET type2;
typedef typename detail::IF<
::boost::is_volatile<non_pointer_A>::value,
typename ::boost::add_volatile<type2>::type,
type2
>::RET type3;
// add reference back
typedef typename ::boost::add_reference<type3>::type type;
};
};
// neither case
template <>
struct member_pointer_action_helper<false, false> {
public:
template<class RET, class A, class B>
static RET apply(A& a, B& b) {
// not a built in member pointer operator, just call ->*
return a->*b;
}
// an overloaded member pointer operators, user should have specified
// the return type
// At this point we know that there is no matching specialization for
// return_type_2, so try return_type_2_plain
template<class A, class B>
struct return_type {
typedef typename plain_return_type_2<
other_action<member_pointer_action>, A, B
>::type type;
};
};
// member pointer function case
// This is a built in ->* call for a member function,
// the only thing that you can do with that, is to give it some arguments
// note, it is guaranteed that A is a pointer type, and thus it cannot
// be a call to overloaded ->*
template <>
struct member_pointer_action_helper<false, true> {
public:
template<class RET, class A, class B>
static RET apply(A& a, B& b) {
typedef typename ::boost::remove_cv<B>::type plainB;
typedef typename detail::member_pointer<plainB>::type ret_t;
typedef typename ::boost::remove_cv<A>::type plainA;
// we always strip cv:s to
// make the two routes (calling and type deduction)
// to give the same results (and the const does not make any functional
// difference)
return detail::member_pointer_caller<ret_t, plainA, plainB>(a, b);
}
template<class A, class B>
struct return_type {
typedef typename detail::remove_reference_and_cv<B>::type plainB;
typedef typename detail::member_pointer<plainB>::type ret_t;
typedef typename detail::remove_reference_and_cv<A>::type plainA;
typedef detail::member_pointer_caller<ret_t, plainA, plainB> type;
};
};
} // detail
template<> class other_action<member_pointer_action> {
public:
template<class RET, class A, class B>
static RET apply(A& a, B& b) {
typedef typename
::boost::remove_cv<B>::type plainB;
return detail::member_pointer_action_helper<
boost::is_pointer<A>::value &&
detail::member_pointer<plainB>::is_data_member,
boost::is_pointer<A>::value &&
detail::member_pointer<plainB>::is_function_member
>::template apply<RET>(a, b);
}
};
// return type deduction --
// If the right argument is a pointer to data member,
// and the left argument is of compatible pointer to class type
// return type is a reference to the data member type
// if right argument is a pointer to a member function, and the left
// argument is of a compatible type, the return type is a
// member_pointer_caller (see above)
// Otherwise, return type deduction fails. There is either an error,
// or the user is trying to call an overloaded ->*
// In such a case either ret<> must be used, or a return_type_2 user
// defined specialization must be provided
template<class A, class B>
struct return_type_2<other_action<member_pointer_action>, A, B> {
private:
typedef typename
detail::remove_reference_and_cv<B>::type plainB;
public:
typedef typename
detail::member_pointer_action_helper<
detail::member_pointer<plainB>::is_data_member,
detail::member_pointer<plainB>::is_function_member
>::template return_type<A, B>::type type;
};
// this is the way the generic lambda_functor_base functions instantiate
// return type deduction. We turn it into return_type_2, so that the
// user can provide specializations on that level.
template<class Args>
struct return_type_N<other_action<member_pointer_action>, Args> {
typedef typename boost::tuples::element<0, Args>::type A;
typedef typename boost::tuples::element<1, Args>::type B;
typedef typename
return_type_2<other_action<member_pointer_action>,
typename boost::remove_reference<A>::type,
typename boost::remove_reference<B>::type
>::type type;
};
template<class Arg1, class Arg2>
inline const
lambda_functor<
lambda_functor_base<
action<2, other_action<member_pointer_action> >,
tuple<lambda_functor<Arg1>, typename const_copy_argument<Arg2>::type>
>
>
operator->*(const lambda_functor<Arg1>& a1, const Arg2& a2)
{
return
lambda_functor_base<
action<2, other_action<member_pointer_action> >,
tuple<lambda_functor<Arg1>, typename const_copy_argument<Arg2>::type>
>
(tuple<lambda_functor<Arg1>,
typename const_copy_argument<Arg2>::type>(a1, a2));
}
template<class Arg1, class Arg2>
inline const
lambda_functor<
lambda_functor_base<
action<2, other_action<member_pointer_action> >,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
>
>
operator->*(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2)
{
return
lambda_functor_base<
action<2, other_action<member_pointer_action> >,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
>
(tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >(a1, a2));
}
template<class Arg1, class Arg2>
inline const
lambda_functor<
lambda_functor_base<
action<2, other_action<member_pointer_action> >,
tuple<typename const_copy_argument<Arg1>::type, lambda_functor<Arg2> >
>
>
operator->*(const Arg1& a1, const lambda_functor<Arg2>& a2)
{
return
lambda_functor_base<
action<2, other_action<member_pointer_action> >,
tuple<typename const_copy_argument<Arg1>::type, lambda_functor<Arg2> >
>
(tuple<typename const_copy_argument<Arg1>::type,
lambda_functor<Arg2> >(a1, a2));
}
} // namespace lambda
} // namespace boost
#endif

View File

@@ -0,0 +1,139 @@
// -- operator_actions.hpp - Boost Lambda Library ----------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
// For more information, see http://lambda.cs.utu.fi
#ifndef BOOST_LAMBDA_OPERATOR_ACTIONS_HPP
#define BOOST_LAMBDA_OPERATOR_ACTIONS_HPP
namespace boost {
namespace lambda {
// -- artihmetic ----------------------
class plus_action {};
class minus_action {};
class multiply_action {};
class divide_action {};
class remainder_action {};
// -- bitwise -------------------
class leftshift_action {};
class rightshift_action {};
class xor_action {};
// -- bitwise/logical -------------------
class and_action {};
class or_action {};
class not_action {};
// -- relational -------------------------
class less_action {};
class greater_action {};
class lessorequal_action {};
class greaterorequal_action {};
class equal_action {};
class notequal_action {};
// -- increment/decrement ------------------------------
class increment_action {};
class decrement_action {};
// -- void return ------------------------------
// -- other ------------------------------
class addressof_action {};
// class comma_action {}; // defined in actions.hpp
class contentsof_action {};
// class member_pointer_action {}; (defined in member_ptr.hpp)
// -- actioun group templates --------------------
template <class Action> class arithmetic_action;
template <class Action> class bitwise_action;
template <class Action> class logical_action;
template <class Action> class relational_action;
template <class Action> class arithmetic_assignment_action;
template <class Action> class bitwise_assignment_action;
template <class Action> class unary_arithmetic_action;
template <class Action> class pre_increment_decrement_action;
template <class Action> class post_increment_decrement_action;
// ---------------------------------------------------------
// actions, for which the existence of protect is checked in return type
// deduction.
template <class Act> struct is_protectable<arithmetic_action<Act> > {
BOOST_STATIC_CONSTANT(bool, value = true);
};
template <class Act> struct is_protectable<bitwise_action<Act> > {
BOOST_STATIC_CONSTANT(bool, value = true);
};
template <class Act> struct is_protectable<logical_action<Act> > {
BOOST_STATIC_CONSTANT(bool, value = true);
};
template <class Act> struct is_protectable<relational_action<Act> > {
BOOST_STATIC_CONSTANT(bool, value = true);
};
template <class Act>
struct is_protectable<arithmetic_assignment_action<Act> > {
BOOST_STATIC_CONSTANT(bool, value = true);
};
template <class Act> struct is_protectable<bitwise_assignment_action<Act> > {
BOOST_STATIC_CONSTANT(bool, value = true);
};
template <class Act> struct is_protectable<unary_arithmetic_action<Act> > {
BOOST_STATIC_CONSTANT(bool, value = true);
};
template <class Act>
struct is_protectable<pre_increment_decrement_action<Act> > {
BOOST_STATIC_CONSTANT(bool, value = true);
};
template <class Act> struct
is_protectable<post_increment_decrement_action<Act> > {
BOOST_STATIC_CONSTANT(bool, value = true);
};
template <> struct is_protectable<other_action<addressof_action> > {
BOOST_STATIC_CONSTANT(bool, value = true);
};
template <> struct is_protectable<other_action<contentsof_action> > {
BOOST_STATIC_CONSTANT(bool, value = true);
};
template<> struct is_protectable<other_action<subscript_action> > {
BOOST_STATIC_CONSTANT(bool, value = true);
};
template<> struct is_protectable<other_action<assignment_action> > {
BOOST_STATIC_CONSTANT(bool, value = true);
};
// NOTE: comma action is also protectable, but the specialization is
// in actions.hpp
} // namespace lambda
} // namespace boost
#endif

View File

@@ -0,0 +1,271 @@
// Boost Lambda Library - operator_lambda_func_base.hpp -----------------
//
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// ------------------------------------------------------------
#ifndef BOOST_LAMBDA_OPERATOR_LAMBDA_FUNC_BASE_HPP
#define BOOST_LAMBDA_OPERATOR_LAMBDA_FUNC_BASE_HPP
namespace boost {
namespace lambda {
// These operators cannot be implemented as apply functions of action
// templates
// Specialization for comma.
template<class Args>
class lambda_functor_base<other_action<comma_action>, Args> {
public:
Args args;
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
return detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS),
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
}
template<class SigArgs> struct sig {
private:
typedef typename
detail::deduce_argument_types<Args, SigArgs>::type rets_t;
public:
typedef typename return_type_2_comma< // comma needs special handling
typename detail::element_or_null<0, rets_t>::type,
typename detail::element_or_null<1, rets_t>::type
>::type type;
};
};
namespace detail {
// helper traits to make the expression shorter, takes binary action
// bound argument tuple, open argument tuple and gives the return type
template<class Action, class Bound, class Open> class binary_rt {
private:
typedef typename
detail::deduce_argument_types<Bound, Open>::type rets_t;
public:
typedef typename return_type_2_prot<
Action,
typename detail::element_or_null<0, rets_t>::type,
typename detail::element_or_null<1, rets_t>::type
>::type type;
};
// same for unary actions
template<class Action, class Bound, class Open> class unary_rt {
private:
typedef typename
detail::deduce_argument_types<Bound, Open>::type rets_t;
public:
typedef typename return_type_1_prot<
Action,
typename detail::element_or_null<0, rets_t>::type
>::type type;
};
} // end detail
// Specialization for logical and (to preserve shortcircuiting)
// this could be done with a macro as the others, code used to be different
template<class Args>
class lambda_functor_base<logical_action<and_action>, Args> {
public:
Args args;
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
return detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) &&
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
}
template<class SigArgs> struct sig {
typedef typename
detail::binary_rt<logical_action<and_action>, Args, SigArgs>::type type;
};
};
// Specialization for logical or (to preserve shortcircuiting)
// this could be done with a macro as the others, code used to be different
template<class Args>
class lambda_functor_base<logical_action< or_action>, Args> {
public:
Args args;
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
return detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) ||
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
}
template<class SigArgs> struct sig {
typedef typename
detail::binary_rt<logical_action<or_action>, Args, SigArgs>::type type;
};
};
// Specialization for subscript
template<class Args>
class lambda_functor_base<other_action<subscript_action>, Args> {
public:
Args args;
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
return detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS)
[detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS)];
}
template<class SigArgs> struct sig {
typedef typename
detail::binary_rt<other_action<subscript_action>, Args, SigArgs>::type
type;
};
};
#define BOOST_LAMBDA_BINARY_ACTION(SYMBOL, ACTION_CLASS) \
template<class Args> \
class lambda_functor_base<ACTION_CLASS, Args> { \
public: \
Args args; \
public: \
explicit lambda_functor_base(const Args& a) : args(a) {} \
\
template<class RET, CALL_TEMPLATE_ARGS> \
RET call(CALL_FORMAL_ARGS) const { \
return detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) \
SYMBOL \
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS); \
} \
template<class SigArgs> struct sig { \
typedef typename \
detail::binary_rt<ACTION_CLASS, Args, SigArgs>::type type; \
}; \
};
#define BOOST_LAMBDA_PREFIX_UNARY_ACTION(SYMBOL, ACTION_CLASS) \
template<class Args> \
class lambda_functor_base<ACTION_CLASS, Args> { \
public: \
Args args; \
public: \
explicit lambda_functor_base(const Args& a) : args(a) {} \
\
template<class RET, CALL_TEMPLATE_ARGS> \
RET call(CALL_FORMAL_ARGS) const { \
return SYMBOL \
detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS); \
} \
template<class SigArgs> struct sig { \
typedef typename \
detail::unary_rt<ACTION_CLASS, Args, SigArgs>::type type; \
}; \
};
#define BOOST_LAMBDA_POSTFIX_UNARY_ACTION(SYMBOL, ACTION_CLASS) \
template<class Args> \
class lambda_functor_base<ACTION_CLASS, Args> { \
public: \
Args args; \
public: \
explicit lambda_functor_base(const Args& a) : args(a) {} \
\
template<class RET, CALL_TEMPLATE_ARGS> \
RET call(CALL_FORMAL_ARGS) const { \
return \
detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) SYMBOL; \
} \
template<class SigArgs> struct sig { \
typedef typename \
detail::unary_rt<ACTION_CLASS, Args, SigArgs>::type type; \
}; \
};
BOOST_LAMBDA_BINARY_ACTION(+,arithmetic_action<plus_action>)
BOOST_LAMBDA_BINARY_ACTION(-,arithmetic_action<minus_action>)
BOOST_LAMBDA_BINARY_ACTION(*,arithmetic_action<multiply_action>)
BOOST_LAMBDA_BINARY_ACTION(/,arithmetic_action<divide_action>)
BOOST_LAMBDA_BINARY_ACTION(%,arithmetic_action<remainder_action>)
BOOST_LAMBDA_BINARY_ACTION(<<,bitwise_action<leftshift_action>)
BOOST_LAMBDA_BINARY_ACTION(>>,bitwise_action<rightshift_action>)
BOOST_LAMBDA_BINARY_ACTION(&,bitwise_action<and_action>)
BOOST_LAMBDA_BINARY_ACTION(|,bitwise_action<or_action>)
BOOST_LAMBDA_BINARY_ACTION(^,bitwise_action<xor_action>)
BOOST_LAMBDA_BINARY_ACTION(<,relational_action<less_action>)
BOOST_LAMBDA_BINARY_ACTION(>,relational_action<greater_action>)
BOOST_LAMBDA_BINARY_ACTION(<=,relational_action<lessorequal_action>)
BOOST_LAMBDA_BINARY_ACTION(>=,relational_action<greaterorequal_action>)
BOOST_LAMBDA_BINARY_ACTION(==,relational_action<equal_action>)
BOOST_LAMBDA_BINARY_ACTION(!=,relational_action<notequal_action>)
BOOST_LAMBDA_BINARY_ACTION(+=,arithmetic_assignment_action<plus_action>)
BOOST_LAMBDA_BINARY_ACTION(-=,arithmetic_assignment_action<minus_action>)
BOOST_LAMBDA_BINARY_ACTION(*=,arithmetic_assignment_action<multiply_action>)
BOOST_LAMBDA_BINARY_ACTION(/=,arithmetic_assignment_action<divide_action>)
BOOST_LAMBDA_BINARY_ACTION(%=,arithmetic_assignment_action<remainder_action>)
BOOST_LAMBDA_BINARY_ACTION(<<=,bitwise_assignment_action<leftshift_action>)
BOOST_LAMBDA_BINARY_ACTION(>>=,bitwise_assignment_action<rightshift_action>)
BOOST_LAMBDA_BINARY_ACTION(&=,bitwise_assignment_action<and_action>)
BOOST_LAMBDA_BINARY_ACTION(|=,bitwise_assignment_action<or_action>)
BOOST_LAMBDA_BINARY_ACTION(^=,bitwise_assignment_action<xor_action>)
BOOST_LAMBDA_BINARY_ACTION(=,other_action< assignment_action>)
BOOST_LAMBDA_PREFIX_UNARY_ACTION(+, unary_arithmetic_action<plus_action>)
BOOST_LAMBDA_PREFIX_UNARY_ACTION(-, unary_arithmetic_action<minus_action>)
BOOST_LAMBDA_PREFIX_UNARY_ACTION(~, bitwise_action<not_action>)
BOOST_LAMBDA_PREFIX_UNARY_ACTION(!, logical_action<not_action>)
BOOST_LAMBDA_PREFIX_UNARY_ACTION(++, pre_increment_decrement_action<increment_action>)
BOOST_LAMBDA_PREFIX_UNARY_ACTION(--, pre_increment_decrement_action<decrement_action>)
BOOST_LAMBDA_PREFIX_UNARY_ACTION(&,other_action<addressof_action>)
BOOST_LAMBDA_PREFIX_UNARY_ACTION(*,other_action<contentsof_action>)
BOOST_LAMBDA_POSTFIX_UNARY_ACTION(++, post_increment_decrement_action<increment_action>)
BOOST_LAMBDA_POSTFIX_UNARY_ACTION(--, post_increment_decrement_action<decrement_action>)
#undef BOOST_LAMBDA_POSTFIX_UNARY_ACTION
#undef BOOST_LAMBDA_PREFIX_UNARY_ACTION
#undef BOOST_LAMBDA_BINARY_ACTION
} // namespace lambda
} // namespace boost
#endif

View File

@@ -0,0 +1,942 @@
// operator_return_type_traits.hpp -- Boost Lambda Library ------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see www.boost.org
#ifndef BOOST_LAMBDA_OPERATOR_RETURN_TYPE_TRAITS_HPP
#define BOOST_LAMBDA_OPERATOR_RETURN_TYPE_TRAITS_HPP
#include "boost/lambda/detail/is_instance_of.hpp"
#include "boost/type_traits/same_traits.hpp"
#include "boost/indirect_reference.hpp"
#include <cstddef> // needed for the ptrdiff_t
#include <iosfwd> // for istream and ostream
#include <iterator> // needed for operator&
namespace boost {
namespace lambda {
namespace detail {
// -- general helper templates for type deduction ------------------
// Much of the type deduction code for standard arithmetic types from Gary Powell
template <class A> struct promote_code { static const int value = -1; };
// this means that a code is not defined for A
// -- the next 5 types are needed in if_then_else_return
// the promotion order is not important, but they must have distinct values.
template <> struct promote_code<bool> { static const int value = 10; };
template <> struct promote_code<char> { static const int value = 20; };
template <> struct promote_code<unsigned char> { static const int value = 30; };
template <> struct promote_code<signed char> { static const int value = 40; };
template <> struct promote_code<short int> { static const int value = 50; };
// ----------
template <> struct promote_code<int> { static const int value = 100; };
template <> struct promote_code<unsigned int> { static const int value = 200; };
template <> struct promote_code<long> { static const int value = 300; };
template <> struct promote_code<unsigned long> { static const int value = 400; };
template <> struct promote_code<float> { static const int value = 500; };
template <> struct promote_code<double> { static const int value = 600; };
template <> struct promote_code<long double> { static const int value = 700; };
// TODO: wchar_t
// forward delcaration of complex.
} // namespace detail
} // namespace lambda
} // namespace boost
namespace std {
template<class T> class complex;
}
namespace boost {
namespace lambda {
namespace detail {
template <> struct promote_code< std::complex<float> > { static const int value = 800; };
template <> struct promote_code< std::complex<double> > { static const int value = 900; };
template <> struct promote_code< std::complex<long double> > { static const int value = 1000; };
// -- int promotion -------------------------------------------
template <class T> struct promote_to_int { typedef T type; };
template <> struct promote_to_int<bool> { typedef int type; };
template <> struct promote_to_int<char> { typedef int type; };
template <> struct promote_to_int<unsigned char> { typedef int type; };
template <> struct promote_to_int<signed char> { typedef int type; };
template <> struct promote_to_int<short int> { typedef int type; };
// The unsigned short int promotion rule is this:
// unsigned short int to signed int if a signed int can hold all values
// of unsigned short int, otherwise go to unsigned int.
template <> struct promote_to_int<unsigned short int>
{
typedef
detail::IF<sizeof(int) <= sizeof(unsigned short int),
// I had the logic reversed but ">" messes up the parsing.
unsigned int,
int>::RET type;
};
// TODO: think, should there be default behaviour for non-standard types?
} // namespace detail
// ------------------------------------------
// Unary actions ----------------------------
// ------------------------------------------
template<class Act, class A>
struct plain_return_type_1 {
typedef detail::unspecified type;
};
template<class Act, class A>
struct plain_return_type_1<unary_arithmetic_action<Act>, A> {
typedef A type;
};
template<class Act, class A>
struct return_type_1<unary_arithmetic_action<Act>, A> {
typedef
typename plain_return_type_1<
unary_arithmetic_action<Act>,
typename detail::remove_reference_and_cv<A>::type
>::type type;
};
template<class A>
struct plain_return_type_1<bitwise_action<not_action>, A> {
typedef A type;
};
// bitwise not, operator~()
template<class A> struct return_type_1<bitwise_action<not_action>, A> {
typedef
typename plain_return_type_1<
bitwise_action<not_action>,
typename detail::remove_reference_and_cv<A>::type
>::type type;
};
// prefix increment and decrement operators return
// their argument by default as a non-const reference
template<class Act, class A>
struct plain_return_type_1<pre_increment_decrement_action<Act>, A> {
typedef A& type;
};
template<class Act, class A>
struct return_type_1<pre_increment_decrement_action<Act>, A> {
typedef
typename plain_return_type_1<
pre_increment_decrement_action<Act>,
typename detail::remove_reference_and_cv<A>::type
>::type type;
};
// post decrement just returns the same plain type.
template<class Act, class A>
struct plain_return_type_1<post_increment_decrement_action<Act>, A> {
typedef A type;
};
template<class Act, class A>
struct return_type_1<post_increment_decrement_action<Act>, A>
{
typedef
typename plain_return_type_1<
post_increment_decrement_action<Act>,
typename detail::remove_reference_and_cv<A>::type
>::type type;
};
// logical not, operator!()
template<class A>
struct plain_return_type_1<logical_action<not_action>, A> {
typedef bool type;
};
template<class A>
struct return_type_1<logical_action<not_action>, A> {
typedef
typename plain_return_type_1<
logical_action<not_action>,
typename detail::remove_reference_and_cv<A>::type
>::type type;
};
// address of action ---------------------------------------
template<class A>
struct return_type_1<other_action<addressof_action>, A> {
typedef
typename plain_return_type_1<
other_action<addressof_action>,
typename detail::remove_reference_and_cv<A>::type
>::type type1;
// If no user defined specialization for A, then return the
// cv qualified pointer to A
typedef typename detail::IF<
boost::is_same<type1, detail::unspecified>::value,
typename boost::remove_reference<A>::type*,
type1
>::RET type;
};
// contentsof action ------------------------------------
// TODO: this deduction may lead to fail directly,
// (if A has no specialization for iterator_traits and has no
// typedef A::reference.
// There is no easy way around this, cause there doesn't seem to be a way
// to test whether a class is an iterator or not.
// The default works with std::iterators.
namespace detail {
// A is a nonreference type
template <class A> struct contentsof_type {
typedef typename boost::indirect_reference<A>::type type;
};
// this is since the nullary () in lambda_functor is always instantiated
template <> struct contentsof_type<null_type> {
typedef detail::unspecified type;
};
template <class A> struct contentsof_type<const A> {
typedef typename contentsof_type<A>::type type1;
// return a reference to the underlying const type
// the IF is because the A::reference in the primary template could
// be some class type rather than a real reference, hence
// we do not want to make it a reference here either
typedef typename detail::IF<
is_reference<type1>::value,
const typename boost::remove_reference<type1>::type &,
const type1
>::RET type;
};
template <class A> struct contentsof_type<volatile A> {
typedef typename contentsof_type<A>::type type1;
typedef typename detail::IF<
is_reference<type1>::value,
volatile typename boost::remove_reference<type1>::type &,
volatile type1
>::RET type;
};
template <class A> struct contentsof_type<const volatile A> {
typedef typename contentsof_type<A>::type type1;
typedef typename detail::IF<
is_reference<type1>::value,
const volatile typename boost::remove_reference<type1>::type &,
const volatile type1
>::RET type;
};
// standard iterator traits should take care of the pointer types
// but just to be on the safe side, we have the specializations here:
// these work even if A is cv-qualified.
template <class A> struct contentsof_type<A*> {
typedef A& type;
};
template <class A> struct contentsof_type<A* const> {
typedef A& type;
};
template <class A> struct contentsof_type<A* volatile> {
typedef A& type;
};
template <class A> struct contentsof_type<A* const volatile> {
typedef A& type;
};
template<class A, int N> struct contentsof_type<A[N]> {
typedef A& type;
};
template<class A, int N> struct contentsof_type<const A[N]> {
typedef const A& type;
};
template<class A, int N> struct contentsof_type<volatile A[N]> {
typedef volatile A& type;
};
template<class A, int N> struct contentsof_type<const volatile A[N]> {
typedef const volatile A& type;
};
} // end detail
template<class A>
struct return_type_1<other_action<contentsof_action>, A> {
typedef
typename plain_return_type_1<
other_action<contentsof_action>,
typename detail::remove_reference_and_cv<A>::type
>::type type1;
// If no user defined specialization for A, then return the
// cv qualified pointer to A
typedef typename
detail::IF_type<
boost::is_same<type1, detail::unspecified>::value,
detail::contentsof_type<
typename boost::remove_reference<A>::type
>,
detail::identity_mapping<type1>
>::type type;
};
// ------------------------------------------------------------------
// binary actions ---------------------------------------------------
// ------------------------------------------------------------------
// here the default case is: no user defined versions:
template <class Act, class A, class B>
struct plain_return_type_2 {
typedef detail::unspecified type;
};
namespace detail {
// error classes
class illegal_pointer_arithmetic{};
// pointer arithmetic type deductions ----------------------
// value = false means that this is not a pointer arithmetic case
// value = true means, that this can be a pointer arithmetic case, but not necessarily is
// This means, that for user defined operators for pointer types, say for some operator+(X, *Y),
// the deductions must be coded at an earliel level (return_type_2).
template<class Act, class A, class B>
struct pointer_arithmetic_traits { static const bool value = false; };
template<class A, class B>
struct pointer_arithmetic_traits<plus_action, A, B> {
typedef typename
array_to_pointer<typename boost::remove_reference<A>::type>::type AP;
typedef typename
array_to_pointer<typename boost::remove_reference<B>::type>::type BP;
static const bool is_pointer_A = boost::is_pointer<AP>::value;
static const bool is_pointer_B = boost::is_pointer<BP>::value;
static const bool value = is_pointer_A || is_pointer_B;
// can't add two pointers.
// note, that we do not check wether the other type is valid for
// addition with a pointer.
// the compiler will catch it in the apply function
typedef typename
detail::IF<
is_pointer_A && is_pointer_B,
detail::return_type_deduction_failure<
detail::illegal_pointer_arithmetic
>,
typename detail::IF<is_pointer_A, AP, BP>::RET
>::RET type;
};
template<class A, class B>
struct pointer_arithmetic_traits<minus_action, A, B> {
typedef typename
array_to_pointer<typename boost::remove_reference<A>::type>::type AP;
typedef typename
array_to_pointer<typename boost::remove_reference<B>::type>::type BP;
static const bool is_pointer_A = boost::is_pointer<AP>::value;
static const bool is_pointer_B = boost::is_pointer<BP>::value;
static const bool value = is_pointer_A || is_pointer_B;
static const bool same_pointer_type =
is_pointer_A && is_pointer_B &&
boost::is_same<
typename boost::remove_const<
typename boost::remove_pointer<
typename boost::remove_const<AP>::type
>::type
>::type,
typename boost::remove_const<
typename boost::remove_pointer<
typename boost::remove_const<BP>::type
>::type
>::type
>::value;
// ptr - ptr has type ptrdiff_t
// note, that we do not check if, in ptr - B, B is
// valid for subtraction with a pointer.
// the compiler will catch it in the apply function
typedef typename
detail::IF<
same_pointer_type, const std::ptrdiff_t,
typename detail::IF<
is_pointer_A,
AP,
detail::return_type_deduction_failure<detail::illegal_pointer_arithmetic>
>::RET
>::RET type;
};
} // namespace detail
// -- arithmetic actions ---------------------------------------------
namespace detail {
template<bool is_pointer_arithmetic, class Act, class A, class B>
struct return_type_2_arithmetic_phase_1;
template<class A, class B> struct return_type_2_arithmetic_phase_2;
template<class A, class B> struct return_type_2_arithmetic_phase_3;
} // namespace detail
// drop any qualifiers from the argument types within arithmetic_action
template<class A, class B, class Act>
struct return_type_2<arithmetic_action<Act>, A, B>
{
typedef typename detail::remove_reference_and_cv<A>::type plain_A;
typedef typename detail::remove_reference_and_cv<B>::type plain_B;
typedef typename
plain_return_type_2<arithmetic_action<Act>, plain_A, plain_B>::type type1;
// if user defined return type, do not enter the whole arithmetic deductions
typedef typename
detail::IF_type<
boost::is_same<type1, detail::unspecified>::value,
detail::return_type_2_arithmetic_phase_1<
detail::pointer_arithmetic_traits<Act, A, B>::value, Act, A, B
>,
plain_return_type_2<arithmetic_action<Act>, plain_A, plain_B>
>::type type;
};
namespace detail {
// perform integral promotion, no pointer arithmetic
template<bool is_pointer_arithmetic, class Act, class A, class B>
struct return_type_2_arithmetic_phase_1
{
typedef typename
return_type_2_arithmetic_phase_2<
typename remove_reference_and_cv<A>::type,
typename remove_reference_and_cv<B>::type
>::type type;
};
// pointer_arithmetic
template<class Act, class A, class B>
struct return_type_2_arithmetic_phase_1<true, Act, A, B>
{
typedef typename
pointer_arithmetic_traits<Act, A, B>::type type;
};
template<class A, class B>
struct return_type_2_arithmetic_phase_2 {
typedef typename
return_type_2_arithmetic_phase_3<
typename promote_to_int<A>::type,
typename promote_to_int<B>::type
>::type type;
};
// specialization for unsigned int.
// We only have to do these two specialization because the value promotion will
// take care of the other cases.
// The unsigned int promotion rule is this:
// unsigned int to long if a long can hold all values of unsigned int,
// otherwise go to unsigned long.
// struct so I don't have to type this twice.
struct promotion_of_unsigned_int
{
typedef
detail::IF<sizeof(long) <= sizeof(unsigned int),
unsigned long,
long>::RET type;
};
template<>
struct return_type_2_arithmetic_phase_2<unsigned int, long>
{
typedef promotion_of_unsigned_int::type type;
};
template<>
struct return_type_2_arithmetic_phase_2<long, unsigned int>
{
typedef promotion_of_unsigned_int::type type;
};
template<class A, class B> struct return_type_2_arithmetic_phase_3 {
enum { promote_code_A_value = promote_code<A>::value,
promote_code_B_value = promote_code<B>::value }; // enums for KCC
typedef typename
detail::IF<
promote_code_A_value == -1 || promote_code_B_value == -1,
detail::return_type_deduction_failure<return_type_2_arithmetic_phase_3>,
typename detail::IF<
((int)promote_code_A_value > (int)promote_code_B_value),
A,
B
>::RET
>::RET type;
};
} // namespace detail
// -- bitwise actions -------------------------------------------
// note: for integral types deuduction is similar to arithmetic actions.
// drop any qualifiers from the argument types within arithmetic action
template<class A, class B, class Act>
struct return_type_2<bitwise_action<Act>, A, B>
{
typedef typename detail::remove_reference_and_cv<A>::type plain_A;
typedef typename detail::remove_reference_and_cv<B>::type plain_B;
typedef typename
plain_return_type_2<bitwise_action<Act>, plain_A, plain_B>::type type1;
// if user defined return type, do not enter type deductions
typedef typename
detail::IF_type<
boost::is_same<type1, detail::unspecified>::value,
return_type_2<arithmetic_action<plus_action>, A, B>,
plain_return_type_2<bitwise_action<Act>, plain_A, plain_B>
>::type type;
// plus_action is just a random pick, has to be a concrete instance
// TODO: This check is only valid for built-in types, overloaded types might
// accept floating point operators
// bitwise operators not defined for floating point types
// these test are not strictly needed here, since the error will be caught in
// the apply function
BOOST_STATIC_ASSERT(!(boost::is_float<plain_A>::value && boost::is_float<plain_B>::value));
};
namespace detail {
#ifdef BOOST_NO_TEMPLATED_STREAMS
template<class A, class B>
struct leftshift_type {
typedef typename detail::IF<
boost::is_convertible<
typename boost::remove_reference<A>::type*,
std::ostream*
>::value,
std::ostream&,
typename detail::remove_reference_and_cv<A>::type
>::RET type;
};
template<class A, class B>
struct rightshift_type {
typedef typename detail::IF<
boost::is_convertible<
typename boost::remove_reference<A>::type*,
std::istream*
>::value,
std::istream&,
typename detail::remove_reference_and_cv<A>::type
>::RET type;
};
#else
template <class T> struct get_ostream_type {
typedef std::basic_ostream<typename T::char_type,
typename T::traits_type>& type;
};
template <class T> struct get_istream_type {
typedef std::basic_istream<typename T::char_type,
typename T::traits_type>& type;
};
template<class A, class B>
struct leftshift_type {
private:
typedef typename boost::remove_reference<A>::type plainA;
public:
typedef typename detail::IF_type<
is_instance_of_2<plainA, std::basic_ostream>::value,
get_ostream_type<plainA>, //reference to the stream
detail::remove_reference_and_cv<A>
>::type type;
};
template<class A, class B>
struct rightshift_type {
private:
typedef typename boost::remove_reference<A>::type plainA;
public:
typedef typename detail::IF_type<
is_instance_of_2<plainA, std::basic_istream>::value,
get_istream_type<plainA>, //reference to the stream
detail::remove_reference_and_cv<A>
>::type type;
};
#endif
} // end detail
// ostream
template<class A, class B>
struct return_type_2<bitwise_action<leftshift_action>, A, B>
{
typedef typename detail::remove_reference_and_cv<A>::type plain_A;
typedef typename detail::remove_reference_and_cv<B>::type plain_B;
typedef typename
plain_return_type_2<bitwise_action<leftshift_action>, plain_A, plain_B>::type type1;
// if user defined return type, do not enter type deductions
typedef typename
detail::IF_type<
boost::is_same<type1, detail::unspecified>::value,
detail::leftshift_type<A, B>,
plain_return_type_2<bitwise_action<leftshift_action>, plain_A, plain_B>
>::type type;
};
// istream
template<class A, class B>
struct return_type_2<bitwise_action<rightshift_action>, A, B>
{
typedef typename detail::remove_reference_and_cv<A>::type plain_A;
typedef typename detail::remove_reference_and_cv<B>::type plain_B;
typedef typename
plain_return_type_2<bitwise_action<rightshift_action>, plain_A, plain_B>::type type1;
// if user defined return type, do not enter type deductions
typedef typename
detail::IF_type<
boost::is_same<type1, detail::unspecified>::value,
detail::rightshift_type<A, B>,
plain_return_type_2<bitwise_action<rightshift_action>, plain_A, plain_B>
>::type type;
};
// -- logical actions ----------------------------------------
// always bool
// NOTE: this may not be true for some weird user-defined types,
template<class A, class B, class Act>
struct plain_return_type_2<logical_action<Act>, A, B> {
typedef bool type;
};
template<class A, class B, class Act>
struct return_type_2<logical_action<Act>, A, B> {
typedef typename detail::remove_reference_and_cv<A>::type plain_A;
typedef typename detail::remove_reference_and_cv<B>::type plain_B;
typedef typename
plain_return_type_2<logical_action<Act>, plain_A, plain_B>::type type;
};
// -- relational actions ----------------------------------------
// always bool
// NOTE: this may not be true for some weird user-defined types,
template<class A, class B, class Act>
struct plain_return_type_2<relational_action<Act>, A, B> {
typedef bool type;
};
template<class A, class B, class Act>
struct return_type_2<relational_action<Act>, A, B> {
typedef typename detail::remove_reference_and_cv<A>::type plain_A;
typedef typename detail::remove_reference_and_cv<B>::type plain_B;
typedef typename
plain_return_type_2<relational_action<Act>, plain_A, plain_B>::type type;
};
// Assingment actions -----------------------------------------------
// return type is the type of the first argument as reference
// note that cv-qualifiers are preserved.
// Yes, assignment operator can be const!
// NOTE: this may not be true for some weird user-defined types,
template<class A, class B, class Act>
struct return_type_2<arithmetic_assignment_action<Act>, A, B> {
typedef typename detail::remove_reference_and_cv<A>::type plain_A;
typedef typename detail::remove_reference_and_cv<B>::type plain_B;
typedef typename
plain_return_type_2<
arithmetic_assignment_action<Act>, plain_A, plain_B
>::type type1;
typedef typename
detail::IF<
boost::is_same<type1, detail::unspecified>::value,
typename boost::add_reference<A>::type,
type1
>::RET type;
};
template<class A, class B, class Act>
struct return_type_2<bitwise_assignment_action<Act>, A, B> {
typedef typename detail::remove_reference_and_cv<A>::type plain_A;
typedef typename detail::remove_reference_and_cv<B>::type plain_B;
typedef typename
plain_return_type_2<
bitwise_assignment_action<Act>, plain_A, plain_B
>::type type1;
typedef typename
detail::IF<
boost::is_same<type1, detail::unspecified>::value,
typename boost::add_reference<A>::type,
type1
>::RET type;
};
template<class A, class B>
struct return_type_2<other_action<assignment_action>, A, B> {
typedef typename detail::remove_reference_and_cv<A>::type plain_A;
typedef typename detail::remove_reference_and_cv<B>::type plain_B;
typedef typename
plain_return_type_2<
other_action<assignment_action>, plain_A, plain_B
>::type type1;
typedef typename
detail::IF<
boost::is_same<type1, detail::unspecified>::value,
typename boost::add_reference<A>::type,
type1
>::RET type;
};
// -- other actions ----------------------------------------
// comma action ----------------------------------
// Note: this may not be true for some weird user-defined types,
// NOTE! This only tries the plain_return_type_2 layer and gives
// detail::unspecified as default. If no such specialization is found, the
// type rule in the spcecialization of the return_type_2_prot is used
// to give the type of the right argument (which can be a reference too)
// (The built in operator, can return a l- or rvalue).
template<class A, class B>
struct return_type_2<other_action<comma_action>, A, B> {
typedef typename detail::remove_reference_and_cv<A>::type plain_A;
typedef typename detail::remove_reference_and_cv<B>::type plain_B;
typedef typename
plain_return_type_2<
other_action<comma_action>, plain_A, plain_B
>::type type;
};
// subscript action -----------------------------------------------
namespace detail {
// A and B are nonreference types
template <class A, class B> struct subscript_type {
typedef detail::unspecified type;
};
template <class A, class B> struct subscript_type<A*, B> {
typedef A& type;
};
template <class A, class B> struct subscript_type<A* const, B> {
typedef A& type;
};
template <class A, class B> struct subscript_type<A* volatile, B> {
typedef A& type;
};
template <class A, class B> struct subscript_type<A* const volatile, B> {
typedef A& type;
};
template<class A, class B, int N> struct subscript_type<A[N], B> {
typedef A& type;
};
// these 3 specializations are needed to make gcc <3 happy
template<class A, class B, int N> struct subscript_type<const A[N], B> {
typedef const A& type;
};
template<class A, class B, int N> struct subscript_type<volatile A[N], B> {
typedef volatile A& type;
};
template<class A, class B, int N> struct subscript_type<const volatile A[N], B> {
typedef const volatile A& type;
};
} // end detail
template<class A, class B>
struct return_type_2<other_action<subscript_action>, A, B> {
typedef typename detail::remove_reference_and_cv<A>::type plain_A;
typedef typename detail::remove_reference_and_cv<B>::type plain_B;
typedef typename boost::remove_reference<A>::type nonref_A;
typedef typename boost::remove_reference<B>::type nonref_B;
typedef typename
plain_return_type_2<
other_action<subscript_action>, plain_A, plain_B
>::type type1;
typedef typename
detail::IF_type<
boost::is_same<type1, detail::unspecified>::value,
detail::subscript_type<nonref_A, nonref_B>,
plain_return_type_2<other_action<subscript_action>, plain_A, plain_B>
>::type type;
};
} // namespace lambda
} // namespace boost
// Forward declarations are incompatible with the libstdc++ debug mode.
#if BOOST_WORKAROUND(__GNUC__, >= 3) && defined(_GLIBCXX_DEBUG)
#include <string>
#include <vector>
#include <map>
#include <deque>
#else
// The GCC 2.95.x uses a non-conformant deque
#if BOOST_WORKAROUND(__GNUC__, == 2) && __GNUC_MINOR__ <= 96
#include <deque>
#else
namespace std {
template <class T, class Allocator> class deque;
}
#endif
namespace std {
template <class Char, class Traits, class Allocator> class basic_string;
template <class T, class Allocator> class vector;
template <class Key, class T, class Cmp, class Allocator> class map;
template <class Key, class T, class Cmp, class Allocator> class multimap;
}
#endif
namespace boost {
namespace lambda {
template<class Key, class T, class Cmp, class Allocator, class B>
struct plain_return_type_2<other_action<subscript_action>, std::map<Key, T, Cmp, Allocator>, B> {
typedef T& type;
// T == std::map<Key, T, Cmp, Allocator>::mapped_type;
};
template<class Key, class T, class Cmp, class Allocator, class B>
struct plain_return_type_2<other_action<subscript_action>, std::multimap<Key, T, Cmp, Allocator>, B> {
typedef T& type;
// T == std::map<Key, T, Cmp, Allocator>::mapped_type;
};
// deque
template<class T, class Allocator, class B>
struct plain_return_type_2<other_action<subscript_action>, std::deque<T, Allocator>, B> {
typedef typename std::deque<T, Allocator>::reference type;
};
template<class T, class Allocator, class B>
struct plain_return_type_2<other_action<subscript_action>, const std::deque<T, Allocator>, B> {
typedef typename std::deque<T, Allocator>::const_reference type;
};
// vector
template<class T, class Allocator, class B>
struct plain_return_type_2<other_action<subscript_action>, std::vector<T, Allocator>, B> {
typedef typename std::vector<T, Allocator>::reference type;
};
template<class T, class Allocator, class B>
struct plain_return_type_2<other_action<subscript_action>, const std::vector<T, Allocator>, B> {
typedef typename std::vector<T, Allocator>::const_reference type;
};
// basic_string
template<class Char, class Traits, class Allocator, class B>
struct plain_return_type_2<other_action<subscript_action>, std::basic_string<Char, Traits, Allocator>, B> {
typedef typename std::basic_string<Char, Traits, Allocator>::reference type;
};
template<class Char, class Traits, class Allocator, class B>
struct plain_return_type_2<other_action<subscript_action>, const std::basic_string<Char, Traits, Allocator>, B> {
typedef typename std::basic_string<Char, Traits, Allocator>::const_reference type;
};
} // namespace lambda
} // namespace boost
#endif

View File

@@ -0,0 +1,370 @@
// Boost Lambda Library - operators.hpp --------------------------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// ---------------------------------------------------------------
#ifndef BOOST_LAMBDA_OPERATORS_HPP
#define BOOST_LAMBDA_OPERATORS_HPP
#include "boost/lambda/detail/is_instance_of.hpp"
namespace boost {
namespace lambda {
#if defined BOOST_LAMBDA_BE1
#error "Multiple defines of BOOST_LAMBDA_BE1"
#endif
// For all BOOSTA_LAMBDA_BE* macros:
// CONSTA must be either 'A' or 'const A'
// CONSTB must be either 'B' or 'const B'
// It is stupid to have the names A and B as macro arguments, but it avoids
// the need to pass in emtpy macro arguments, which gives warnings on some
// compilers
#define BOOST_LAMBDA_BE1(OPER_NAME, ACTION, CONSTA, CONSTB, CONVERSION) \
template<class Arg, class B> \
inline const \
lambda_functor< \
lambda_functor_base< \
ACTION, \
tuple<lambda_functor<Arg>, typename CONVERSION <CONSTB>::type> \
> \
> \
OPER_NAME (const lambda_functor<Arg>& a, CONSTB& b) { \
return \
lambda_functor_base< \
ACTION, \
tuple<lambda_functor<Arg>, typename CONVERSION <CONSTB>::type> \
> \
(tuple<lambda_functor<Arg>, typename CONVERSION <CONSTB>::type>(a, b)); \
}
#if defined BOOST_LAMBDA_BE2
#error "Multiple defines of BOOST_LAMBDA_BE2"
#endif
#define BOOST_LAMBDA_BE2(OPER_NAME, ACTION, CONSTA, CONSTB, CONVERSION) \
template<class A, class Arg> \
inline const \
lambda_functor< \
lambda_functor_base< \
ACTION, \
tuple<typename CONVERSION <CONSTA>::type, lambda_functor<Arg> > \
> \
> \
OPER_NAME (CONSTA& a, const lambda_functor<Arg>& b) { \
return \
lambda_functor_base< \
ACTION, \
tuple<typename CONVERSION <CONSTA>::type, lambda_functor<Arg> > \
> \
(tuple<typename CONVERSION <CONSTA>::type, lambda_functor<Arg> >(a, b)); \
}
#if defined BOOST_LAMBDA_BE3
#error "Multiple defines of BOOST_LAMBDA_BE3"
#endif
#define BOOST_LAMBDA_BE3(OPER_NAME, ACTION, CONSTA, CONSTB, CONVERSION) \
template<class ArgA, class ArgB> \
inline const \
lambda_functor< \
lambda_functor_base< \
ACTION, \
tuple<lambda_functor<ArgA>, lambda_functor<ArgB> > \
> \
> \
OPER_NAME (const lambda_functor<ArgA>& a, const lambda_functor<ArgB>& b) { \
return \
lambda_functor_base< \
ACTION, \
tuple<lambda_functor<ArgA>, lambda_functor<ArgB> > \
> \
(tuple<lambda_functor<ArgA>, lambda_functor<ArgB> >(a, b)); \
}
#if defined BOOST_LAMBDA_BE
#error "Multiple defines of BOOST_LAMBDA_BE"
#endif
#define BOOST_LAMBDA_BE(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION) \
BOOST_LAMBDA_BE1(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION) \
BOOST_LAMBDA_BE2(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION) \
BOOST_LAMBDA_BE3(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION)
#define BOOST_LAMBDA_EMPTY()
BOOST_LAMBDA_BE(operator+, arithmetic_action<plus_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator-, arithmetic_action<minus_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator*, arithmetic_action<multiply_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator/, arithmetic_action<divide_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator%, arithmetic_action<remainder_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator<<, bitwise_action<leftshift_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator>>, bitwise_action<rightshift_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator&, bitwise_action<and_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator|, bitwise_action<or_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator^, bitwise_action<xor_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator&&, logical_action<and_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator||, logical_action<or_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator<, relational_action<less_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator>, relational_action<greater_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator<=, relational_action<lessorequal_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator>=, relational_action<greaterorequal_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator==, relational_action<equal_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator!=, relational_action<notequal_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE(operator+=, arithmetic_assignment_action<plus_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator-=, arithmetic_assignment_action<minus_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator*=, arithmetic_assignment_action<multiply_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator/=, arithmetic_assignment_action<divide_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator%=, arithmetic_assignment_action<remainder_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator<<=, bitwise_assignment_action<leftshift_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator>>=, bitwise_assignment_action<rightshift_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator&=, bitwise_assignment_action<and_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator|=, bitwise_assignment_action<or_action>, A, const B, reference_argument)
BOOST_LAMBDA_BE(operator^=, bitwise_assignment_action<xor_action>, A, const B, reference_argument)
// A special trick for comma operator for correct preprocessing
#if defined BOOST_LAMBDA_COMMA_OPERATOR_NAME
#error "Multiple defines of BOOST_LAMBDA_COMMA_OPERATOR_NAME"
#endif
#define BOOST_LAMBDA_COMMA_OPERATOR_NAME operator,
BOOST_LAMBDA_BE1(BOOST_LAMBDA_COMMA_OPERATOR_NAME, other_action<comma_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE2(BOOST_LAMBDA_COMMA_OPERATOR_NAME, other_action<comma_action>, const A, const B, const_copy_argument)
BOOST_LAMBDA_BE3(BOOST_LAMBDA_COMMA_OPERATOR_NAME, other_action<comma_action>, const A, const B, const_copy_argument)
namespace detail {
// special cases for ostream& << Any and istream& >> Any ---------------
// the actual stream classes may vary and thus a specialisation for,
// say ostream& does not match (the general case above is chosen).
// Therefore we specialise for non-const reference:
// if the left argument is a stream, we store the stream as reference
// if it is something else, we store a const plain by default
// Note that the overloading is const vs. non-const first argument
#ifdef BOOST_NO_TEMPLATED_STREAMS
template<class T> struct convert_ostream_to_ref_others_to_c_plain_by_default {
typedef typename detail::IF<
boost::is_convertible<T*, std::ostream*>::value,
T&,
typename const_copy_argument <T>::type
>::RET type;
};
template<class T> struct convert_istream_to_ref_others_to_c_plain_by_default {
typedef typename detail::IF<
boost::is_convertible<T*, std::istream*>::value,
T&,
typename const_copy_argument <T>::type
>::RET type;
};
#else
template<class T> struct convert_ostream_to_ref_others_to_c_plain_by_default {
typedef typename detail::IF<
is_instance_of_2<
T, std::basic_ostream
>::value,
T&,
typename const_copy_argument <T>::type
>::RET type;
};
template<class T> struct convert_istream_to_ref_others_to_c_plain_by_default {
typedef typename detail::IF<
is_instance_of_2<
T, std::basic_istream
>::value,
T&,
typename const_copy_argument <T>::type
>::RET type;
};
#endif
} // detail
BOOST_LAMBDA_BE2(operator<<, bitwise_action< leftshift_action>, A, const B, detail::convert_ostream_to_ref_others_to_c_plain_by_default)
BOOST_LAMBDA_BE2(operator>>, bitwise_action< rightshift_action>, A, const B, detail::convert_istream_to_ref_others_to_c_plain_by_default)
// special case for io_manipulators.
// function references cannot be given as arguments to lambda operator
// expressions in general. With << and >> the use of manipulators is
// so common, that specializations are provided to make them work.
template<class Arg, class Ret, class ManipArg>
inline const
lambda_functor<
lambda_functor_base<
bitwise_action<leftshift_action>,
tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>
>
>
operator<<(const lambda_functor<Arg>& a, Ret(&b)(ManipArg))
{
return
lambda_functor_base<
bitwise_action<leftshift_action>,
tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>
>
( tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>(a, b) );
}
template<class Arg, class Ret, class ManipArg>
inline const
lambda_functor<
lambda_functor_base<
bitwise_action<rightshift_action>,
tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>
>
>
operator>>(const lambda_functor<Arg>& a, Ret(&b)(ManipArg))
{
return
lambda_functor_base<
bitwise_action<rightshift_action>,
tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>
>
( tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>(a, b) );
}
// (+ and -) take their arguments as const references.
// This has consquences with pointer artihmetic
// E.g int a[]; ... *a = 1 works but not *(a+1) = 1.
// the result of a+1 would be const
// To make the latter work too,
// non-const arrays are taken as non-const and stored as non-const as well.
#if defined BOOST_LAMBDA_PTR_ARITHMETIC_E1
#error "Multiple defines of BOOST_LAMBDA_PTR_ARITHMETIC_E1"
#endif
#define BOOST_LAMBDA_PTR_ARITHMETIC_E1(OPER_NAME, ACTION, CONSTB) \
template<class Arg, int N, class B> \
inline const \
lambda_functor< \
lambda_functor_base<ACTION, tuple<lambda_functor<Arg>, CONSTB(&)[N]> > \
> \
OPER_NAME (const lambda_functor<Arg>& a, CONSTB(&b)[N]) \
{ \
return lambda_functor< \
lambda_functor_base<ACTION, tuple<lambda_functor<Arg>, CONSTB(&)[N]> > \
>(tuple<lambda_functor<Arg>, CONSTB(&)[N]>(a, b)); \
}
#if defined BOOST_LAMBDA_PTR_ARITHMETIC_E2
#error "Multiple defines of BOOST_LAMBDA_PTR_ARITHMETIC_E2"
#endif
#define BOOST_LAMBDA_PTR_ARITHMETIC_E2(OPER_NAME, ACTION, CONSTA) \
template<int N, class A, class Arg> \
inline const \
lambda_functor< \
lambda_functor_base<ACTION, tuple<CONSTA(&)[N], lambda_functor<Arg> > > \
> \
OPER_NAME (CONSTA(&a)[N], const lambda_functor<Arg>& b) \
{ \
return \
lambda_functor_base<ACTION, tuple<CONSTA(&)[N], lambda_functor<Arg> > > \
(tuple<CONSTA(&)[N], lambda_functor<Arg> >(a, b)); \
}
BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator+, arithmetic_action<plus_action>, B)
BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator+, arithmetic_action<plus_action>, A)
BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator+, arithmetic_action<plus_action>,const B)
BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator+, arithmetic_action<plus_action>,const A)
//BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator-, arithmetic_action<minus_action>)
// This is not needed, since the result of ptr-ptr is an rvalue anyway
BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator-, arithmetic_action<minus_action>, A)
BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator-, arithmetic_action<minus_action>, const A)
#undef BOOST_LAMBDA_BE1
#undef BOOST_LAMBDA_BE2
#undef BOOST_LAMBDA_BE3
#undef BOOST_LAMBDA_BE
#undef BOOST_LAMBDA_COMMA_OPERATOR_NAME
#undef BOOST_LAMBDA_PTR_ARITHMETIC_E1
#undef BOOST_LAMBDA_PTR_ARITHMETIC_E2
// ---------------------------------------------------------------------
// unary operators -----------------------------------------------------
// ---------------------------------------------------------------------
#if defined BOOST_LAMBDA_UE
#error "Multiple defines of BOOST_LAMBDA_UE"
#endif
#define BOOST_LAMBDA_UE(OPER_NAME, ACTION) \
template<class Arg> \
inline const \
lambda_functor<lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > > \
OPER_NAME (const lambda_functor<Arg>& a) \
{ \
return \
lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > \
( tuple<lambda_functor<Arg> >(a) ); \
}
BOOST_LAMBDA_UE(operator+, unary_arithmetic_action<plus_action>)
BOOST_LAMBDA_UE(operator-, unary_arithmetic_action<minus_action>)
BOOST_LAMBDA_UE(operator~, bitwise_action<not_action>)
BOOST_LAMBDA_UE(operator!, logical_action<not_action>)
BOOST_LAMBDA_UE(operator++, pre_increment_decrement_action<increment_action>)
BOOST_LAMBDA_UE(operator--, pre_increment_decrement_action<decrement_action>)
BOOST_LAMBDA_UE(operator*, other_action<contentsof_action>)
BOOST_LAMBDA_UE(operator&, other_action<addressof_action>)
#if defined BOOST_LAMBDA_POSTFIX_UE
#error "Multiple defines of BOOST_LAMBDA_POSTFIX_UE"
#endif
#define BOOST_LAMBDA_POSTFIX_UE(OPER_NAME, ACTION) \
template<class Arg> \
inline const \
lambda_functor<lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > > \
OPER_NAME (const lambda_functor<Arg>& a, int) \
{ \
return \
lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > \
( tuple<lambda_functor<Arg> >(a) ); \
}
BOOST_LAMBDA_POSTFIX_UE(operator++, post_increment_decrement_action<increment_action>)
BOOST_LAMBDA_POSTFIX_UE(operator--, post_increment_decrement_action<decrement_action>)
#undef BOOST_LAMBDA_UE
#undef BOOST_LAMBDA_POSTFIX_UE
} // namespace lambda
} // namespace boost
#endif

View File

@@ -0,0 +1,325 @@
// Boost Lambda Library ret.hpp -----------------------------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see www.boost.org
#ifndef BOOST_LAMBDA_RET_HPP
#define BOOST_LAMBDA_RET_HPP
namespace boost {
namespace lambda {
// TODO:
// Add specializations for function references for ret, protect and unlambda
// e.g void foo(); unlambda(foo); fails, as it would add a const qualifier
// for a function type.
// on the other hand unlambda(*foo) does work
// -- ret -------------------------
// the explicit return type template
// TODO: It'd be nice to make ret a nop for other than lambda functors
// but causes an ambiguiyty with gcc (not with KCC), check what is the
// right interpretation.
// // ret for others than lambda functors has no effect
// template <class U, class T>
// inline const T& ret(const T& t) { return t; }
template<class RET, class Arg>
inline const
lambda_functor<
lambda_functor_base<
explicit_return_type_action<RET>,
tuple<lambda_functor<Arg> >
>
>
ret(const lambda_functor<Arg>& a1)
{
return
lambda_functor_base<
explicit_return_type_action<RET>,
tuple<lambda_functor<Arg> >
>
(tuple<lambda_functor<Arg> >(a1));
}
// protect ------------------
// protecting others than lambda functors has no effect
template <class T>
inline const T& protect(const T& t) { return t; }
template<class Arg>
inline const
lambda_functor<
lambda_functor_base<
protect_action,
tuple<lambda_functor<Arg> >
>
>
protect(const lambda_functor<Arg>& a1)
{
return
lambda_functor_base<
protect_action,
tuple<lambda_functor<Arg> >
>
(tuple<lambda_functor<Arg> >(a1));
}
// -------------------------------------------------------------------
// Hides the lambda functorness of a lambda functor.
// After this, the functor is immune to argument substitution, etc.
// This can be used, e.g. to make it safe to pass lambda functors as
// arguments to functions, which might use them as target functions
// note, unlambda and protect are different things. Protect hides the lambda
// functor for one application, unlambda for good.
template <class LambdaFunctor>
class non_lambda_functor
{
LambdaFunctor lf;
public:
// This functor defines the result_type typedef.
// The result type must be deducible without knowing the arguments
template <class SigArgs> struct sig {
typedef typename
LambdaFunctor::inherited::
template sig<typename SigArgs::tail_type>::type type;
};
explicit non_lambda_functor(const LambdaFunctor& a) : lf(a) {}
typename LambdaFunctor::nullary_return_type
operator()() const {
return lf.template
call<typename LambdaFunctor::nullary_return_type>
(cnull_type(), cnull_type(), cnull_type(), cnull_type());
}
template<class A>
typename sig<tuple<const non_lambda_functor, A&> >::type
operator()(A& a) const {
return lf.template call<typename sig<tuple<const non_lambda_functor, A&> >::type >(a, cnull_type(), cnull_type(), cnull_type());
}
template<class A, class B>
typename sig<tuple<const non_lambda_functor, A&, B&> >::type
operator()(A& a, B& b) const {
return lf.template call<typename sig<tuple<const non_lambda_functor, A&, B&> >::type >(a, b, cnull_type(), cnull_type());
}
template<class A, class B, class C>
typename sig<tuple<const non_lambda_functor, A&, B&, C&> >::type
operator()(A& a, B& b, C& c) const {
return lf.template call<typename sig<tuple<const non_lambda_functor, A&, B&, C&> >::type>(a, b, c, cnull_type());
}
};
template <class Arg>
inline const Arg& unlambda(const Arg& a) { return a; }
template <class Arg>
inline const non_lambda_functor<lambda_functor<Arg> >
unlambda(const lambda_functor<Arg>& a)
{
return non_lambda_functor<lambda_functor<Arg> >(a);
}
// Due to a language restriction, lambda functors cannot be made to
// accept non-const rvalue arguments. Usually iterators do not return
// temporaries, but sometimes they do. That's why a workaround is provided.
// Note, that this potentially breaks const correctness, so be careful!
// any lambda functor can be turned into a const_incorrect_lambda_functor
// The operator() takes arguments as consts and then casts constness
// away. So this breaks const correctness!!! but is a necessary workaround
// in some cases due to language limitations.
// Note, that this is not a lambda_functor anymore, so it can not be used
// as a sub lambda expression.
template <class LambdaFunctor>
struct const_incorrect_lambda_functor {
LambdaFunctor lf;
public:
explicit const_incorrect_lambda_functor(const LambdaFunctor& a) : lf(a) {}
template <class SigArgs> struct sig {
typedef typename
LambdaFunctor::inherited::template
sig<typename SigArgs::tail_type>::type type;
};
// The nullary case is not needed (no arguments, no parameter type problems)
template<class A>
typename sig<tuple<const const_incorrect_lambda_functor, A&> >::type
operator()(const A& a) const {
return lf.template call<typename sig<tuple<const const_incorrect_lambda_functor, A&> >::type >(const_cast<A&>(a), cnull_type(), cnull_type(), cnull_type());
}
template<class A, class B>
typename sig<tuple<const const_incorrect_lambda_functor, A&, B&> >::type
operator()(const A& a, const B& b) const {
return lf.template call<typename sig<tuple<const const_incorrect_lambda_functor, A&, B&> >::type >(const_cast<A&>(a), const_cast<B&>(b), cnull_type(), cnull_type());
}
template<class A, class B, class C>
typename sig<tuple<const const_incorrect_lambda_functor, A&, B&, C&> >::type
operator()(const A& a, const B& b, const C& c) const {
return lf.template call<typename sig<tuple<const const_incorrect_lambda_functor, A&, B&, C&> >::type>(const_cast<A&>(a), const_cast<B&>(b), const_cast<C&>(c), cnull_type());
}
};
// ------------------------------------------------------------------------
// any lambda functor can be turned into a const_parameter_lambda_functor
// The operator() takes arguments as const.
// This is useful if lambda functors are called with non-const rvalues.
// Note, that this is not a lambda_functor anymore, so it can not be used
// as a sub lambda expression.
template <class LambdaFunctor>
struct const_parameter_lambda_functor {
LambdaFunctor lf;
public:
explicit const_parameter_lambda_functor(const LambdaFunctor& a) : lf(a) {}
template <class SigArgs> struct sig {
typedef typename
LambdaFunctor::inherited::template
sig<typename SigArgs::tail_type>::type type;
};
// The nullary case is not needed: no arguments, no constness problems.
template<class A>
typename sig<tuple<const const_parameter_lambda_functor, const A&> >::type
operator()(const A& a) const {
return lf.template call<typename sig<tuple<const const_parameter_lambda_functor, const A&> >::type >(a, cnull_type(), cnull_type(), cnull_type());
}
template<class A, class B>
typename sig<tuple<const const_parameter_lambda_functor, const A&, const B&> >::type
operator()(const A& a, const B& b) const {
return lf.template call<typename sig<tuple<const const_parameter_lambda_functor, const A&, const B&> >::type >(a, b, cnull_type(), cnull_type());
}
template<class A, class B, class C>
typename sig<tuple<const const_parameter_lambda_functor, const A&, const B&, const C&>
>::type
operator()(const A& a, const B& b, const C& c) const {
return lf.template call<typename sig<tuple<const const_parameter_lambda_functor, const A&, const B&, const C&> >::type>(a, b, c, cnull_type());
}
};
template <class Arg>
inline const const_incorrect_lambda_functor<lambda_functor<Arg> >
break_const(const lambda_functor<Arg>& lf)
{
return const_incorrect_lambda_functor<lambda_functor<Arg> >(lf);
}
template <class Arg>
inline const const_parameter_lambda_functor<lambda_functor<Arg> >
const_parameters(const lambda_functor<Arg>& lf)
{
return const_parameter_lambda_functor<lambda_functor<Arg> >(lf);
}
// make void ------------------------------------------------
// make_void( x ) turns a lambda functor x with some return type y into
// another lambda functor, which has a void return type
// when called, the original return type is discarded
// we use this action. The action class will be called, which means that
// the wrapped lambda functor is evaluated, but we just don't do anything
// with the result.
struct voidifier_action {
template<class Ret, class A> static void apply(A&) {}
};
template<class Args> struct return_type_N<voidifier_action, Args> {
typedef void type;
};
template<class Arg1>
inline const
lambda_functor<
lambda_functor_base<
action<1, voidifier_action>,
tuple<lambda_functor<Arg1> >
>
>
make_void(const lambda_functor<Arg1>& a1) {
return
lambda_functor_base<
action<1, voidifier_action>,
tuple<lambda_functor<Arg1> >
>
(tuple<lambda_functor<Arg1> > (a1));
}
// for non-lambda functors, make_void does nothing
// (the argument gets evaluated immediately)
template<class Arg1>
inline const
lambda_functor<
lambda_functor_base<do_nothing_action, null_type>
>
make_void(const Arg1& a1) {
return
lambda_functor_base<do_nothing_action, null_type>();
}
// std_functor -----------------------------------------------------
// The STL uses the result_type typedef as the convention to let binders know
// the return type of a function object.
// LL uses the sig template.
// To let LL know that the function object has the result_type typedef
// defined, it can be wrapped with the std_functor function.
// Just inherit form the template parameter (the standard functor),
// and provide a sig template. So we have a class which is still the
// same functor + the sig template.
template<class T>
struct result_type_to_sig : public T {
template<class Args> struct sig { typedef typename T::result_type type; };
result_type_to_sig(const T& t) : T(t) {}
};
template<class F>
inline result_type_to_sig<F> std_functor(const F& f) { return f; }
} // namespace lambda
} // namespace boost
#endif

View File

@@ -0,0 +1,284 @@
// return_type_traits.hpp -- Boost Lambda Library ---------------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see www.boost.org
#ifndef BOOST_LAMBDA_RETURN_TYPE_TRAITS_HPP
#define BOOST_LAMBDA_RETURN_TYPE_TRAITS_HPP
#include "boost/mpl/has_xxx.hpp"
#include <cstddef> // needed for the ptrdiff_t
namespace boost {
namespace lambda {
using ::boost::type_traits::ice_and;
using ::boost::type_traits::ice_or;
using ::boost::type_traits::ice_not;
// Much of the type deduction code for standard arithmetic types
// from Gary Powell
// different arities:
template <class Act, class A1> struct return_type_1; // 1-ary actions
template <class Act, class A1, class A2> struct return_type_2; // 2-ary
template <class Act, class Args> struct return_type_N; // >3- ary
template <class Act, class A1> struct return_type_1_prot;
template <class Act, class A1, class A2> struct return_type_2_prot; // 2-ary
template <class Act, class A1> struct return_type_N_prot; // >3-ary
namespace detail {
template<class> class return_type_deduction_failure {};
// In some cases return type deduction should fail (an invalid lambda
// expression). Sometimes the lambda expression can be ok, the return type
// just is not deducible (user defined operators). Then return type deduction
// should never be entered at all, and the use of ret<> does this.
// However, for nullary lambda functors, return type deduction is always
// entered, and there seems to be no way around this.
// (the return type is part of the prototype of the non-template
// operator()(). The prototype is instantiated, even though the body
// is not.)
// So, in the case the return type deduction should fail, it should not
// fail directly, but rather result in a valid but wrong return type,
// causing a compile time error only if the function is really called.
} // end detail
// return_type_X_prot classes --------------------------------------------
// These classes are the first layer that gets instantiated from the
// lambda_functor_base sig templates. It will check whether
// the action is protectable and one of arguments is "protected" or its
// evaluation will otherwise result in another lambda functor.
// If this is a case, the result type will be another lambda functor.
// The arguments are always non-reference types, except for comma action
// where the right argument can be a reference too. This is because it
// matters (in the builtin case) whether the argument is an lvalue or
// rvalue: int i; i, 1 -> rvalue; 1, i -> lvalue
template <class Act, class A> struct return_type_1_prot {
public:
typedef typename
detail::IF<
// is_protectable<Act>::value && is_lambda_functor<A>::value,
ice_and<is_protectable<Act>::value, is_lambda_functor<A>::value>::value,
lambda_functor<
lambda_functor_base<
Act,
tuple<typename detail::remove_reference_and_cv<A>::type>
>
>,
typename return_type_1<Act, A>::type
>::RET type;
};
// take care of the unavoidable instantiation for nullary case
template<class Act> struct return_type_1_prot<Act, null_type> {
typedef null_type type;
};
// Unary actions (result from unary operators)
// do not have a default return type.
template<class Act, class A> struct return_type_1 {
typedef typename
detail::return_type_deduction_failure<return_type_1> type;
};
namespace detail {
template <class T>
class protect_conversion {
typedef typename boost::remove_reference<T>::type non_ref_T;
public:
// add const to rvalues, so that all rvalues are stored as const in
// the args tuple
typedef typename detail::IF_type<
// boost::is_reference<T>::value && !boost::is_const<non_ref_T>::value,
ice_and<boost::is_reference<T>::value,
ice_not<boost::is_const<non_ref_T>::value>::value>::value,
detail::identity_mapping<T>,
const_copy_argument<non_ref_T> // handles funtion and array
>::type type; // types correctly
};
} // end detail
template <class Act, class A, class B> struct return_type_2_prot {
// experimental feature
// We may have a lambda functor as a result type of a subexpression
// (if protect) has been used.
// Thus, if one of the parameter types is a lambda functor, the result
// is a lambda functor as well.
// We need to make a conservative choise here.
// The resulting lambda functor stores all const reference arguments as
// const copies. References to non-const are stored as such.
// So if the source of the argument is a const open argument, a bound
// argument stored as a const reference, or a function returning a
// const reference, that information is lost. There is no way of
// telling apart 'real const references' from just 'LL internal
// const references' (or it would be really hard)
// The return type is a subclass of lambda_functor, which has a converting
// copy constructor. It can copy any lambda functor, that has the same
// action type and code, and a copy compatible argument tuple.
typedef typename boost::remove_reference<A>::type non_ref_A;
typedef typename boost::remove_reference<B>::type non_ref_B;
typedef typename
detail::IF<
// is_protectable<Act>::value &&
// (is_lambda_functor<A>::value || is_lambda_functor<B>::value),
ice_and<is_protectable<Act>::value,
ice_or<is_lambda_functor<A>::value,
is_lambda_functor<B>::value>::value>::value,
lambda_functor<
lambda_functor_base<
Act,
tuple<typename detail::protect_conversion<A>::type,
typename detail::protect_conversion<B>::type>
>
>,
typename return_type_2<Act, non_ref_A, non_ref_B>::type
>::RET type;
};
// take care of the unavoidable instantiation for nullary case
template<class Act> struct return_type_2_prot<Act, null_type, null_type> {
typedef null_type type;
};
// take care of the unavoidable instantiation for nullary case
template<class Act, class Other> struct return_type_2_prot<Act, Other, null_type> {
typedef null_type type;
};
// take care of the unavoidable instantiation for nullary case
template<class Act, class Other> struct return_type_2_prot<Act, null_type, Other> {
typedef null_type type;
};
// comma is a special case, as the user defined operator can return
// an lvalue (reference) too, hence it must be handled at this level.
template<class A, class B>
struct return_type_2_comma
{
typedef typename boost::remove_reference<A>::type non_ref_A;
typedef typename boost::remove_reference<B>::type non_ref_B;
typedef typename
detail::IF<
// is_protectable<other_action<comma_action> >::value && // it is protectable
// (is_lambda_functor<A>::value || is_lambda_functor<B>::value),
ice_and<is_protectable<other_action<comma_action> >::value, // it is protectable
ice_or<is_lambda_functor<A>::value,
is_lambda_functor<B>::value>::value>::value,
lambda_functor<
lambda_functor_base<
other_action<comma_action>,
tuple<typename detail::protect_conversion<A>::type,
typename detail::protect_conversion<B>::type>
>
>,
typename
return_type_2<other_action<comma_action>, non_ref_A, non_ref_B>::type
>::RET type1;
// if no user defined return_type_2 (or plain_return_type_2) specialization
// matches, then return the righthand argument
typedef typename
detail::IF<
boost::is_same<type1, detail::unspecified>::value,
B,
type1
>::RET type;
};
// currently there are no protectable actions with > 2 args
// Note, that if there will be, lambda_functor_base will have to be
// changed to not get rid of references in Args elements
template<class Act, class Args> struct return_type_N_prot {
typedef typename return_type_N<Act, Args>::type type;
};
// take care of the unavoidable instantiation for nullary case
template<class Act> struct return_type_N_prot<Act, null_type> {
typedef null_type type;
};
// handle different kind of actions ------------------------
// use the return type given in the bind invocation as bind<Ret>(...)
template<int I, class Args, class Ret>
struct return_type_N<function_action<I, Ret>, Args> {
typedef Ret type;
};
// ::result_type support
namespace detail
{
BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
template<class F> struct get_result_type
{
typedef typename F::result_type type;
};
template<class F, class A> struct get_sig
{
typedef typename function_adaptor<F>::template sig<A>::type type;
};
} // namespace detail
// Ret is detail::unspecified, so try to deduce return type
template<int I, class Args>
struct return_type_N<function_action<I, detail::unspecified>, Args > {
// in the case of function action, the first element in Args is
// some type of function
typedef typename Args::head_type Func;
typedef typename detail::remove_reference_and_cv<Func>::type plain_Func;
public:
// pass the function to function_adaptor, and get the return type from
// that
typedef typename detail::IF<
detail::has_result_type<plain_Func>::value,
detail::get_result_type<plain_Func>,
detail::get_sig<plain_Func, Args>
>::RET::type type;
};
} // namespace lambda
} // namespace boost
#endif

View File

@@ -0,0 +1,74 @@
// -- select_functions.hpp -- Boost Lambda Library --------------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see http://www.boost.org
#ifndef BOOST_LAMBDA_SELECT_FUNCTIONS_HPP
#define BOOST_LAMBDA_SELECT_FUNCTIONS_HPP
namespace boost {
namespace lambda {
namespace detail {
// select functions -------------------------------
template<class Any, CALL_TEMPLATE_ARGS>
inline Any& select(Any& any, CALL_FORMAL_ARGS) { CALL_USE_ARGS; return any; }
template<class Arg, CALL_TEMPLATE_ARGS>
inline typename Arg::template sig<tuple<CALL_REFERENCE_TYPES> >::type
select ( const lambda_functor<Arg>& op, CALL_FORMAL_ARGS ) {
return op.template call<
typename Arg::template sig<tuple<CALL_REFERENCE_TYPES> >::type
>(CALL_ACTUAL_ARGS);
}
template<class Arg, CALL_TEMPLATE_ARGS>
inline typename Arg::template sig<tuple<CALL_REFERENCE_TYPES> >::type
select ( lambda_functor<Arg>& op, CALL_FORMAL_ARGS) {
return op.template call<
typename Arg::template sig<tuple<CALL_REFERENCE_TYPES> >::type
>(CALL_ACTUAL_ARGS);
}
// ------------------------------------------------------------------------
// select functions where the return type is explicitly given
// Note: on many functions, this return type is just discarded.
// The select functions are inside a class template, and the return type
// is a class template argument.
// The first implementation used function templates with an explicitly
// specified template parameter.
// However, this resulted in ambiguous calls (at least with gcc 2.95.2
// and edg 2.44). Not sure whether the compilers were right or wrong.
template<class RET> struct r_select {
// Any == RET
template<class Any, CALL_TEMPLATE_ARGS>
static
inline RET go (Any& any, CALL_FORMAL_ARGS) { CALL_USE_ARGS; return any; }
template<class Arg, CALL_TEMPLATE_ARGS>
static
inline RET go (const lambda_functor<Arg>& op, CALL_FORMAL_ARGS ) {
return op.template call<RET>(CALL_ACTUAL_ARGS);
}
template<class Arg, CALL_TEMPLATE_ARGS>
static
inline RET go (lambda_functor<Arg>& op, CALL_FORMAL_ARGS ) {
return op.template call<RET>(CALL_ACTUAL_ARGS);
}
};
} // namespace detail
} // namespace lambda
} // namespace boost
#endif

File diff suppressed because it is too large Load Diff

462
include/boost/lambda/if.hpp Normal file
View File

@@ -0,0 +1,462 @@
// Boost Lambda Library -- if.hpp ------------------------------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000 Gary Powell (powellg@amazon.com)
// Copyright (C) 2001-2002 Joel de Guzman
//
// Distributed under 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)
//
// For more information, see www.boost.org
// --------------------------------------------------------------------------
#if !defined(BOOST_LAMBDA_IF_HPP)
#define BOOST_LAMBDA_IF_HPP
#include "boost/lambda/core.hpp"
// Arithmetic type promotion needed for if_then_else_return
#include "boost/lambda/detail/operator_actions.hpp"
#include "boost/lambda/detail/operator_return_type_traits.hpp"
namespace boost {
namespace lambda {
// -- if control construct actions ----------------------
class ifthen_action {};
class ifthenelse_action {};
class ifthenelsereturn_action {};
// Specialization for if_then.
template<class Args>
class
lambda_functor_base<ifthen_action, Args> {
public:
Args args;
template <class T> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
if (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS))
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
}
};
// If Then
template <class Arg1, class Arg2>
inline const
lambda_functor<
lambda_functor_base<
ifthen_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
>
>
if_then(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2) {
return
lambda_functor_base<
ifthen_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
>
( tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >(a1, a2) );
}
// Specialization for if_then_else.
template<class Args>
class
lambda_functor_base<ifthenelse_action, Args> {
public:
Args args;
template <class T> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
if (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS))
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
else
detail::select(boost::tuples::get<2>(args), CALL_ACTUAL_ARGS);
}
};
// If then else
template <class Arg1, class Arg2, class Arg3>
inline const
lambda_functor<
lambda_functor_base<
ifthenelse_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2>, lambda_functor<Arg3> >
>
>
if_then_else(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2,
const lambda_functor<Arg3>& a3) {
return
lambda_functor_base<
ifthenelse_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2>, lambda_functor<Arg3> >
>
(tuple<lambda_functor<Arg1>, lambda_functor<Arg2>, lambda_functor<Arg3> >
(a1, a2, a3) );
}
// Our version of operator?:()
template <class Arg1, class Arg2, class Arg3>
inline const
lambda_functor<
lambda_functor_base<
other_action<ifthenelsereturn_action>,
tuple<lambda_functor<Arg1>,
typename const_copy_argument<Arg2>::type,
typename const_copy_argument<Arg3>::type>
>
>
if_then_else_return(const lambda_functor<Arg1>& a1,
const Arg2 & a2,
const Arg3 & a3) {
return
lambda_functor_base<
other_action<ifthenelsereturn_action>,
tuple<lambda_functor<Arg1>,
typename const_copy_argument<Arg2>::type,
typename const_copy_argument<Arg3>::type>
> ( tuple<lambda_functor<Arg1>,
typename const_copy_argument<Arg2>::type,
typename const_copy_argument<Arg3>::type> (a1, a2, a3) );
}
namespace detail {
// return type specialization for conditional expression begins -----------
// start reading below and move upwards
// PHASE 6:1
// check if A is conbertible to B and B to A
template<int Phase, bool AtoB, bool BtoA, bool SameType, class A, class B>
struct return_type_2_ifthenelsereturn;
// if A can be converted to B and vice versa -> ambiguous
template<int Phase, class A, class B>
struct return_type_2_ifthenelsereturn<Phase, true, true, false, A, B> {
typedef
detail::return_type_deduction_failure<return_type_2_ifthenelsereturn> type;
// ambiguous type in conditional expression
};
// if A can be converted to B and vice versa and are of same type
template<int Phase, class A, class B>
struct return_type_2_ifthenelsereturn<Phase, true, true, true, A, B> {
typedef A type;
};
// A can be converted to B
template<int Phase, class A, class B>
struct return_type_2_ifthenelsereturn<Phase, true, false, false, A, B> {
typedef B type;
};
// B can be converted to A
template<int Phase, class A, class B>
struct return_type_2_ifthenelsereturn<Phase, false, true, false, A, B> {
typedef A type;
};
// neither can be converted. Then we drop the potential references, and
// try again
template<class A, class B>
struct return_type_2_ifthenelsereturn<1, false, false, false, A, B> {
// it is safe to add const, since the result will be an rvalue and thus
// const anyway. The const are needed eg. if the types
// are 'const int*' and 'void *'. The remaining type should be 'const void*'
typedef const typename boost::remove_reference<A>::type plainA;
typedef const typename boost::remove_reference<B>::type plainB;
// TODO: Add support for volatile ?
typedef typename
return_type_2_ifthenelsereturn<
2,
boost::is_convertible<plainA,plainB>::value,
boost::is_convertible<plainB,plainA>::value,
boost::is_same<plainA,plainB>::value,
plainA,
plainB>::type type;
};
// PHASE 6:2
template<class A, class B>
struct return_type_2_ifthenelsereturn<2, false, false, false, A, B> {
typedef
detail::return_type_deduction_failure<return_type_2_ifthenelsereturn> type;
// types_do_not_match_in_conditional_expression
};
// PHASE 5: now we know that types are not arithmetic.
template<class A, class B>
struct non_numeric_types {
typedef typename
return_type_2_ifthenelsereturn<
1, // phase 1
is_convertible<A,B>::value,
is_convertible<B,A>::value,
is_same<A,B>::value,
A,
B>::type type;
};
// PHASE 4 :
// the base case covers arithmetic types with differing promote codes
// use the type deduction of arithmetic_actions
template<int CodeA, int CodeB, class A, class B>
struct arithmetic_or_not {
typedef typename
return_type_2<arithmetic_action<plus_action>, A, B>::type type;
// plus_action is just a random pick, has to be a concrete instance
};
// this case covers the case of artihmetic types with the same promote codes.
// non numeric deduction is used since e.g. integral promotion is not
// performed with operator ?:
template<int CodeA, class A, class B>
struct arithmetic_or_not<CodeA, CodeA, A, B> {
typedef typename non_numeric_types<A, B>::type type;
};
// if either A or B has promote code -1 it is not an arithmetic type
template<class A, class B>
struct arithmetic_or_not <-1, -1, A, B> {
typedef typename non_numeric_types<A, B>::type type;
};
template<int CodeB, class A, class B>
struct arithmetic_or_not <-1, CodeB, A, B> {
typedef typename non_numeric_types<A, B>::type type;
};
template<int CodeA, class A, class B>
struct arithmetic_or_not <CodeA, -1, A, B> {
typedef typename non_numeric_types<A, B>::type type;
};
// PHASE 3 : Are the types same?
// No, check if they are arithmetic or not
template <class A, class B>
struct same_or_not {
typedef typename detail::remove_reference_and_cv<A>::type plainA;
typedef typename detail::remove_reference_and_cv<B>::type plainB;
typedef typename
arithmetic_or_not<
detail::promote_code<plainA>::value,
detail::promote_code<plainB>::value,
A,
B>::type type;
};
// Yes, clear.
template <class A> struct same_or_not<A, A> {
typedef A type;
};
} // detail
// PHASE 2 : Perform first the potential array_to_pointer conversion
template<class A, class B>
struct return_type_2<other_action<ifthenelsereturn_action>, A, B> {
typedef typename detail::array_to_pointer<A>::type A1;
typedef typename detail::array_to_pointer<B>::type B1;
typedef typename
boost::add_const<typename detail::same_or_not<A1, B1>::type>::type type;
};
// PHASE 1 : Deduction is based on the second and third operand
// return type specialization for conditional expression ends -----------
// Specialization of lambda_functor_base for if_then_else_return.
template<class Args>
class
lambda_functor_base<other_action<ifthenelsereturn_action>, Args> {
public:
Args args;
template <class SigArgs> struct sig {
private:
typedef typename detail::nth_return_type_sig<1, Args, SigArgs>::type ret1;
typedef typename detail::nth_return_type_sig<2, Args, SigArgs>::type ret2;
public:
typedef typename return_type_2<
other_action<ifthenelsereturn_action>, ret1, ret2
>::type type;
};
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
return (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS)) ?
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS)
:
detail::select(boost::tuples::get<2>(args), CALL_ACTUAL_ARGS);
}
};
// The code below is from Joel de Guzman, some name changes etc.
// has been made.
///////////////////////////////////////////////////////////////////////////////
//
// if_then_else_composite
//
// This composite has two (2) forms:
//
// if_(condition)
// [
// statement
// ]
//
// and
//
// if_(condition)
// [
// true_statement
// ]
// .else_
// [
// false_statement
// ]
//
// where condition is an lambda_functor that evaluates to bool. If condition
// is true, the true_statement (again an lambda_functor) is executed
// otherwise, the false_statement (another lambda_functor) is executed. The
// result type of this is void. Note the trailing underscore after
// if_ and the the leading dot and the trailing underscore before
// and after .else_.
//
///////////////////////////////////////////////////////////////////////////////
template <typename CondT, typename ThenT, typename ElseT>
struct if_then_else_composite {
typedef if_then_else_composite<CondT, ThenT, ElseT> self_t;
template <class SigArgs>
struct sig { typedef void type; };
if_then_else_composite(
CondT const& cond_,
ThenT const& then_,
ElseT const& else__)
: cond(cond_), then(then_), else_(else__) {}
template <class Ret, CALL_TEMPLATE_ARGS>
Ret call(CALL_FORMAL_ARGS) const
{
if (cond.internal_call(CALL_ACTUAL_ARGS))
then.internal_call(CALL_ACTUAL_ARGS);
else
else_.internal_call(CALL_ACTUAL_ARGS);
}
CondT cond; ThenT then; ElseT else_; // lambda_functors
};
//////////////////////////////////
template <typename CondT, typename ThenT>
struct else_gen {
else_gen(CondT const& cond_, ThenT const& then_)
: cond(cond_), then(then_) {}
template <typename ElseT>
lambda_functor<if_then_else_composite<CondT, ThenT,
typename as_lambda_functor<ElseT>::type> >
operator[](ElseT const& else_)
{
typedef if_then_else_composite<CondT, ThenT,
typename as_lambda_functor<ElseT>::type>
result;
return result(cond, then, to_lambda_functor(else_));
}
CondT cond; ThenT then;
};
//////////////////////////////////
template <typename CondT, typename ThenT>
struct if_then_composite {
template <class SigArgs>
struct sig { typedef void type; };
if_then_composite(CondT const& cond_, ThenT const& then_)
: cond(cond_), then(then_), else_(cond, then) {}
template <class Ret, CALL_TEMPLATE_ARGS>
Ret call(CALL_FORMAL_ARGS) const
{
if (cond.internal_call(CALL_ACTUAL_ARGS))
then.internal_call(CALL_ACTUAL_ARGS);
}
CondT cond; ThenT then; // lambda_functors
else_gen<CondT, ThenT> else_;
};
//////////////////////////////////
template <typename CondT>
struct if_gen {
if_gen(CondT const& cond_)
: cond(cond_) {}
template <typename ThenT>
lambda_functor<if_then_composite<
typename as_lambda_functor<CondT>::type,
typename as_lambda_functor<ThenT>::type> >
operator[](ThenT const& then) const
{
typedef if_then_composite<
typename as_lambda_functor<CondT>::type,
typename as_lambda_functor<ThenT>::type>
result;
return result(
to_lambda_functor(cond),
to_lambda_functor(then));
}
CondT cond;
};
//////////////////////////////////
template <typename CondT>
inline if_gen<CondT>
if_(CondT const& cond)
{
return if_gen<CondT>(cond);
}
} // lambda
} // boost
#endif // BOOST_LAMBDA_IF_HPP

View File

@@ -0,0 +1,34 @@
// -- lambda.hpp -- Boost Lambda Library -----------------------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see http://lambda.cs.utu.fi
#ifndef BOOST_LAMBDA_LAMBDA_HPP
#define BOOST_LAMBDA_LAMBDA_HPP
#include "boost/lambda/core.hpp"
#ifdef BOOST_NO_FDECL_TEMPLATES_AS_TEMPLATE_TEMPLATE_PARAMS
#include <istream>
#include <ostream>
#endif
#include "boost/lambda/detail/operator_actions.hpp"
#include "boost/lambda/detail/operator_lambda_func_base.hpp"
#include "boost/lambda/detail/operator_return_type_traits.hpp"
#include "boost/lambda/detail/operators.hpp"
#ifndef BOOST_LAMBDA_FAILS_IN_TEMPLATE_KEYWORD_AFTER_SCOPE_OPER
// sorry, member ptr does not work with gcc2.95
#include "boost/lambda/detail/member_ptr.hpp"
#endif
#endif

View File

@@ -0,0 +1,505 @@
// Boost Lambda Library -- loops.hpp ----------------------------------------
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000 Gary Powell (powellg@amazon.com)
// Copyright (c) 2001-2002 Joel de Guzman
//
// Distributed under 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)
//
// For more information, see www.boost.org
// --------------------------------------------------------------------------
#if !defined(BOOST_LAMBDA_LOOPS_HPP)
#define BOOST_LAMBDA_LOOPS_HPP
#include "boost/lambda/core.hpp"
namespace boost {
namespace lambda {
// -- loop control structure actions ----------------------
class forloop_action {};
class forloop_no_body_action {};
class whileloop_action {};
class whileloop_no_body_action {};
class dowhileloop_action {};
class dowhileloop_no_body_action {};
// For loop
template <class Arg1, class Arg2, class Arg3, class Arg4>
inline const
lambda_functor<
lambda_functor_base<
forloop_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2>,
lambda_functor<Arg3>, lambda_functor<Arg4> >
>
>
for_loop(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2,
const lambda_functor<Arg3>& a3, const lambda_functor<Arg4>& a4) {
return
lambda_functor_base<
forloop_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2>,
lambda_functor<Arg3>, lambda_functor<Arg4> >
>
( tuple<lambda_functor<Arg1>, lambda_functor<Arg2>,
lambda_functor<Arg3>, lambda_functor<Arg4> >(a1, a2, a3, a4)
);
}
// No body case.
template <class Arg1, class Arg2, class Arg3>
inline const
lambda_functor<
lambda_functor_base<
forloop_no_body_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2>, lambda_functor<Arg3> >
>
>
for_loop(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2,
const lambda_functor<Arg3>& a3) {
return
lambda_functor_base<
forloop_no_body_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2>,
lambda_functor<Arg3> >
>
( tuple<lambda_functor<Arg1>, lambda_functor<Arg2>,
lambda_functor<Arg3> >(a1, a2, a3) );
}
// While loop
template <class Arg1, class Arg2>
inline const
lambda_functor<
lambda_functor_base<
whileloop_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
>
>
while_loop(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2) {
return
lambda_functor_base<
whileloop_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
>
( tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >(a1, a2));
}
// No body case.
template <class Arg1>
inline const
lambda_functor<
lambda_functor_base<
whileloop_no_body_action,
tuple<lambda_functor<Arg1> >
>
>
while_loop(const lambda_functor<Arg1>& a1) {
return
lambda_functor_base<
whileloop_no_body_action,
tuple<lambda_functor<Arg1> >
>
( tuple<lambda_functor<Arg1> >(a1) );
}
// Do While loop
template <class Arg1, class Arg2>
inline const
lambda_functor<
lambda_functor_base<
dowhileloop_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
>
>
do_while_loop(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2) {
return
lambda_functor_base<
dowhileloop_action,
tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
>
( tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >(a1, a2));
}
// No body case.
template <class Arg1>
inline const
lambda_functor<
lambda_functor_base<
dowhileloop_no_body_action,
tuple<lambda_functor<Arg1> >
>
>
do_while_loop(const lambda_functor<Arg1>& a1) {
return
lambda_functor_base<
dowhileloop_no_body_action,
tuple<lambda_functor<Arg1> >
>
( tuple<lambda_functor<Arg1> >(a1));
}
// Control loop lambda_functor_base specializations.
// Specialization for for_loop.
template<class Args>
class
lambda_functor_base<forloop_action, Args> {
public:
Args args;
template <class T> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
for(detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
detail::select(boost::tuples::get<2>(args), CALL_ACTUAL_ARGS))
detail::select(boost::tuples::get<3>(args), CALL_ACTUAL_ARGS);
}
};
// No body case
template<class Args>
class
lambda_functor_base<forloop_no_body_action, Args> {
public:
Args args;
template <class T> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
for(detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS);
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
detail::select(boost::tuples::get<2>(args), CALL_ACTUAL_ARGS)) {}
}
};
// Specialization for while_loop.
template<class Args>
class
lambda_functor_base<whileloop_action, Args> {
public:
Args args;
template <class T> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
while(detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS))
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
}
};
// No body case
template<class Args>
class
lambda_functor_base<whileloop_no_body_action, Args> {
public:
Args args;
template <class T> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
while(detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS)) {}
}
};
// Specialization for do_while_loop.
// Note that the first argument is the condition.
template<class Args>
class
lambda_functor_base<dowhileloop_action, Args> {
public:
Args args;
template <class T> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
do {
detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
} while (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) );
}
};
// No body case
template<class Args>
class
lambda_functor_base<dowhileloop_no_body_action, Args> {
public:
Args args;
template <class T> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
do {} while (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) );
}
};
// The code below is from Joel de Guzman, some name changes etc.
// has been made.
///////////////////////////////////////////////////////////////////////////////
//
// while_composite
//
// This composite has the form:
//
// while_(condition)
// [
// statement
// ]
//
// While the condition (an lambda_functor) evaluates to true, statement
// (another lambda_functor) is executed. The result type of this is void.
// Note the trailing underscore after while_.
//
///////////////////////////////////////////////////////////////////////////////
template <typename CondT, typename DoT>
struct while_composite {
typedef while_composite<CondT, DoT> self_t;
template <class SigArgs>
struct sig { typedef void type; };
while_composite(CondT const& cond_, DoT const& do__)
: cond(cond_), do_(do__) {}
template <class Ret, CALL_TEMPLATE_ARGS>
Ret call(CALL_FORMAL_ARGS) const
{
while (cond.internal_call(CALL_ACTUAL_ARGS))
do_.internal_call(CALL_ACTUAL_ARGS);
}
CondT cond;
DoT do_;
};
//////////////////////////////////
template <typename CondT>
struct while_gen {
while_gen(CondT const& cond_)
: cond(cond_) {}
template <typename DoT>
lambda_functor<while_composite<
typename as_lambda_functor<CondT>::type,
typename as_lambda_functor<DoT>::type> >
operator[](DoT const& do_) const
{
typedef while_composite<
typename as_lambda_functor<CondT>::type,
typename as_lambda_functor<DoT>::type>
result;
return result(
to_lambda_functor(cond),
to_lambda_functor(do_));
}
CondT cond;
};
//////////////////////////////////
template <typename CondT>
inline while_gen<CondT>
while_(CondT const& cond)
{
return while_gen<CondT>(cond);
}
///////////////////////////////////////////////////////////////////////////////
//
// do_composite
//
// This composite has the form:
//
// do_
// [
// statement
// ]
// .while_(condition)
//
// While the condition (an lambda_functor) evaluates to true, statement
// (another lambda_functor) is executed. The statement is executed at least
// once. The result type of this is void. Note the trailing
// underscore after do_ and the the leading dot and the trailing
// underscore before and after .while_.
//
///////////////////////////////////////////////////////////////////////////////
template <typename DoT, typename CondT>
struct do_composite {
typedef do_composite<DoT, CondT> self_t;
template <class SigArgs>
struct sig { typedef void type; };
do_composite(DoT const& do__, CondT const& cond_)
: do_(do__), cond(cond_) {}
template <class Ret, CALL_TEMPLATE_ARGS>
Ret call(CALL_FORMAL_ARGS) const
{
do
do_.internal_call(CALL_ACTUAL_ARGS);
while (cond.internal_call(CALL_ACTUAL_ARGS));
}
DoT do_;
CondT cond;
};
////////////////////////////////////
template <typename DoT>
struct do_gen2 {
do_gen2(DoT const& do__)
: do_(do__) {}
template <typename CondT>
lambda_functor<do_composite<
typename as_lambda_functor<DoT>::type,
typename as_lambda_functor<CondT>::type> >
while_(CondT const& cond) const
{
typedef do_composite<
typename as_lambda_functor<DoT>::type,
typename as_lambda_functor<CondT>::type>
result;
return result(
to_lambda_functor(do_),
to_lambda_functor(cond));
}
DoT do_;
};
////////////////////////////////////
struct do_gen {
template <typename DoT>
do_gen2<DoT>
operator[](DoT const& do_) const
{
return do_gen2<DoT>(do_);
}
};
do_gen const do_ = do_gen();
///////////////////////////////////////////////////////////////////////////////
//
// for_composite
//
// This statement has the form:
//
// for_(init, condition, step)
// [
// statement
// ]
//
// Where init, condition, step and statement are all lambda_functors. init
// is executed once before entering the for-loop. The for-loop
// exits once condition evaluates to false. At each loop iteration,
// step and statement is called. The result of this statement is
// void. Note the trailing underscore after for_.
//
///////////////////////////////////////////////////////////////////////////////
template <typename InitT, typename CondT, typename StepT, typename DoT>
struct for_composite {
template <class SigArgs>
struct sig { typedef void type; };
for_composite(
InitT const& init_,
CondT const& cond_,
StepT const& step_,
DoT const& do__)
: init(init_), cond(cond_), step(step_), do_(do__) {}
template <class Ret, CALL_TEMPLATE_ARGS>
Ret
call(CALL_FORMAL_ARGS) const
{
for (init.internal_call(CALL_ACTUAL_ARGS); cond.internal_call(CALL_ACTUAL_ARGS); step.internal_call(CALL_ACTUAL_ARGS))
do_.internal_call(CALL_ACTUAL_ARGS);
}
InitT init; CondT cond; StepT step; DoT do_; // lambda_functors
};
//////////////////////////////////
template <typename InitT, typename CondT, typename StepT>
struct for_gen {
for_gen(
InitT const& init_,
CondT const& cond_,
StepT const& step_)
: init(init_), cond(cond_), step(step_) {}
template <typename DoT>
lambda_functor<for_composite<
typename as_lambda_functor<InitT>::type,
typename as_lambda_functor<CondT>::type,
typename as_lambda_functor<StepT>::type,
typename as_lambda_functor<DoT>::type> >
operator[](DoT const& do_) const
{
typedef for_composite<
typename as_lambda_functor<InitT>::type,
typename as_lambda_functor<CondT>::type,
typename as_lambda_functor<StepT>::type,
typename as_lambda_functor<DoT>::type>
result;
return result(
to_lambda_functor(init),
to_lambda_functor(cond),
to_lambda_functor(step),
to_lambda_functor(do_));
}
InitT init; CondT cond; StepT step;
};
//////////////////////////////////
template <typename InitT, typename CondT, typename StepT>
inline for_gen<InitT, CondT, StepT>
for_(InitT const& init, CondT const& cond, StepT const& step)
{
return for_gen<InitT, CondT, StepT>(init, cond, step);
}
} // lambda
} // boost
#endif // BOOST_LAMBDA_LOOPS_HPP

View File

@@ -0,0 +1,119 @@
// -- numeric.hpp -- Boost Lambda Library -----------------------------------
// Copyright (C) 2002 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2002 Gary Powell (gwpowell@hotmail.com)
//
// Distributed under 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)
//
// For more information, see http://www.boost.org
#ifndef BOOST_LAMBDA_NUMERIC_HPP
#define BOOST_LAMBDA_NUMERIC_HPP
#include "boost/lambda/core.hpp"
#include <numeric>
namespace boost {
namespace lambda {
namespace ll {
// accumulate ---------------------------------
struct accumulate {
template <class Args>
struct sig {
typedef typename boost::remove_const<
typename boost::tuples::element<3, Args>::type
>::type type;
};
template <class A, class B, class C>
C
operator()(A a, B b, C c) const
{ return ::std::accumulate(a, b, c); }
template <class A, class B, class C, class D>
C
operator()(A a, B b, C c, D d) const
{ return ::std::accumulate(a, b, c, d); }
};
// inner_product ---------------------------------
struct inner_product {
template <class Args>
struct sig {
typedef typename boost::remove_const<
typename boost::tuples::element<4, Args>::type
>::type type;
};
template <class A, class B, class C, class D>
D
operator()(A a, B b, C c, D d) const
{ return ::std::inner_product(a, b, c, d); }
template <class A, class B, class C, class D, class E, class F>
D
operator()(A a, B b, C c, D d, E e, F f) const
{ return ::std::inner_product(a, b, c, d, e, f); }
};
// partial_sum ---------------------------------
struct partial_sum {
template <class Args>
struct sig {
typedef typename boost::remove_const<
typename boost::tuples::element<3, Args>::type
>::type type;
};
template <class A, class B, class C>
C
operator()(A a, B b, C c) const
{ return ::std::partial_sum(a, b, c); }
template <class A, class B, class C, class D>
C
operator()(A a, B b, C c, D d) const
{ return ::std::partial_sum(a, b, c, d); }
};
// adjacent_difference ---------------------------------
struct adjacent_difference {
template <class Args>
struct sig {
typedef typename boost::remove_const<
typename boost::tuples::element<3, Args>::type
>::type type;
};
template <class A, class B, class C>
C
operator()(A a, B b, C c) const
{ return ::std::adjacent_difference(a, b, c); }
template <class A, class B, class C, class D>
C
operator()(A a, B b, C c, D d) const
{ return ::std::adjacent_difference(a, b, c, d); }
};
} // end of ll namespace
} // end of lambda namespace
} // end of boost namespace
#endif

View File

@@ -0,0 +1,502 @@
// Boost Lambda Library -- switch.hpp -----------------------------------
//
// Copyright (C) 2000 Gary Powell (powellg@amazon.com)
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// --------------------------------------------------------------------------
#if !defined(BOOST_LAMBDA_SWITCH_HPP)
#define BOOST_LAMBDA_SWITCH_HPP
#include "boost/lambda/core.hpp"
#include "boost/lambda/detail/control_constructs_common.hpp"
#include "boost/preprocessor/enum_shifted_params.hpp"
#include "boost/preprocessor/repeat_2nd.hpp"
#include "boost/preprocessor/tuple.hpp"
namespace boost {
namespace lambda {
// Switch actions
template <int N, class Switch1 = null_type, class Switch2 = null_type,
class Switch3 = null_type, class Switch4 = null_type,
class Switch5 = null_type, class Switch6 = null_type,
class Switch7 = null_type, class Switch8 = null_type,
class Switch9 = null_type>
struct switch_action {};
namespace detail {
// templates to represent special lambda functors for the cases in
// switch statements
template <int Value> struct case_label {};
struct default_label {};
template<class Type> struct switch_case_tag {};
// a normal case is represented as:
// tagged_lambda_functor<switch_case_tag<case_label<N> > >, LambdaFunctor>
// the default case as:
// tagged_lambda_functor<switch_case_tag<default_label> >, LambdaFunctor>
} // end detail
/// create switch_case_tag tagged_lambda_functors
template <int CaseValue, class Arg>
inline const
tagged_lambda_functor<
detail::switch_case_tag<detail::case_label<CaseValue> >,
lambda_functor<Arg>
>
case_statement(const lambda_functor<Arg>& a) {
return
tagged_lambda_functor<
detail::switch_case_tag<detail::case_label<CaseValue> >,
lambda_functor<Arg>
>(a);
}
// No case body case.
template <int CaseValue>
inline const
tagged_lambda_functor<
detail::switch_case_tag<detail::case_label<CaseValue> >,
lambda_functor<
lambda_functor_base<
do_nothing_action,
null_type
>
>
>
case_statement() {
return
tagged_lambda_functor<
detail::switch_case_tag<detail::case_label<CaseValue> >,
lambda_functor<
lambda_functor_base<
do_nothing_action,
null_type
>
>
> () ;
}
// default label
template <class Arg>
inline const
tagged_lambda_functor<
detail::switch_case_tag<detail::default_label>,
lambda_functor<Arg>
>
default_statement(const lambda_functor<Arg>& a) {
return
tagged_lambda_functor<
detail::switch_case_tag<detail::default_label>,
lambda_functor<Arg>
>(a);
}
// default lable, no case body case.
inline const
tagged_lambda_functor<
detail::switch_case_tag<detail::default_label>,
lambda_functor<
lambda_functor_base<
do_nothing_action,
null_type
>
>
>
default_statement() {
return
lambda_functor_base<
do_nothing_action,
null_type
> () ;
}
// Specializations for lambda_functor_base of case_statement -----------------
// 0 case type:
// useless (just the condition part) but provided for completeness.
template<class Args>
class
lambda_functor_base<
switch_action<1>,
Args
>
{
public:
Args args;
template <class SigArgs> struct sig { typedef void type; };
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
detail::select(::boost::tuples::get<1>(args), CALL_ACTUAL_ARGS);
}
};
// 1 case type:
// template<class Args, int Case1>
// class
// lambda_functor_base<
// action<
// 2,
// return_void_action<switch_action<detail::case_label<Case1> > >
// >,
// Args
// >
// {
// Args args;
// public:
// explicit lambda_functor_base(const Args& a) : args(a) {}
// template<class RET, class A, class B, class C>
// RET call(A& a, B& b, C& c) const {
// switch( detail::select(::boost::tuples::get<0>(args), a, b, c) )
// {
// case Case1:
// detail::select(::boost::tuples::get<1>(args), a, b, c);
// break;
// }
// }
// };
// switch with default being the sole label - doesn't make much sense but
// it is there for completeness
// template<class Args>
// class
// lambda_functor_base<
// action<
// 2,
// return_void_action<switch_action<detail::default_label> >
// >,
// Args
// >
// {
// Args args;
// public:
// explicit lambda_functor_base(const Args& a) : args(a) {}
//
// template<class RET, class A, class B, class C>
// RET call(A& a, B& b, C& c) const {
// switch( detail::select(::boost::tuples::get<0>(args), a, b, c) )
// {
// default:
// detail::select(::boost::tuples::get<1>(args), a, b, c);
// break;
// }
// }
// };
// // 2 case type:
// The different specializations are generated with Vesa Karvonen's
// preprocessor library.
// This is just a comment to show what the generated classes look like
// template<class Args, int Case1, int Case2>
// class
// lambda_functor_base<
// action<3,
// return_void_action<
// switch_action<
// detail::case_label<Case1>,
// detail::case_label<Case2>
// >
// >
// >,
// Args
// >
// {
// Args args;
// public:
// explicit lambda_functor_base(const Args& a) : args(a) {}
// template<class RET, class A, class B, class C>
// RET call(A& a, B& b, C& c) const {
// switch( detail::select(::boost::tuples::get<0>(args), a, b, c) )
// {
// case Case1:
// detail::select(::boost::tuples::get<1>(args), a, b, c);
// break;
// case Case2:
// detail::select(::boost::tuples::get<2>(args), a, b, c);
// break;
// }
// }
// };
// template<class Args, int Case1>
// class
// lambda_functor_base<
// action<3,
// return_void_action<
// switch_action<
// detail::case_label<Case1>,
// detail::default_label
// >
// >
// >,
// Args
// >
// {
// Args args;
// public:
// explicit lambda_functor_base(const Args& a) : args(a) {}
// template<class RET, class A, class B, class C>
// RET call(A& a, B& b, C& c) const {
// switch( detail::select(::boost::tuples::get<0>(args), a, b, c) )
// {
// case Case1:
// detail::select(::boost::tuples::get<1>(args), a, b, c);
// break;
// default:
// detail::select(::boost::tuples::get<2>(args), a, b, c);
// break;
// }
// }
// };
// -------------------------
// Some helper preprocessor macros ---------------------------------
// BOOST_LAMBDA_A_I_LIST(N, X) is a list of form X0, X1, ..., XN
// BOOST_LAMBDA_A_I_B_LIST(N, X, Y) is a list of form X0 Y, X1 Y, ..., XN Y
#define BOOST_LAMBDA_A_I(z, i, A) \
BOOST_PP_COMMA_IF(i) BOOST_PP_CAT(A,i)
#define BOOST_LAMBDA_A_I_B(z, i, T) \
BOOST_PP_COMMA_IF(i) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,0,T),i) BOOST_PP_TUPLE_ELEM(2,1,T)
#define BOOST_LAMBDA_A_I_LIST(i, A) \
BOOST_PP_REPEAT(i,BOOST_LAMBDA_A_I, A)
#define BOOST_LAMBDA_A_I_B_LIST(i, A, B) \
BOOST_PP_REPEAT(i,BOOST_LAMBDA_A_I_B, (A,B))
// Switch related macros -------------------------------------------
#define BOOST_LAMBDA_SWITCH_CASE_BLOCK(z, N, A) \
case Case##N: \
detail::select(::boost::tuples::get<BOOST_PP_INC(N)>(args), CALL_ACTUAL_ARGS); \
break;
#define BOOST_LAMBDA_SWITCH_CASE_BLOCK_LIST(N) \
BOOST_PP_REPEAT(N, BOOST_LAMBDA_SWITCH_CASE_BLOCK, FOO)
// 2 case type:
#define BOOST_LAMBDA_SWITCH_NO_DEFAULT_CASE(N) \
template<class Args, BOOST_LAMBDA_A_I_LIST(N, int Case)> \
class \
lambda_functor_base< \
switch_action<BOOST_PP_INC(N), \
BOOST_LAMBDA_A_I_B_LIST(N, detail::case_label<Case,>) \
>, \
Args \
> \
{ \
public: \
Args args; \
template <class SigArgs> struct sig { typedef void type; }; \
public: \
explicit lambda_functor_base(const Args& a) : args(a) {} \
\
template<class RET, CALL_TEMPLATE_ARGS> \
RET call(CALL_FORMAL_ARGS) const { \
switch( detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) ) \
{ \
BOOST_LAMBDA_SWITCH_CASE_BLOCK_LIST(N) \
} \
} \
};
#define BOOST_LAMBDA_SWITCH_WITH_DEFAULT_CASE(N) \
template< \
class Args BOOST_PP_COMMA_IF(BOOST_PP_DEC(N)) \
BOOST_LAMBDA_A_I_LIST(BOOST_PP_DEC(N), int Case) \
> \
class \
lambda_functor_base< \
switch_action<BOOST_PP_INC(N), \
BOOST_LAMBDA_A_I_B_LIST(BOOST_PP_DEC(N), \
detail::case_label<Case, >) \
BOOST_PP_COMMA_IF(BOOST_PP_DEC(N)) \
detail::default_label \
>, \
Args \
> \
{ \
public: \
Args args; \
template <class SigArgs> struct sig { typedef void type; }; \
public: \
explicit lambda_functor_base(const Args& a) : args(a) {} \
\
template<class RET, CALL_TEMPLATE_ARGS> \
RET call(CALL_FORMAL_ARGS) const { \
switch( detail::select(::boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) ) \
{ \
BOOST_LAMBDA_SWITCH_CASE_BLOCK_LIST(BOOST_PP_DEC(N)) \
default: \
detail::select(::boost::tuples::get<N>(args), CALL_ACTUAL_ARGS); \
break; \
} \
} \
};
// switch_statement bind functions -------------------------------------
// The zero argument case, for completeness sake
inline const
lambda_functor<
lambda_functor_base<
do_nothing_action,
null_type
>
>
switch_statement() {
return
lambda_functor_base<
do_nothing_action,
null_type
>
();
}
// 1 argument case, this is useless as well, just the condition part
template <class TestArg>
inline const
lambda_functor<
lambda_functor_base<
switch_action<1>,
tuple<lambda_functor<TestArg> >
>
>
switch_statement(const lambda_functor<TestArg>& a1) {
return
lambda_functor_base<
switch_action<1>,
tuple< lambda_functor<TestArg> >
>
( tuple<lambda_functor<TestArg> >(a1));
}
#define HELPER(z, N, FOO) \
BOOST_PP_COMMA_IF(N) \
BOOST_PP_CAT( \
const tagged_lambda_functor<detail::switch_case_tag<TagData, \
N>) \
BOOST_PP_COMMA() Arg##N>& a##N
#define HELPER_LIST(N) BOOST_PP_REPEAT(N, HELPER, FOO)
#define BOOST_LAMBDA_SWITCH_STATEMENT(N) \
template <class TestArg, \
BOOST_LAMBDA_A_I_LIST(N, class TagData), \
BOOST_LAMBDA_A_I_LIST(N, class Arg)> \
inline const \
lambda_functor< \
lambda_functor_base< \
switch_action<BOOST_PP_INC(N), \
BOOST_LAMBDA_A_I_LIST(N, TagData) \
>, \
tuple<lambda_functor<TestArg>, BOOST_LAMBDA_A_I_LIST(N, Arg)> \
> \
> \
switch_statement( \
const lambda_functor<TestArg>& ta, \
HELPER_LIST(N) \
) \
{ \
return \
lambda_functor_base< \
switch_action<BOOST_PP_INC(N), \
BOOST_LAMBDA_A_I_LIST(N, TagData) \
>, \
tuple<lambda_functor<TestArg>, BOOST_LAMBDA_A_I_LIST(N, Arg)> \
> \
( tuple<lambda_functor<TestArg>, BOOST_LAMBDA_A_I_LIST(N, Arg)> \
(ta, BOOST_LAMBDA_A_I_LIST(N, a) )); \
}
// Here's the actual generation
#define BOOST_LAMBDA_SWITCH(N) \
BOOST_LAMBDA_SWITCH_NO_DEFAULT_CASE(N) \
BOOST_LAMBDA_SWITCH_WITH_DEFAULT_CASE(N)
// Use this to avoid case 0, these macros work only from case 1 upwards
#define BOOST_LAMBDA_SWITCH_HELPER(z, N, A) \
BOOST_LAMBDA_SWITCH( BOOST_PP_INC(N) )
// Use this to avoid cases 0 and 1, these macros work only from case 2 upwards
#define BOOST_LAMBDA_SWITCH_STATEMENT_HELPER(z, N, A) \
BOOST_LAMBDA_SWITCH_STATEMENT(BOOST_PP_INC(N))
// up to 9 cases supported (counting default:)
BOOST_PP_REPEAT_2ND(9,BOOST_LAMBDA_SWITCH_HELPER,FOO)
BOOST_PP_REPEAT_2ND(9,BOOST_LAMBDA_SWITCH_STATEMENT_HELPER,FOO)
} // namespace lambda
} // namespace boost
#undef HELPER
#undef HELPER_LIST
#undef BOOST_LAMBDA_SWITCH_HELPER
#undef BOOST_LAMBDA_SWITCH
#undef BOOST_LAMBDA_SWITCH_NO_DEFAULT_CASE
#undef BOOST_LAMBDA_SWITCH_WITH_DEFAULT_CASE
#undef BOOST_LAMBDA_SWITCH_CASE_BLOCK
#undef BOOST_LAMBDA_SWITCH_CASE_BLOCK_LIST
#undef BOOST_LAMBDA_SWITCH_STATEMENT
#undef BOOST_LAMBDA_SWITCH_STATEMENT_HELPER
#endif

12
index.html Normal file
View File

@@ -0,0 +1,12 @@
<html>
<head>
<meta http-equiv="refresh" content="0; URL=../../doc/html/lambda.html">
</head>
<body>
Automatic redirection failed, please go to <a href="../../doc/html/lambda.html">www.boost.org/doc/html/lambda.html</a>&nbsp;<hr>
<p>© Copyright Beman Dawes, 2001</p>
<p>Distributed under the Boost Software License, Version 1.0. (See accompanying
file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy
at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
</body>
</html>

33
test/Jamfile Normal file
View File

@@ -0,0 +1,33 @@
# Lambda library
# Copyright (C) 2001-2003 Jaakko Järvi
# 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)
# For more information, see http://www.boost.org/
import testing ;
project
: requirements <library>/boost/test//boost_test_exec_monitor
;
test-suite lambda
: [ run algorithm_test.cpp ]
[ run bind_tests_simple.cpp ]
[ run bind_tests_advanced.cpp ]
[ run bind_tests_simple_f_refs.cpp ]
[ run bll_and_function.cpp ]
[ run cast_test.cpp : : : : lambda_cast_test ]
[ run constructor_tests.cpp ]
[ run control_structures.cpp ]
[ run exception_test.cpp ]
[ run extending_rt_traits.cpp ]
[ run is_instance_of_test.cpp ]
[ run member_pointer_test.cpp ]
[ run operator_tests_simple.cpp ]
[ run phoenix_control_structures.cpp ]
[ run switch_construct.cpp ]
;

89
test/Makefile Executable file
View File

@@ -0,0 +1,89 @@
BOOST = ../../..
CXX = g++
EXTRAFLAGS = -pedantic -Wno-long-long -Wno-long-double -ftemplate-depth-50
LIBS = -lstdc++
#CXX = KCC
#EXTRAFLAGS = --strict --display_error_number --diag_suppress 450 --max_pending_instantiations 50
#LIBS =
INCLUDES = -I$(BOOST)
CXXFLAGS = $(INCLUDES) $(EXTRAFLAGS)
LIBFLAGS = $(LIBS)
AR = ar
.SUFFIXES: .cpp .o
SOURCES = \
is_instance_of_test.cpp \
operator_tests_simple.cpp \
member_pointer_test.cpp \
control_structures.cpp \
switch_construct.cpp \
bind_tests_simple.cpp \
bind_tests_advanced.cpp \
bll_and_function.cpp \
constructor_tests.cpp \
extending_rt_traits.cpp \
bind_tests_simple_f_refs.cpp \
cast_test.cpp \
phoenix_control_structures.cpp \
exception_test.cpp \
# Create lists of object files from the source file lists.
OBJECTS = ${SOURCES:.cpp=.o}
TARGETS = ${SOURCES:.cpp=.exe}
all: $(TARGETS)
%.exe: %.o
$(CXX) $(LIBFLAGS) $(CXXFLAGS) -o $@ $<
%.o: %.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $<
%.dep: %.cpp
set -e; $(CXX) -M $(INCLUDES) -c $< \
| sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
[ -s $@ ] || rm -f $@
DEP_FILES = $(SOURCES:.cpp=.dep)
include $(DEP_FILES)
clean:
/bin/rm -rf $(TARGETS) $(OBJECTS) $(DEP_FILES)
run:
./is_instance_of_test.exe
./member_pointer_test.exe
./operator_tests_simple.exe
./control_structures.exe
./switch_construct.exe
./extending_rt_traits.exe
./constructor_tests.exe
./cast_test.exe
./bind_tests_simple.exe
./bind_tests_advanced.exe
./bll_and_function.exe
./bind_tests_simple_f_refs.exe
./phoenix_control_structures.exe
./exception_test.exe

View File

@@ -0,0 +1,6 @@
gcc 2.96
cannot compile
exception_test.cpp (internal compiler error)

60
test/algorithm_test.cpp Normal file
View File

@@ -0,0 +1,60 @@
// bll_and_function.cpp - The Boost Lambda Library -----------------------
//
// Copyright (C) 2000-2003 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000-2003 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// test using BLL and boost::function
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
#include "boost/lambda/algorithm.hpp"
#include <vector>
#include <map>
#include <set>
#include <string>
#include <iostream>
void test_foreach() {
using namespace boost::lambda;
int a[10][20];
int sum = 0;
std::for_each(a, a + 10,
bind(ll::for_each(), _1, _1 + 20,
protect((_1 = var(sum), ++var(sum)))));
sum = 0;
std::for_each(a, a + 10,
bind(ll::for_each(), _1, _1 + 20,
protect((sum += _1))));
BOOST_CHECK(sum == (199 + 1)/ 2 * 199);
}
// More tests needed (for all algorithms)
int test_main(int, char *[]) {
test_foreach();
return 0;
}

View File

@@ -0,0 +1,376 @@
// bind_tests_advanced.cpp -- The Boost Lambda Library ------------------
//
// Copyright (C) 2000-2003 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000-2003 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
#include "boost/any.hpp"
#include <iostream>
#include <functional>
#include <algorithm>
using namespace boost::lambda;
int sum_0() { return 0; }
int sum_1(int a) { return a; }
int sum_2(int a, int b) { return a+b; }
int product_2(int a, int b) { return a*b; }
// unary function that returns a pointer to a binary function
typedef int (*fptr_type)(int, int);
fptr_type sum_or_product(bool x) {
return x ? sum_2 : product_2;
}
// a nullary functor that returns a pointer to a unary function that
// returns a pointer to a binary function.
struct which_one {
typedef fptr_type (*result_type)(bool x);
template <class T> struct sig { typedef result_type type; };
result_type operator()() const { return sum_or_product; }
};
void test_nested_binds()
{
int j = 2; int k = 3;
// bind calls can be nested (the target function can be a lambda functor)
// The interpretation is, that the innermost lambda functor returns something
// that is bindable (another lambda functor, function pointer ...)
bool condition;
condition = true;
BOOST_CHECK(bind(bind(&sum_or_product, _1), 1, 2)(condition)==3);
BOOST_CHECK(bind(bind(&sum_or_product, _1), _2, _3)(condition, j, k)==5);
condition = false;
BOOST_CHECK(bind(bind(&sum_or_product, _1), 1, 2)(condition)==2);
BOOST_CHECK(bind(bind(&sum_or_product, _1), _2, _3)(condition, j, k)==6);
which_one wo;
BOOST_CHECK(bind(bind(bind(wo), _1), _2, _3)(condition, j, k)==6);
return;
}
// unlambda -------------------------------------------------
// Sometimes it may be necessary to prevent the argument substitution of
// taking place. For example, we may end up with a nested bind expression
// inadvertently when using the target function is received as a parameter
template<class F>
int call_with_100(const F& f) {
// bind(f, _1)(make_const(100));
// This would result in;
// bind(_1 + 1, _1)(make_const(100)) , which would be a compile time error
return bind(unlambda(f), _1)(make_const(100));
// for other functors than lambda functors, unlambda has no effect
// (except for making them const)
}
template<class F>
int call_with_101(const F& f) {
return bind(unlambda(f), _1)(make_const(101));
}
void test_unlambda() {
int i = 1;
BOOST_CHECK(unlambda(_1 + _2)(i, i) == 2);
BOOST_CHECK(unlambda(++var(i))() == 2);
BOOST_CHECK(call_with_100(_1 + 1) == 101);
BOOST_CHECK(call_with_101(_1 + 1) == 102);
BOOST_CHECK(call_with_100(bind(std_functor(std::bind1st(std::plus<int>(), 1)), _1)) == 101);
// std_functor insturcts LL that the functor defines a result_type typedef
// rather than a sig template.
bind(std_functor(std::plus<int>()), _1, _2)(i, i);
}
// protect ------------------------------------------------------------
// protect protects a lambda functor from argument substitution.
// protect is useful e.g. with nested stl algorithm calls.
namespace ll {
struct for_each {
// note, std::for_each returns it's last argument
// We want the same behaviour from our ll::for_each.
// However, the functor can be called with any arguments, and
// the return type thus depends on the argument types.
// 1. Provide a sig class member template:
// The return type deduction system instantiate this class as:
// sig<Args>::type, where Args is a boost::tuples::cons-list
// The head type is the function object type itself
// cv-qualified (so it is possilbe to provide different return types
// for differently cv-qualified operator()'s.
// The tail type is the list of the types of the actual arguments the
// function was called with.
// So sig should contain a typedef type, which defines a mapping from
// the operator() arguments to its return type.
// Note, that it is possible to provide different sigs for the same functor
// if the functor has several operator()'s, even if they have different
// number of arguments.
// Note, that the argument types in Args are guaranteed to be non-reference
// types, but they can have cv-qualifiers.
template <class Args>
struct sig {
typedef typename boost::remove_const<
typename boost::tuples::element<3, Args>::type
>::type type;
};
template <class A, class B, class C>
C
operator()(const A& a, const B& b, const C& c) const
{ return std::for_each(a, b, c);}
};
} // end of ll namespace
void test_protect()
{
int i = 0;
int b[3][5];
int* a[3];
for(int j=0; j<3; ++j) a[j] = b[j];
std::for_each(a, a+3,
bind(ll::for_each(), _1, _1 + 5, protect(_1 = ++var(i))));
// This is how you could output the values (it is uncommented, no output
// from a regression test file):
// std::for_each(a, a+3,
// bind(ll::for_each(), _1, _1 + 5,
// std::cout << constant("\nLine ") << (&_1 - a) << " : "
// << protect(_1)
// )
// );
int sum = 0;
std::for_each(a, a+3,
bind(ll::for_each(), _1, _1 + 5,
protect(sum += _1))
);
BOOST_CHECK(sum == (1+15)*15/2);
sum = 0;
std::for_each(a, a+3,
bind(ll::for_each(), _1, _1 + 5,
sum += 1 + protect(_1)) // add element count
);
BOOST_CHECK(sum == (1+15)*15/2 + 15);
(1 + protect(_1))(sum);
int k = 0;
((k += constant(1)) += protect(constant(2)))();
BOOST_CHECK(k==1);
k = 0;
((k += constant(1)) += protect(constant(2)))()();
BOOST_CHECK(k==3);
// note, the following doesn't work:
// ((var(k) = constant(1)) = protect(constant(2)))();
// (var(k) = constant(1))() returns int& and thus the
// second assignment fails.
// We should have something like:
// bind(var, var(k) = constant(1)) = protect(constant(2)))();
// But currently var is not bindable.
// The same goes with ret. A bindable ret could be handy sometimes as well
// (protect(std::cout << _1), std::cout << _1)(i)(j); does not work
// because the comma operator tries to store the result of the evaluation
// of std::cout << _1 as a copy (and you can't copy std::ostream).
// something like this:
// (protect(std::cout << _1), bind(ref, std::cout << _1))(i)(j);
// the stuff below works, but we do not want extra output to
// cout, must be changed to stringstreams but stringstreams do not
// work due to a bug in the type deduction. Will be fixed...
#if 0
// But for now, ref is not bindable. There are other ways around this:
int x = 1, y = 2;
(protect(std::cout << _1), (std::cout << _1, 0))(x)(y);
// added one dummy value to make the argument to comma an int
// instead of ostream&
// Note, the same problem is more apparent without protect
// (std::cout << 1, std::cout << constant(2))(); // does not work
(boost::ref(std::cout << 1), std::cout << constant(2))(); // this does
#endif
}
void test_lambda_functors_as_arguments_to_lambda_functors() {
// lambda functor is a function object, and can therefore be used
// as an argument to another lambda functors function call object.
// Note however, that the argument/type substitution is not entered again.
// This means, that something like this will not work:
(_1 + _2)(_1, make_const(7));
(_1 + _2)(bind(&sum_0), make_const(7));
// or it does work, but the effect is not to call
// sum_0() + 7, but rather
// bind(sum_0) + 7, which results in another lambda functor
// (lambda functor + int) and can be called again
BOOST_CHECK((_1 + _2)(bind(&sum_0), make_const(7))() == 7);
int i = 3, j = 12;
BOOST_CHECK((_1 - _2)(_2, _1)(i, j) == j - i);
// also, note that lambda functor are no special case for bind if received
// as a parameter. In oder to be bindable, the functor must
// defint the sig template, or then
// the return type must be defined within the bind call. Lambda functors
// do define the sig template, so if the return type deduction system
// covers the case, there is no need to specify the return type
// explicitly.
int a = 5, b = 6;
// Let type deduction find out the return type
BOOST_CHECK(bind(_1, _2, _3)(unlambda(_1 + _2), a, b) == 11);
//specify it yourself:
BOOST_CHECK(bind(_1, _2, _3)(ret<int>(_1 + _2), a, b) == 11);
BOOST_CHECK(ret<int>(bind(_1, _2, _3))(_1 + _2, a, b) == 11);
BOOST_CHECK(bind<int>(_1, _2, _3)(_1 + _2, a, b) == 11);
bind(_1,1.0)(_1+_1);
return;
}
void test_const_parameters() {
// (_1 + _2)(1, 2); // this would fail,
// Either make arguments const:
BOOST_CHECK((_1 + _2)(make_const(1), make_const(2)) == 3);
// Or use const_parameters:
BOOST_CHECK(const_parameters(_1 + _2)(1, 2) == 3);
}
void test_rvalue_arguments()
{
// Not quite working yet.
// Problems with visual 7.1
// BOOST_CHECK((_1 + _2)(1, 2) == 3);
}
void test_break_const()
{
// break_const is currently unnecessary, as LL supports perfect forwarding
// for up to there argument lambda functors, and LL does not support
// lambda functors with more than 3 args.
// I'll keep the test case around anyway, if more arguments will be supported
// in the future.
// break_const breaks constness! Be careful!
// You need this only if you need to have side effects on some argument(s)
// and some arguments are non-const rvalues and your lambda functors
// take more than 3 arguments.
int i = 1;
// OLD COMMENT: (_1 += _2)(i, 2) // fails, 2 is a non-const rvalue
// OLD COMMENT: const_parameters(_1 += _2)(i, 2) // fails, side-effect to i
break_const(_1 += _2)(i, 2); // ok
BOOST_CHECK(i == 3);
}
int test_main(int, char *[]) {
test_nested_binds();
test_unlambda();
test_protect();
test_lambda_functors_as_arguments_to_lambda_functors();
test_const_parameters();
test_rvalue_arguments();
test_break_const();
return 0;
}

172
test/bind_tests_simple.cpp Normal file
View File

@@ -0,0 +1,172 @@
// bind_tests_simple.cpp -- The Boost Lambda Library ------------------
//
// Copyright (C) 2000-2003 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000-2003 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include "boost/lambda/bind.hpp"
#include <iostream>
using namespace std;
using namespace boost::lambda;
int sum_of_args_0() { return 0; }
int sum_of_args_1(int a) { return a; }
int sum_of_args_2(int a, int b) { return a+b; }
int sum_of_args_3(int a, int b, int c) { return a+b+c; }
int sum_of_args_4(int a, int b, int c, int d) { return a+b+c+d; }
int sum_of_args_5(int a, int b, int c, int d, int e) { return a+b+c+d+e; }
int sum_of_args_6(int a, int b, int c, int d, int e, int f) { return a+b+c+d+e+f; }
int sum_of_args_7(int a, int b, int c, int d, int e, int f, int g) { return a+b+c+d+e+f+g; }
int sum_of_args_8(int a, int b, int c, int d, int e, int f, int g, int h) { return a+b+c+d+e+f+g+h; }
int sum_of_args_9(int a, int b, int c, int d, int e, int f, int g, int h, int i) { return a+b+c+d+e+f+g+h+i; }
// ----------------------------
class A {
int i;
public:
A(int n) : i(n) {};
int add(const int& j) { return i + j; }
int add2(int a1, int a2) { return i + a1 + a2; }
int add3(int a1, int a2, int a3) { return i + a1 + a2 + a3; }
int add4(int a1, int a2, int a3, int a4) { return i + a1 + a2 + a3 + a4; }
int add5(int a1, int a2, int a3, int a4, int a5)
{ return i + a1 + a2 + a3 + a4 + a5; }
int add6(int a1, int a2, int a3, int a4, int a5, int a6)
{ return i + a1 + a2 + a3 + a4 + a5 + a6; }
int add7(int a1, int a2, int a3, int a4, int a5, int a6, int a7)
{ return i + a1 + a2 + a3 + a4 + a5 + a6 + a7; }
int add8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
{ return i + a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8; }
};
void test_member_functions()
{
using boost::ref;
A a(10);
int i = 1;
BOOST_CHECK(bind(&A::add, ref(a), _1)(i) == 11);
BOOST_CHECK(bind(&A::add, &a, _1)(i) == 11);
BOOST_CHECK(bind(&A::add, _1, 1)(a) == 11);
BOOST_CHECK(bind(&A::add, _1, 1)(make_const(&a)) == 11);
BOOST_CHECK(bind(&A::add2, _1, 1, 1)(a) == 12);
BOOST_CHECK(bind(&A::add3, _1, 1, 1, 1)(a) == 13);
BOOST_CHECK(bind(&A::add4, _1, 1, 1, 1, 1)(a) == 14);
BOOST_CHECK(bind(&A::add5, _1, 1, 1, 1, 1, 1)(a) == 15);
BOOST_CHECK(bind(&A::add6, _1, 1, 1, 1, 1, 1, 1)(a) == 16);
BOOST_CHECK(bind(&A::add7, _1, 1, 1, 1, 1, 1, 1, 1)(a) == 17);
BOOST_CHECK(bind(&A::add8, _1, 1, 1, 1, 1, 1, 1, 1, 1)(a) == 18);
// This should fail, as lambda functors store arguments as const
// bind(&A::add, a, _1);
}
int test_main(int, char *[]) {
int i = 1; int j = 2; int k = 3;
int result;
// bind all parameters
BOOST_CHECK(bind(&sum_of_args_0)()==0);
BOOST_CHECK(bind(&sum_of_args_1, 1)()==1);
BOOST_CHECK(bind(&sum_of_args_2, 1, 2)()==3);
BOOST_CHECK(bind(&sum_of_args_3, 1, 2, 3)()==6);
BOOST_CHECK(bind(&sum_of_args_4, 1, 2, 3, 4)()==10);
BOOST_CHECK(bind(&sum_of_args_5, 1, 2, 3, 4, 5)()==15);
BOOST_CHECK(bind(&sum_of_args_6, 1, 2, 3, 4, 5, 6)()==21);
BOOST_CHECK(bind(&sum_of_args_7, 1, 2, 3, 4, 5, 6, 7)()==28);
BOOST_CHECK(bind(&sum_of_args_8, 1, 2, 3, 4, 5, 6, 7, 8)()==36);
BOOST_CHECK(bind(&sum_of_args_9, 1, 2, 3, 4, 5, 6, 7, 8, 9)()==45);
// first parameter open
BOOST_CHECK(bind(&sum_of_args_0)()==0);
BOOST_CHECK(bind(&sum_of_args_1, _1)(i)==1);
BOOST_CHECK(bind(&sum_of_args_2, _1, 2)(i)==3);
BOOST_CHECK(bind(&sum_of_args_3, _1, 2, 3)(i)==6);
BOOST_CHECK(bind(&sum_of_args_4, _1, 2, 3, 4)(i)==10);
BOOST_CHECK(bind(&sum_of_args_5, _1, 2, 3, 4, 5)(i)==15);
BOOST_CHECK(bind(&sum_of_args_6, _1, 2, 3, 4, 5, 6)(i)==21);
BOOST_CHECK(bind(&sum_of_args_7, _1, 2, 3, 4, 5, 6, 7)(i)==28);
BOOST_CHECK(bind(&sum_of_args_8, _1, 2, 3, 4, 5, 6, 7, 8)(i)==36);
BOOST_CHECK(bind(&sum_of_args_9, _1, 2, 3, 4, 5, 6, 7, 8, 9)(i)==45);
// two open arguments
BOOST_CHECK(bind(&sum_of_args_0)()==0);
BOOST_CHECK(bind(&sum_of_args_1, _1)(i)==1);
BOOST_CHECK(bind(&sum_of_args_2, _1, _2)(i, j)==3);
BOOST_CHECK(bind(&sum_of_args_3, _1, _2, 3)(i, j)==6);
BOOST_CHECK(bind(&sum_of_args_4, _1, _2, 3, 4)(i, j)==10);
BOOST_CHECK(bind(&sum_of_args_5, _1, _2, 3, 4, 5)(i, j)==15);
BOOST_CHECK(bind(&sum_of_args_6, _1, _2, 3, 4, 5, 6)(i, j)==21);
BOOST_CHECK(bind(&sum_of_args_7, _1, _2, 3, 4, 5, 6, 7)(i, j)==28);
BOOST_CHECK(bind(&sum_of_args_8, _1, _2, 3, 4, 5, 6, 7, 8)(i, j)==36);
BOOST_CHECK(bind(&sum_of_args_9, _1, _2, 3, 4, 5, 6, 7, 8, 9)(i, j)==45);
// three open arguments
BOOST_CHECK(bind(&sum_of_args_0)()==0);
BOOST_CHECK(bind(&sum_of_args_1, _1)(i)==1);
BOOST_CHECK(bind(&sum_of_args_2, _1, _2)(i, j)==3);
BOOST_CHECK(bind(&sum_of_args_3, _1, _2, _3)(i, j, k)==6);
BOOST_CHECK(bind(&sum_of_args_4, _1, _2, _3, 4)(i, j, k)==10);
BOOST_CHECK(bind(&sum_of_args_5, _1, _2, _3, 4, 5)(i, j, k)==15);
BOOST_CHECK(bind(&sum_of_args_6, _1, _2, _3, 4, 5, 6)(i, j, k)==21);
BOOST_CHECK(bind(&sum_of_args_7, _1, _2, _3, 4, 5, 6, 7)(i, j, k)==28);
BOOST_CHECK(bind(&sum_of_args_8, _1, _2, _3, 4, 5, 6, 7, 8)(i, j, k)==36);
BOOST_CHECK(bind(&sum_of_args_9, _1, _2, _3, 4, 5, 6, 7, 8, 9)(i, j, k)==45);
// function compositions with bind
BOOST_CHECK(bind(&sum_of_args_3, bind(&sum_of_args_2, _1, 2), 2, 3)(i)==8);
BOOST_CHECK(
bind(&sum_of_args_9,
bind(&sum_of_args_0), // 0
bind(&sum_of_args_1, _1), // 1
bind(&sum_of_args_2, _1, _2), // 3
bind(&sum_of_args_3, _1, _2, _3), // 6
bind(&sum_of_args_4, _1, _2, _3, 4), // 10
bind(&sum_of_args_5, _1, _2, _3, 4, 5), // 15
bind(&sum_of_args_6, _1, _2, _3, 4, 5, 6), // 21
bind(&sum_of_args_7, _1, _2, _3, 4, 5, 6, 7), // 28
bind(&sum_of_args_8, _1, _2, _3, 4, 5, 6, 7, 8) // 36
)(i, j, k) == 120);
// deeper nesting
result =
bind(&sum_of_args_1, // 12
bind(&sum_of_args_4, // 12
bind(&sum_of_args_2, // 3
bind(&sum_of_args_1, // 1
bind(&sum_of_args_1, _1) // 1
),
_2),
_2,
_3,
4)
)(i, j, k);
BOOST_CHECK(result == 12);
test_member_functions();
return 0;
}

View File

@@ -0,0 +1,150 @@
// bind_tests_simple.cpp -- The Boost Lambda Library ------------------
//
// Copyright (C) 2000-2003 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000-2003 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include "boost/lambda/bind.hpp"
#include <iostream>
using namespace std;
using namespace boost::lambda;
int sum_of_args_0() { return 0; }
int sum_of_args_1(int a) { return a; }
int sum_of_args_2(int a, int b) { return a+b; }
int sum_of_args_3(int a, int b, int c) { return a+b+c; }
int sum_of_args_4(int a, int b, int c, int d) { return a+b+c+d; }
int sum_of_args_5(int a, int b, int c, int d, int e) { return a+b+c+d+e; }
int sum_of_args_6(int a, int b, int c, int d, int e, int f) { return a+b+c+d+e+f; }
int sum_of_args_7(int a, int b, int c, int d, int e, int f, int g) { return a+b+c+d+e+f+g; }
int sum_of_args_8(int a, int b, int c, int d, int e, int f, int g, int h) { return a+b+c+d+e+f+g+h; }
int sum_of_args_9(int a, int b, int c, int d, int e, int f, int g, int h, int i) { return a+b+c+d+e+f+g+h+i; }
// ----------------------------
class A {
int i;
public:
A(int n) : i(n) {};
int add(const int& j) { return i + j; }
};
void test_member_functions()
{
using boost::ref;
A a(10);
int i = 1;
BOOST_CHECK(bind(&A::add, ref(a), _1)(i) == 11);
BOOST_CHECK(bind(&A::add, &a, _1)(i) == 11);
BOOST_CHECK(bind(&A::add, _1, 1)(a) == 11);
BOOST_CHECK(bind(&A::add, _1, 1)(make_const(&a)) == 11);
// This should fail, as lambda functors store arguments as const
// bind(&A::add, a, _1);
}
int test_main(int, char *[]) {
int i = 1; int j = 2; int k = 3;
int result;
// bind all parameters
BOOST_CHECK(bind(sum_of_args_0)()==0);
BOOST_CHECK(bind(sum_of_args_1, 1)()==1);
BOOST_CHECK(bind(sum_of_args_2, 1, 2)()==3);
BOOST_CHECK(bind(sum_of_args_3, 1, 2, 3)()==6);
BOOST_CHECK(bind(sum_of_args_4, 1, 2, 3, 4)()==10);
BOOST_CHECK(bind(sum_of_args_5, 1, 2, 3, 4, 5)()==15);
BOOST_CHECK(bind(sum_of_args_6, 1, 2, 3, 4, 5, 6)()==21);
BOOST_CHECK(bind(sum_of_args_7, 1, 2, 3, 4, 5, 6, 7)()==28);
BOOST_CHECK(bind(sum_of_args_8, 1, 2, 3, 4, 5, 6, 7, 8)()==36);
BOOST_CHECK(bind(sum_of_args_9, 1, 2, 3, 4, 5, 6, 7, 8, 9)()==45);
// first parameter open
BOOST_CHECK(bind(sum_of_args_0)()==0);
BOOST_CHECK(bind(sum_of_args_1, _1)(i)==1);
BOOST_CHECK(bind(sum_of_args_2, _1, 2)(i)==3);
BOOST_CHECK(bind(sum_of_args_3, _1, 2, 3)(i)==6);
BOOST_CHECK(bind(sum_of_args_4, _1, 2, 3, 4)(i)==10);
BOOST_CHECK(bind(sum_of_args_5, _1, 2, 3, 4, 5)(i)==15);
BOOST_CHECK(bind(sum_of_args_6, _1, 2, 3, 4, 5, 6)(i)==21);
BOOST_CHECK(bind(sum_of_args_7, _1, 2, 3, 4, 5, 6, 7)(i)==28);
BOOST_CHECK(bind(sum_of_args_8, _1, 2, 3, 4, 5, 6, 7, 8)(i)==36);
BOOST_CHECK(bind(sum_of_args_9, _1, 2, 3, 4, 5, 6, 7, 8, 9)(i)==45);
// two open arguments
BOOST_CHECK(bind(sum_of_args_0)()==0);
BOOST_CHECK(bind(sum_of_args_1, _1)(i)==1);
BOOST_CHECK(bind(sum_of_args_2, _1, _2)(i, j)==3);
BOOST_CHECK(bind(sum_of_args_3, _1, _2, 3)(i, j)==6);
BOOST_CHECK(bind(sum_of_args_4, _1, _2, 3, 4)(i, j)==10);
BOOST_CHECK(bind(sum_of_args_5, _1, _2, 3, 4, 5)(i, j)==15);
BOOST_CHECK(bind(sum_of_args_6, _1, _2, 3, 4, 5, 6)(i, j)==21);
BOOST_CHECK(bind(sum_of_args_7, _1, _2, 3, 4, 5, 6, 7)(i, j)==28);
BOOST_CHECK(bind(sum_of_args_8, _1, _2, 3, 4, 5, 6, 7, 8)(i, j)==36);
BOOST_CHECK(bind(sum_of_args_9, _1, _2, 3, 4, 5, 6, 7, 8, 9)(i, j)==45);
// three open arguments
BOOST_CHECK(bind(sum_of_args_0)()==0);
BOOST_CHECK(bind(sum_of_args_1, _1)(i)==1);
BOOST_CHECK(bind(sum_of_args_2, _1, _2)(i, j)==3);
BOOST_CHECK(bind(sum_of_args_3, _1, _2, _3)(i, j, k)==6);
BOOST_CHECK(bind(sum_of_args_4, _1, _2, _3, 4)(i, j, k)==10);
BOOST_CHECK(bind(sum_of_args_5, _1, _2, _3, 4, 5)(i, j, k)==15);
BOOST_CHECK(bind(sum_of_args_6, _1, _2, _3, 4, 5, 6)(i, j, k)==21);
BOOST_CHECK(bind(sum_of_args_7, _1, _2, _3, 4, 5, 6, 7)(i, j, k)==28);
BOOST_CHECK(bind(sum_of_args_8, _1, _2, _3, 4, 5, 6, 7, 8)(i, j, k)==36);
BOOST_CHECK(bind(sum_of_args_9, _1, _2, _3, 4, 5, 6, 7, 8, 9)(i, j, k)==45);
// function compositions with bind
BOOST_CHECK(bind(sum_of_args_3, bind(sum_of_args_2, _1, 2), 2, 3)(i)==8);
BOOST_CHECK(
bind(sum_of_args_9,
bind(sum_of_args_0), // 0
bind(sum_of_args_1, _1), // 1
bind(sum_of_args_2, _1, _2), // 3
bind(sum_of_args_3, _1, _2, _3), // 6
bind(sum_of_args_4, _1, _2, _3, 4), // 10
bind(sum_of_args_5, _1, _2, _3, 4, 5), // 15
bind(sum_of_args_6, _1, _2, _3, 4, 5, 6), // 21
bind(sum_of_args_7, _1, _2, _3, 4, 5, 6, 7), // 28
bind(sum_of_args_8, _1, _2, _3, 4, 5, 6, 7, 8) // 36
)(i, j, k) == 120);
// deeper nesting
result =
bind(sum_of_args_1, // 12
bind(sum_of_args_4, // 12
bind(sum_of_args_2, // 3
bind(sum_of_args_1, // 1
bind(sum_of_args_1, _1) // 1
),
_2),
_2,
_3,
4)
)(i, j, k);
BOOST_CHECK(result == 12);
test_member_functions();
return 0;
}

68
test/bll_and_function.cpp Normal file
View File

@@ -0,0 +1,68 @@
// bll_and_function.cpp - The Boost Lambda Library -----------------------
//
// Copyright (C) 2000-2003 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000-2003 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// test using BLL and boost::function
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include "boost/lambda/lambda.hpp"
#include "boost/function.hpp"
#include <vector>
#include <map>
#include <set>
#include <string>
using namespace boost::lambda;
using namespace std;
void test_function() {
boost::function<int (int, int)> f;
f = _1 + _2;
BOOST_CHECK(f(1, 2)== 3);
int i=1; int j=2;
boost::function<int& (int&, int)> g = _1 += _2;
g(i, j);
BOOST_CHECK(i==3);
int* sum = new int();
*sum = 0;
boost::function<int& (int)> counter = *sum += _1;
counter(5); // ok, sum* = 5;
BOOST_CHECK(*sum == 5);
delete sum;
// The next statement would lead to a dangling reference
// counter(3); // error, *sum does not exist anymore
}
int test_main(int, char *[]) {
test_function();
return 0;
}

107
test/cast_test.cpp Normal file
View File

@@ -0,0 +1,107 @@
// cast_tests.cpp -- The Boost Lambda Library ------------------
//
// Copyright (C) 2000-2003 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000-2003 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/casts.hpp"
#include <string>
using namespace boost::lambda;
using namespace std;
class base {
int x;
public:
virtual std::string class_name() const { return "const base"; }
virtual std::string class_name() { return "base"; }
};
class derived : public base {
int y[100];
public:
virtual std::string class_name() const { return "const derived"; }
virtual std::string class_name() { return "derived"; }
};
void do_test() {
derived *p_derived = new derived;
base *p_base = new base;
base *b = 0;
derived *d = 0;
(var(b) = ll_static_cast<base *>(p_derived))();
(var(d) = ll_static_cast<derived *>(b))();
BOOST_CHECK(b->class_name() == "derived");
BOOST_CHECK(d->class_name() == "derived");
(var(b) = ll_dynamic_cast<derived *>(b))();
BOOST_CHECK(b != 0);
BOOST_CHECK(b->class_name() == "derived");
(var(d) = ll_dynamic_cast<derived *>(p_base))();
BOOST_CHECK(d == 0);
const derived* p_const_derived = p_derived;
BOOST_CHECK(p_const_derived->class_name() == "const derived");
(var(d) = ll_const_cast<derived *>(p_const_derived))();
BOOST_CHECK(d->class_name() == "derived");
int i = 10;
char* cp = reinterpret_cast<char*>(&i);
int* ip;
(var(ip) = ll_reinterpret_cast<int *>(cp))();
BOOST_CHECK(*ip == 10);
// typeid
BOOST_CHECK(string(ll_typeid(d)().name()) == string(typeid(d).name()));
// sizeof
BOOST_CHECK(ll_sizeof(_1)(p_derived) == sizeof(p_derived));
BOOST_CHECK(ll_sizeof(_1)(*p_derived) == sizeof(*p_derived));
BOOST_CHECK(ll_sizeof(_1)(p_base) == sizeof(p_base));
BOOST_CHECK(ll_sizeof(_1)(*p_base) == sizeof(*p_base));
int an_array[100];
BOOST_CHECK(ll_sizeof(_1)(an_array) == 100 * sizeof(int));
delete p_derived;
delete p_base;
}
int test_main(int, char *[]) {
do_test();
return 0;
}

261
test/constructor_tests.cpp Normal file
View File

@@ -0,0 +1,261 @@
// constructor_tests.cpp -- The Boost Lambda Library ------------------
//
// Copyright (C) 2000-2003 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000-2003 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
#include "boost/lambda/construct.hpp"
#include <iostream>
#include <algorithm>
#include <vector>
using namespace boost::lambda;
using namespace std;
template<class T>
bool check_tuple(int n, const T& t)
{
return (t.get_head() == n) && check_tuple(n+1, t.get_tail());
}
template <>
bool check_tuple(int n, const null_type& ) { return true; }
void constructor_all_lengths()
{
bool ok;
ok = check_tuple(
1,
bind(constructor<tuple<int> >(),
1)()
);
BOOST_CHECK(ok);
ok = check_tuple(
1,
bind(constructor<tuple<int, int> >(),
1, 2)()
);
BOOST_CHECK(ok);
ok = check_tuple(
1,
bind(constructor<tuple<int, int, int> >(),
1, 2, 3)()
);
BOOST_CHECK(ok);
ok = check_tuple(
1,
bind(constructor<tuple<int, int, int, int> >(),
1, 2, 3, 4)()
);
BOOST_CHECK(ok);
ok = check_tuple(
1,
bind(constructor<tuple<int, int, int, int, int> >(),
1, 2, 3, 4, 5)()
);
BOOST_CHECK(ok);
ok = check_tuple(
1,
bind(constructor<tuple<int, int, int, int, int, int> >(),
1, 2, 3, 4, 5, 6)()
);
BOOST_CHECK(ok);
ok = check_tuple(
1,
bind(constructor<tuple<int, int, int, int, int, int, int> >(),
1, 2, 3, 4, 5, 6, 7)()
);
BOOST_CHECK(ok);
ok = check_tuple(
1,
bind(constructor<tuple<int, int, int, int, int, int, int, int> >(),
1, 2, 3, 4, 5, 6, 7, 8)()
);
BOOST_CHECK(ok);
ok = check_tuple(
1,
bind(constructor<tuple<int, int, int, int, int, int, int, int, int> >(),
1, 2, 3, 4, 5, 6, 7, 8, 9)()
);
BOOST_CHECK(ok);
}
void new_ptr_all_lengths()
{
bool ok;
ok = check_tuple(
1,
*(bind(new_ptr<tuple<int> >(),
1))()
);
BOOST_CHECK(ok);
ok = check_tuple(
1,
*(bind(new_ptr<tuple<int, int> >(),
1, 2))()
);
BOOST_CHECK(ok);
ok = check_tuple(
1,
*(bind(new_ptr<tuple<int, int, int> >(),
1, 2, 3))()
);
BOOST_CHECK(ok);
ok = check_tuple(
1,
*(bind(new_ptr<tuple<int, int, int, int> >(),
1, 2, 3, 4))()
);
BOOST_CHECK(ok);
ok = check_tuple(
1,
*(bind(new_ptr<tuple<int, int, int, int, int> >(),
1, 2, 3, 4, 5))()
);
BOOST_CHECK(ok);
ok = check_tuple(
1,
*(bind(new_ptr<tuple<int, int, int, int, int, int> >(),
1, 2, 3, 4, 5, 6))()
);
BOOST_CHECK(ok);
ok = check_tuple(
1,
*(bind(new_ptr<tuple<int, int, int, int, int, int, int> >(),
1, 2, 3, 4, 5, 6, 7))()
);
BOOST_CHECK(ok);
ok = check_tuple(
1,
*(bind(new_ptr<tuple<int, int, int, int, int, int, int, int> >(),
1, 2, 3, 4, 5, 6, 7, 8))()
);
BOOST_CHECK(ok);
ok = check_tuple(
1,
*(bind(new_ptr<tuple<int, int, int, int, int, int, int, int, int> >(),
1, 2, 3, 4, 5, 6, 7, 8, 9))()
);
BOOST_CHECK(ok);
}
class is_destructor_called {
bool& b;
public:
is_destructor_called(bool& bb) : b(bb) { b = false; }
~is_destructor_called() { b = true; }
};
void test_destructor ()
{
char space[sizeof(is_destructor_called)];
bool flag;
is_destructor_called* idc = new(space) is_destructor_called(flag);
BOOST_CHECK(flag == false);
bind(destructor(), _1)(idc);
BOOST_CHECK(flag == true);
idc = new(space) is_destructor_called(flag);
BOOST_CHECK(flag == false);
bind(destructor(), _1)(*idc);
BOOST_CHECK(flag == true);
}
class count_deletes {
public:
static int count;
~count_deletes() { ++count; }
};
int count_deletes::count = 0;
void test_news_and_deletes ()
{
int* i[10];
for_each(i, i+10, _1 = bind(new_ptr<int>(), 2));
int count_errors = 0;
for_each(i, i+10, (*_1 == 2) || ++var(count_errors));
BOOST_CHECK(count_errors == 0);
count_deletes* ct[10];
for_each(ct, ct+10, _1 = bind(new_ptr<count_deletes>()));
count_deletes::count = 0;
for_each(ct, ct+10, bind(delete_ptr(), _1));
BOOST_CHECK(count_deletes::count == 10);
}
void test_array_new_and_delete()
{
count_deletes* c;
(_1 = bind(new_array<count_deletes>(), 5))(c);
count_deletes::count = 0;
bind(delete_array(), _1)(c);
BOOST_CHECK(count_deletes::count == 5);
}
void delayed_construction()
{
vector<int> x(3);
vector<int> y(3);
fill(x.begin(), x.end(), 0);
fill(y.begin(), y.end(), 1);
vector<pair<int, int> > v;
transform(x.begin(), x.end(), y.begin(), back_inserter(v),
bind(constructor<pair<int, int> >(), _1, _2) );
}
int test_main(int, char *[]) {
constructor_all_lengths();
new_ptr_all_lengths();
delayed_construction();
test_destructor();
test_news_and_deletes();
test_array_new_and_delete();
return 0;
}

123
test/control_structures.cpp Normal file
View File

@@ -0,0 +1,123 @@
// -- control_structures.cpp -- The Boost Lambda Library ------------------
//
// Copyright (C) 2000-2003 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000-2003 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/if.hpp"
#include "boost/lambda/loops.hpp"
#include <iostream>
#include <algorithm>
#include <vector>
using namespace boost;
using boost::lambda::constant;
using boost::lambda::_1;
using boost::lambda::_2;
using boost::lambda::_3;
using boost::lambda::make_const;
using boost::lambda::for_loop;
using boost::lambda::while_loop;
using boost::lambda::do_while_loop;
using boost::lambda::if_then;
using boost::lambda::if_then_else;
using boost::lambda::if_then_else_return;
// 2 container for_each
template <class InputIter1, class InputIter2, class Function>
Function for_each(InputIter1 first, InputIter1 last,
InputIter2 first2, Function f) {
for ( ; first != last; ++first, ++first2)
f(*first, *first2);
return f;
}
void simple_loops() {
// for loops ---------------------------------------------------------
int i;
int arithmetic_series = 0;
for_loop(_1 = 0, _1 < 10, _1++, arithmetic_series += _1)(i);
BOOST_CHECK(arithmetic_series == 45);
// no body case
for_loop(boost::lambda::var(i) = 0, boost::lambda::var(i) < 100, ++boost::lambda::var(i))();
BOOST_CHECK(i == 100);
// while loops -------------------------------------------------------
int a = 0, b = 0, c = 0;
while_loop((_1 + _2) >= (_1 * _2), (++_1, ++_2, ++_3))(a, b, c);
BOOST_CHECK(c == 3);
int count;
count = 0; i = 0;
while_loop(_1++ < 10, ++boost::lambda::var(count))(i);
BOOST_CHECK(count == 10);
// note that the first parameter of do_while_loop is the condition
count = 0; i = 0;
do_while_loop(_1++ < 10, ++boost::lambda::var(count))(i);
BOOST_CHECK(count == 11);
a = 0;
do_while_loop(constant(false), _1++)(a);
BOOST_CHECK(a == 1);
// no body cases
a = 40; b = 30;
while_loop(--_1 > _2)(a, b);
BOOST_CHECK(a == b);
// (the no body case for do_while_loop is pretty redundant)
a = 40; b = 30;
do_while_loop(--_1 > _2)(a, b);
BOOST_CHECK(a == b);
}
void simple_ifs () {
int value = 42;
if_then(_1 < 0, _1 = 0)(value);
BOOST_CHECK(value == 42);
value = -42;
if_then(_1 < 0, _1 = -_1)(value);
BOOST_CHECK(value == 42);
int min;
if_then_else(_1 < _2, boost::lambda::var(min) = _1, boost::lambda::var(min) = _2)
(make_const(1), make_const(2));
BOOST_CHECK(min == 1);
if_then_else(_1 < _2, boost::lambda::var(min) = _1, boost::lambda::var(min) = _2)
(make_const(5), make_const(3));
BOOST_CHECK(min == 3);
int x, y;
x = -1; y = 1;
BOOST_CHECK(if_then_else_return(_1 < _2, _2, _1)(x, y) == (std::max)(x ,y));
BOOST_CHECK(if_then_else_return(_1 < _2, _2, _1)(y, x) == (std::max)(x ,y));
}
int test_main(int, char *[])
{
simple_loops();
simple_ifs();
return 0;
}

621
test/exception_test.cpp Normal file
View File

@@ -0,0 +1,621 @@
// -- exception_test.cpp -- The Boost Lambda Library ------------------
//
// Copyright (C) 2000-2003 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000-2003 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/exceptions.hpp"
#include "boost/lambda/bind.hpp"
#include<iostream>
#include<algorithm>
#include <cstdlib>
#include <iostream>
using namespace boost::lambda;
using namespace std;
// to prevent unused variables warnings
template <class T> void dummy(const T& t) {}
void erroneous_exception_related_lambda_expressions() {
int i = 0;
dummy(i);
// Uncommenting any of the below code lines should result in a compile
// time error
// this should fail (a rethrow binder outside of catch
// rethrow()();
// this should fail too for the same reason
// try_catch(rethrow(), catch_all(cout << constant("Howdy")))();
// this fails too (_e outside of catch_exception)
// (_1 + _2 + _e)(i, i, i);
// and this (_e outside of catch_exception)
// try_catch( throw_exception(1), catch_all(cout << _e));
// and this (_3 in catch_exception
// try_catch( throw_exception(1), catch_exception<int>(cout << _3));
}
class A1 {};
class A2 {};
class A3 {};
class A4 {};
class A5 {};
class A6 {};
class A7 {};
class A8 {};
class A9 {};
void throw_AX(int j) {
int i = j;
switch(i) {
case 1: throw A1();
case 2: throw A2();
case 3: throw A3();
case 4: throw A4();
case 5: throw A5();
case 6: throw A6();
case 7: throw A7();
case 8: throw A8();
case 9: throw A9();
}
}
void test_different_number_of_catch_blocks() {
int ecount;
// no catch(...) cases
ecount = 0;
for(int i=1; i<=1; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 1);
ecount = 0;
for(int i=1; i<=2; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
),
catch_exception<A2>(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 2);
ecount = 0;
for(int i=1; i<=3; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
),
catch_exception<A2>(
var(ecount)++
),
catch_exception<A3>(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 3);
ecount = 0;
for(int i=1; i<=4; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
),
catch_exception<A2>(
var(ecount)++
),
catch_exception<A3>(
var(ecount)++
),
catch_exception<A4>(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 4);
ecount = 0;
for(int i=1; i<=5; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
),
catch_exception<A2>(
var(ecount)++
),
catch_exception<A3>(
var(ecount)++
),
catch_exception<A4>(
var(ecount)++
),
catch_exception<A5>(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 5);
ecount = 0;
for(int i=1; i<=6; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
),
catch_exception<A2>(
var(ecount)++
),
catch_exception<A3>(
var(ecount)++
),
catch_exception<A4>(
var(ecount)++
),
catch_exception<A5>(
var(ecount)++
),
catch_exception<A6>(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 6);
ecount = 0;
for(int i=1; i<=7; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
),
catch_exception<A2>(
var(ecount)++
),
catch_exception<A3>(
var(ecount)++
),
catch_exception<A4>(
var(ecount)++
),
catch_exception<A5>(
var(ecount)++
),
catch_exception<A6>(
var(ecount)++
),
catch_exception<A7>(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 7);
ecount = 0;
for(int i=1; i<=8; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
),
catch_exception<A2>(
var(ecount)++
),
catch_exception<A3>(
var(ecount)++
),
catch_exception<A4>(
var(ecount)++
),
catch_exception<A5>(
var(ecount)++
),
catch_exception<A6>(
var(ecount)++
),
catch_exception<A7>(
var(ecount)++
),
catch_exception<A8>(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 8);
ecount = 0;
for(int i=1; i<=9; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
),
catch_exception<A2>(
var(ecount)++
),
catch_exception<A3>(
var(ecount)++
),
catch_exception<A4>(
var(ecount)++
),
catch_exception<A5>(
var(ecount)++
),
catch_exception<A6>(
var(ecount)++
),
catch_exception<A7>(
var(ecount)++
),
catch_exception<A8>(
var(ecount)++
),
catch_exception<A9>(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 9);
// with catch(...) blocks
ecount = 0;
for(int i=1; i<=1; i++)
{
try_catch(
bind(throw_AX, _1),
catch_all(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 1);
ecount = 0;
for(int i=1; i<=2; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
),
catch_all(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 2);
ecount = 0;
for(int i=1; i<=3; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
),
catch_exception<A2>(
var(ecount)++
),
catch_all(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 3);
ecount = 0;
for(int i=1; i<=4; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
),
catch_exception<A2>(
var(ecount)++
),
catch_exception<A3>(
var(ecount)++
),
catch_all(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 4);
ecount = 0;
for(int i=1; i<=5; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
),
catch_exception<A2>(
var(ecount)++
),
catch_exception<A3>(
var(ecount)++
),
catch_exception<A4>(
var(ecount)++
),
catch_all(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 5);
ecount = 0;
for(int i=1; i<=6; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
),
catch_exception<A2>(
var(ecount)++
),
catch_exception<A3>(
var(ecount)++
),
catch_exception<A4>(
var(ecount)++
),
catch_exception<A5>(
var(ecount)++
),
catch_all(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 6);
ecount = 0;
for(int i=1; i<=7; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
),
catch_exception<A2>(
var(ecount)++
),
catch_exception<A3>(
var(ecount)++
),
catch_exception<A4>(
var(ecount)++
),
catch_exception<A5>(
var(ecount)++
),
catch_exception<A6>(
var(ecount)++
),
catch_all(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 7);
ecount = 0;
for(int i=1; i<=8; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
),
catch_exception<A2>(
var(ecount)++
),
catch_exception<A3>(
var(ecount)++
),
catch_exception<A4>(
var(ecount)++
),
catch_exception<A5>(
var(ecount)++
),
catch_exception<A6>(
var(ecount)++
),
catch_exception<A7>(
var(ecount)++
),
catch_all(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 8);
ecount = 0;
for(int i=1; i<=9; i++)
{
try_catch(
bind(throw_AX, _1),
catch_exception<A1>(
var(ecount)++
),
catch_exception<A2>(
var(ecount)++
),
catch_exception<A3>(
var(ecount)++
),
catch_exception<A4>(
var(ecount)++
),
catch_exception<A5>(
var(ecount)++
),
catch_exception<A6>(
var(ecount)++
),
catch_exception<A7>(
var(ecount)++
),
catch_exception<A8>(
var(ecount)++
),
catch_all(
var(ecount)++
)
)(i);
}
BOOST_CHECK(ecount == 9);
}
void test_empty_catch_blocks() {
try_catch(
bind(throw_AX, _1),
catch_exception<A1>()
)(make_const(1));
try_catch(
bind(throw_AX, _1),
catch_all()
)(make_const(1));
}
void return_type_matching() {
// Rules for return types of the lambda functors in try and catch parts:
// 1. The try part dictates the return type of the whole
// try_catch lambda functor
// 2. If return type of try part is void, catch parts can return anything,
// but the return types are ignored
// 3. If the return type of the try part is A, then each catch return type
// must be implicitly convertible to A, or then it must throw for sure
int i = 1;
BOOST_CHECK(
try_catch(
_1 + 1,
catch_exception<int>((&_1, rethrow())), // no match, but ok since throws
catch_exception<char>(_e) // ok, char convertible to int
)(i)
== 2
);
// note that while e.g. char is convertible to int, it is not convertible
// to int&, (some lambda functors return references)
// try_catch(
// _1 += 1,
// catch_exception<char>(_e) // NOT ok, char not convertible to int&
// )(i);
// if you don't care about the return type, you can use make_void
try_catch(
make_void(_1 += 1),
catch_exception<char>(_e) // since try is void, catch can return anything
)(i);
BOOST_CHECK(i == 2);
try_catch(
(_1 += 1, throw_exception('a')),
catch_exception<char>(_e) // since try throws, it is void,
// so catch can return anything
)(i);
BOOST_CHECK(i == 3);
char a = 'a';
try_catch(
try_catch(
throw_exception(1),
catch_exception<int>(throw_exception('b'))
),
catch_exception<char>( _1 = _e )
)(a);
BOOST_CHECK(a == 'b');
}
int test_main(int, char *[]) {
try
{
test_different_number_of_catch_blocks();
return_type_matching();
test_empty_catch_blocks();
}
catch (int x)
{
BOOST_CHECK(false);
}
catch(...)
{
BOOST_CHECK(false);
}
return EXIT_SUCCESS;
}

View File

@@ -0,0 +1,384 @@
// extending_return_type_traits.cpp -- The Boost Lambda Library --------
//
// Copyright (C) 2000-2003 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000-2003 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include "boost/lambda/bind.hpp"
#include "boost/lambda/lambda.hpp"
#include <iostream>
#include <functional>
#include <algorithm>
class A {};
class B {};
using namespace boost::lambda;
B operator--(const A&, int) { return B(); }
B operator--(A&) { return B(); }
B operator++(const A&, int) { return B(); }
B operator++(A&) { return B(); }
B operator-(const A&) { return B(); }
B operator+(const A&) { return B(); }
B operator!(const A&) { return B(); }
B operator&(const A&) { return B(); }
B operator*(const A&) { return B(); }
namespace boost {
namespace lambda {
// unary + and -
template<class Act>
struct plain_return_type_1<unary_arithmetic_action<Act>, A > {
typedef B type;
};
// post incr/decr
template<class Act>
struct plain_return_type_1<post_increment_decrement_action<Act>, A > {
typedef B type;
};
// pre incr/decr
template<class Act>
struct plain_return_type_1<pre_increment_decrement_action<Act>, A > {
typedef B type;
};
// !
template<>
struct plain_return_type_1<logical_action<not_action>, A> {
typedef B type;
};
// &
template<>
struct plain_return_type_1<other_action<addressof_action>, A> {
typedef B type;
};
// *
template<>
struct plain_return_type_1<other_action<contentsof_action>, A> {
typedef B type;
};
} // lambda
} // boost
void ok(B b) {}
void test_unary_operators()
{
A a; int i = 1;
ok((++_1)(a));
ok((--_1)(a));
ok((_1++)(a));
ok((_1--)(a));
ok((+_1)(a));
ok((-_1)(a));
ok((!_1)(a));
ok((&_1)(a));
ok((*_1)(a));
BOOST_CHECK((*_1)(make_const(&i)) == 1);
}
class X {};
class Y {};
class Z {};
Z operator+(const X&, const Y&) { return Z(); }
Z operator-(const X&, const Y&) { return Z(); }
X operator*(const X&, const Y&) { return X(); }
Z operator/(const X&, const Y&) { return Z(); }
Z operator%(const X&, const Y&) { return Z(); }
class XX {};
class YY {};
class ZZ {};
class VV {};
// it is possible to support differently cv-qualified versions
YY operator*(XX&, YY&) { return YY(); }
ZZ operator*(const XX&, const YY&) { return ZZ(); }
XX operator*(volatile XX&, volatile YY&) { return XX(); }
VV operator*(const volatile XX&, const volatile YY&) { return VV(); }
// the traits can be more complex:
template <class T>
class my_vector {};
template<class A, class B>
my_vector<typename return_type_2<arithmetic_action<plus_action>, A&, B&>::type>
operator+(const my_vector<A>& a, const my_vector<B>& b)
{
typedef typename
return_type_2<arithmetic_action<plus_action>, A&, B&>::type res_type;
return my_vector<res_type>();
}
// bitwise ops:
X operator<<(const X&, const Y&) { return X(); }
Z operator>>(const X&, const Y&) { return Z(); }
Z operator&(const X&, const Y&) { return Z(); }
Z operator|(const X&, const Y&) { return Z(); }
Z operator^(const X&, const Y&) { return Z(); }
// comparison ops:
X operator<(const X&, const Y&) { return X(); }
Z operator>(const X&, const Y&) { return Z(); }
Z operator<=(const X&, const Y&) { return Z(); }
Z operator>=(const X&, const Y&) { return Z(); }
Z operator==(const X&, const Y&) { return Z(); }
Z operator!=(const X&, const Y&) { return Z(); }
// logical
X operator&&(const X&, const Y&) { return X(); }
Z operator||(const X&, const Y&) { return Z(); }
// arithh assignment
Z operator+=( X&, const Y&) { return Z(); }
Z operator-=( X&, const Y&) { return Z(); }
Y operator*=( X&, const Y&) { return Y(); }
Z operator/=( X&, const Y&) { return Z(); }
Z operator%=( X&, const Y&) { return Z(); }
// bitwise assignment
Z operator<<=( X&, const Y&) { return Z(); }
Z operator>>=( X&, const Y&) { return Z(); }
Y operator&=( X&, const Y&) { return Y(); }
Z operator|=( X&, const Y&) { return Z(); }
Z operator^=( X&, const Y&) { return Z(); }
// assignment
class Assign {
public:
void operator=(const Assign& a) {}
X operator[](const int& i) { return X(); }
};
namespace boost {
namespace lambda {
// you can do action groups
template<class Act>
struct plain_return_type_2<arithmetic_action<Act>, X, Y> {
typedef Z type;
};
// or specialize the exact action
template<>
struct plain_return_type_2<arithmetic_action<multiply_action>, X, Y> {
typedef X type;
};
// if you want to make a distinction between differently cv-qualified
// types, you need to specialize on a different level:
template<>
struct return_type_2<arithmetic_action<multiply_action>, XX, YY> {
typedef YY type;
};
template<>
struct return_type_2<arithmetic_action<multiply_action>, const XX, const YY> {
typedef ZZ type;
};
template<>
struct return_type_2<arithmetic_action<multiply_action>, volatile XX, volatile YY> {
typedef XX type;
};
template<>
struct return_type_2<arithmetic_action<multiply_action>, volatile const XX, const volatile YY> {
typedef VV type;
};
// the mapping can be more complex:
template<class A, class B>
struct plain_return_type_2<arithmetic_action<plus_action>, my_vector<A>, my_vector<B> > {
typedef typename
return_type_2<arithmetic_action<plus_action>, A&, B&>::type res_type;
typedef my_vector<res_type> type;
};
// bitwise binary:
// you can do action groups
template<class Act>
struct plain_return_type_2<bitwise_action<Act>, X, Y> {
typedef Z type;
};
// or specialize the exact action
template<>
struct plain_return_type_2<bitwise_action<leftshift_action>, X, Y> {
typedef X type;
};
// comparison binary:
// you can do action groups
template<class Act>
struct plain_return_type_2<relational_action<Act>, X, Y> {
typedef Z type;
};
// or specialize the exact action
template<>
struct plain_return_type_2<relational_action<less_action>, X, Y> {
typedef X type;
};
// logical binary:
// you can do action groups
template<class Act>
struct plain_return_type_2<logical_action<Act>, X, Y> {
typedef Z type;
};
// or specialize the exact action
template<>
struct plain_return_type_2<logical_action<and_action>, X, Y> {
typedef X type;
};
// arithmetic assignment :
// you can do action groups
template<class Act>
struct plain_return_type_2<arithmetic_assignment_action<Act>, X, Y> {
typedef Z type;
};
// or specialize the exact action
template<>
struct plain_return_type_2<arithmetic_assignment_action<multiply_action>, X, Y> {
typedef Y type;
};
// arithmetic assignment :
// you can do action groups
template<class Act>
struct plain_return_type_2<bitwise_assignment_action<Act>, X, Y> {
typedef Z type;
};
// or specialize the exact action
template<>
struct plain_return_type_2<bitwise_assignment_action<and_action>, X, Y> {
typedef Y type;
};
// assignment
template<>
struct plain_return_type_2<other_action<assignment_action>, Assign, Assign> {
typedef void type;
};
// subscript
template<>
struct plain_return_type_2<other_action<subscript_action>, Assign, int> {
typedef X type;
};
} // end lambda
} // end boost
void test_binary_operators() {
X x; Y y;
(_1 + _2)(x, y);
(_1 - _2)(x, y);
(_1 * _2)(x, y);
(_1 / _2)(x, y);
(_1 % _2)(x, y);
// make a distinction between differently cv-qualified operators
XX xx; YY yy;
const XX& cxx = xx;
const YY& cyy = yy;
volatile XX& vxx = xx;
volatile YY& vyy = yy;
const volatile XX& cvxx = xx;
const volatile YY& cvyy = yy;
ZZ dummy1 = (_1 * _2)(cxx, cyy);
YY dummy2 = (_1 * _2)(xx, yy);
XX dummy3 = (_1 * _2)(vxx, vyy);
VV dummy4 = (_1 * _2)(cvxx, cvyy);
my_vector<int> v1; my_vector<double> v2;
my_vector<double> d = (_1 + _2)(v1, v2);
// bitwise
(_1 << _2)(x, y);
(_1 >> _2)(x, y);
(_1 | _2)(x, y);
(_1 & _2)(x, y);
(_1 ^ _2)(x, y);
// comparison
(_1 < _2)(x, y);
(_1 > _2)(x, y);
(_1 <= _2)(x, y);
(_1 >= _2)(x, y);
(_1 == _2)(x, y);
(_1 != _2)(x, y);
// logical
(_1 || _2)(x, y);
(_1 && _2)(x, y);
// arithmetic assignment
(_1 += _2)(x, y);
(_1 -= _2)(x, y);
(_1 *= _2)(x, y);
(_1 /= _2)(x, y);
(_1 %= _2)(x, y);
// bitwise assignment
(_1 <<= _2)(x, y);
(_1 >>= _2)(x, y);
(_1 |= _2)(x, y);
(_1 &= _2)(x, y);
(_1 ^= _2)(x, y);
}
int test_main(int, char *[]) {
test_unary_operators();
test_binary_operators();
return 0;
}

View File

@@ -0,0 +1,79 @@
// is_instance_of_test.cpp -- The Boost Lambda Library ------------------
//
// Copyright (C) 2000-2003 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000-2003 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include "boost/lambda/detail/is_instance_of.hpp"
#include <iostream>
template <class T1> struct A1 {};
template <class T1, class T2> struct A2 {};
template <class T1, class T2, class T3> struct A3 {};
template <class T1, class T2, class T3, class T4> struct A4 {};
class B1 : public A1<int> {};
class B2 : public A2<int,int> {};
class B3 : public A3<int,int,int> {};
class B4 : public A4<int,int,int,int> {};
// classes that are convertible to classes that derive from A instances
// This is not enough to make the test succeed
class C1 { public: operator A1<int>() { return A1<int>(); } };
class C2 { public: operator B2() { return B2(); } };
class C3 { public: operator B3() { return B3(); } };
class C4 { public: operator B4() { return B4(); } };
// test that the result is really a constant
// (in an alternative implementation, gcc 3.0.2. claimed that it was
// a non-constant)
template <bool b> class X {};
// this should compile
X<boost::lambda::is_instance_of_2<int, A2>::value> x;
int test_main(int, char *[]) {
using boost::lambda::is_instance_of_1;
using boost::lambda::is_instance_of_2;
using boost::lambda::is_instance_of_3;
using boost::lambda::is_instance_of_4;
BOOST_CHECK((is_instance_of_1<B1, A1>::value == true));
BOOST_CHECK((is_instance_of_1<A1<float>, A1>::value == true));
BOOST_CHECK((is_instance_of_1<int, A1>::value == false));
BOOST_CHECK((is_instance_of_1<C1, A1>::value == false));
BOOST_CHECK((is_instance_of_2<B2, A2>::value == true));
BOOST_CHECK((is_instance_of_2<A2<int, float>, A2>::value == true));
BOOST_CHECK((is_instance_of_2<int, A2>::value == false));
BOOST_CHECK((is_instance_of_2<C2, A2>::value == false));
BOOST_CHECK((is_instance_of_3<B3, A3>::value == true));
BOOST_CHECK((is_instance_of_3<A3<int, float, char>, A3>::value == true));
BOOST_CHECK((is_instance_of_3<int, A3>::value == false));
BOOST_CHECK((is_instance_of_3<C3, A3>::value == false));
BOOST_CHECK((is_instance_of_4<B4, A4>::value == true));
BOOST_CHECK((is_instance_of_4<A4<int, float, char, double>, A4>::value == true));
BOOST_CHECK((is_instance_of_4<int, A4>::value == false));
BOOST_CHECK((is_instance_of_4<C4, A4>::value == false));
return 0;
}

30
test/istreambuf_test.cpp Normal file
View File

@@ -0,0 +1,30 @@
// istreambuf_test - test lambda function objects with istreambuf_iterator
//
// Copyright (c) 2007 Peter Dimov
//
// Distributed under 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
#include <boost/lambda/lambda.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <iterator>
#include <sstream>
#include <algorithm>
int main()
{
using namespace boost::lambda;
std::stringstream is( "ax2" );
std::istreambuf_iterator<char> b2( is );
std::istreambuf_iterator<char> e2;
std::istreambuf_iterator<char> i = std::find_if( b2, e2, _1 == 'x' );
BOOST_TEST( *i == 'x' );
BOOST_TEST( std::distance( i, e2 ) == 2 );
return boost::report_errors();
}

View File

@@ -0,0 +1,192 @@
// member_pointer_test.cpp -- The Boost Lambda Library ------------------
//
// Copyright (C) 2000-2003 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000-2003 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
#include <string>
using namespace boost::lambda;
using namespace std;
struct my_struct {
my_struct(int x) : mem(x) {};
int mem;
int fooc() const { return mem; }
int foo() { return mem; }
int foo1c(int y) const { return y + mem; }
int foo1(int y) { return y + mem; }
int foo2c(int y, int x) const { return y + x + mem; }
int foo2(int y, int x) { return y + x + mem; }
int foo3c(int y, int x, int z) const { return y + x + z + mem; }
int foo3(int y, int x, int z ){ return y + x + z + mem; }
int foo4c(int a1, int a2, int a3, int a4) const { return a1+a2+a3+a4+mem; }
int foo4(int a1, int a2, int a3, int a4){ return a1+a2+a3+a4+mem; }
int foo3default(int y = 1, int x = 2, int z = 3) { return y + x + z + mem; }
};
my_struct x(3);
void pointer_to_data_member_tests() {
// int i = 0;
my_struct *y = &x;
BOOST_CHECK((_1 ->* &my_struct::mem)(y) == 3);
(_1 ->* &my_struct::mem)(y) = 4;
BOOST_CHECK(x.mem == 4);
((_1 ->* &my_struct::mem) = 5)(y);
BOOST_CHECK(x.mem == 5);
// &my_struct::mem is a temporary, must be constified
((y ->* _1) = 6)(make_const(&my_struct::mem));
BOOST_CHECK(x.mem == 6);
((_1 ->* _2) = 7)(y, make_const(&my_struct::mem));
BOOST_CHECK(x.mem == 7);
}
void pointer_to_member_function_tests() {
my_struct *y = new my_struct(1);
BOOST_CHECK( (_1 ->* &my_struct::foo)(y)() == (y->mem));
BOOST_CHECK( (_1 ->* &my_struct::fooc)(y)() == (y->mem));
BOOST_CHECK( (y ->* _1)(make_const(&my_struct::foo))() == (y->mem));
BOOST_CHECK( (y ->* _1)(make_const(&my_struct::fooc))() == (y->mem));
BOOST_CHECK( (_1 ->* _2)(y, make_const(&my_struct::foo))() == (y->mem));
BOOST_CHECK( (_1 ->* _2)(y, make_const(&my_struct::fooc))() == (y->mem));
BOOST_CHECK( (_1 ->* &my_struct::foo1)(y)(1) == (y->mem+1));
BOOST_CHECK( (_1 ->* &my_struct::foo1c)(y)(1) == (y->mem+1));
BOOST_CHECK( (y ->* _1)(make_const(&my_struct::foo1))(1) == (y->mem+1));
BOOST_CHECK( (y ->* _1)(make_const(&my_struct::foo1c))(1) == (y->mem+1));
BOOST_CHECK( (_1 ->* _2)(y, make_const(&my_struct::foo1))(1) == (y->mem+1));
BOOST_CHECK( (_1 ->* _2)(y, make_const(&my_struct::foo1c))(1) == (y->mem+1));
BOOST_CHECK( (_1 ->* &my_struct::foo2)(y)(1,2) == (y->mem+1+2));
BOOST_CHECK( (_1 ->* &my_struct::foo2c)(y)(1,2) == (y->mem+1+2));
BOOST_CHECK( (y ->* _1)(make_const(&my_struct::foo2))(1,2) == (y->mem+1+2));
BOOST_CHECK( (y ->* _1)(make_const(&my_struct::foo2c))(1,2) == (y->mem+1+2));
BOOST_CHECK( (_1 ->* _2)(y, make_const(&my_struct::foo2))(1,2) == (y->mem+1+2));
BOOST_CHECK( (_1 ->* _2)(y, make_const(&my_struct::foo2c))(1,2) == (y->mem+1+2));
BOOST_CHECK( (_1 ->* &my_struct::foo3)(y)(1,2,3) == (y->mem+1+2+3));
BOOST_CHECK( (_1 ->* &my_struct::foo3c)(y)(1,2,3) == (y->mem+1+2+3));
BOOST_CHECK( (y ->* _1)(make_const(&my_struct::foo3))(1,2,3) == (y->mem+1+2+3));
BOOST_CHECK( (y ->* _1)(make_const(&my_struct::foo3c))(1,2,3) == (y->mem+1+2+3));
BOOST_CHECK( (_1 ->* _2)(y, make_const(&my_struct::foo3))(1,2,3) == (y->mem+1+2+3));
BOOST_CHECK( (_1 ->* _2)(y, make_const(&my_struct::foo3c))(1,2,3) == (y->mem+1+2+3));
BOOST_CHECK( (_1 ->* &my_struct::foo4)(y)(1,2,3,4) == (y->mem+1+2+3+4));
BOOST_CHECK( (_1 ->* &my_struct::foo4c)(y)(1,2,3,4) == (y->mem+1+2+3+4));
BOOST_CHECK( (y ->* _1)(make_const(&my_struct::foo4))(1,2,3,4) == (y->mem+1+2+3+4));
BOOST_CHECK( (y ->* _1)(make_const(&my_struct::foo4c))(1,2,3,4) == (y->mem+1+2+3+4));
BOOST_CHECK( (_1 ->* _2)(y, make_const(&my_struct::foo4))(1,2,3,4) == (y->mem+1+2+3+4));
BOOST_CHECK( (_1 ->* _2)(y, make_const(&my_struct::foo4c))(1,2,3,4) == (y->mem+1+2+3+4));
// member functions with default values do not work (inherent language issue)
// BOOST_CHECK( (_1 ->* &my_struct::foo3default)(y)() == (y->mem+1+2+3));
}
class A {};
class B {};
class C {};
class D {};
// ->* can be overloaded to do anything
bool operator->*(A a, B b) {
return false;
}
bool operator->*(B b, A a) {
return true;
}
// let's provide specializations to take care of the return type deduction.
// Note, that you need to provide all four cases for non-const and const
// or use the plain_return_type_2 template.
namespace boost {
namespace lambda {
template <>
struct return_type_2<other_action<member_pointer_action>, B, A> {
typedef bool type;
};
template<>
struct return_type_2<other_action<member_pointer_action>, const B, A> {
typedef bool type;
};
template<>
struct return_type_2<other_action<member_pointer_action>, B, const A> {
typedef bool type;
};
template<>
struct return_type_2<other_action<member_pointer_action>, const B, const A> {
typedef bool type;
};
} // lambda
} // boost
void test_overloaded_pointer_to_member()
{
A a; B b;
// this won't work, can't deduce the return type
// BOOST_CHECK((_1->*_2)(a, b) == false);
// ret<bool> gives the return type
BOOST_CHECK(ret<bool>(_1->*_2)(a, b) == false);
BOOST_CHECK(ret<bool>(a->*_1)(b) == false);
BOOST_CHECK(ret<bool>(_1->*b)(a) == false);
BOOST_CHECK((ret<bool>((var(a))->*b))() == false);
BOOST_CHECK((ret<bool>((var(a))->*var(b)))() == false);
// this is ok without ret<bool> due to the return_type_2 spcialization above
BOOST_CHECK((_1->*_2)(b, a) == true);
BOOST_CHECK((b->*_1)(a) == true);
BOOST_CHECK((_1->*a)(b) == true);
BOOST_CHECK((var(b)->*a)() == true);
return;
}
int test_main(int, char *[]) {
pointer_to_data_member_tests();
pointer_to_member_function_tests();
test_overloaded_pointer_to_member();
return 0;
}

View File

@@ -0,0 +1,399 @@
// operator_tests_simple.cpp -- The Boost Lambda Library ---------------
//
// Copyright (C) 2000-2003 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000-2003 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include "boost/lambda/lambda.hpp"
#include <vector>
#include <map>
#include <set>
#include <string>
#include <iostream>
#ifndef BOOST_NO_STRINGSTREAM
#include <sstream>
#endif
using namespace std;
using namespace boost;
using namespace boost::lambda;
class unary_plus_tester {};
unary_plus_tester operator+(const unary_plus_tester& a) { return a; }
void cout_tests()
{
#ifndef BOOST_NO_STRINGSTREAM
using std::cout;
ostringstream os;
int i = 10;
(os << _1)(i);
(os << constant("FOO"))();
BOOST_CHECK(os.str() == std::string("10FOO"));
istringstream is("ABC 1");
std::string s;
int k;
is >> s;
is >> k;
BOOST_CHECK(s == std::string("ABC"));
BOOST_CHECK(k == 1);
// test for constant, constant_ref and var
i = 5;
constant_type<int>::type ci(constant(i));
var_type<int>::type vi(var(i));
(vi = _1)(make_const(100));
BOOST_CHECK((ci)() == 5);
BOOST_CHECK(i == 100);
int a;
constant_ref_type<int>::type cr(constant_ref(i));
(++vi, var(a) = cr)();
BOOST_CHECK(i == 101);
#endif
}
void arithmetic_operators() {
int i = 1; int j = 2; int k = 3;
using namespace std;
using namespace boost::lambda;
BOOST_CHECK((_1 + 1)(i)==2);
BOOST_CHECK(((_1 + 1) * _2)(i, j)==4);
BOOST_CHECK((_1 - 1)(i)==0);
BOOST_CHECK((_1 * 2)(j)==4);
BOOST_CHECK((_1 / 2)(j)==1);
BOOST_CHECK((_1 % 2)(k)==1);
BOOST_CHECK((-_1)(i) == -1);
BOOST_CHECK((+_1)(i) == 1);
// test that unary plus really does something
unary_plus_tester u;
unary_plus_tester up = (+_1)(u);
}
void bitwise_operators() {
unsigned int ui = 2;
BOOST_CHECK((_1 << 1)(ui)==(2 << 1));
BOOST_CHECK((_1 >> 1)(ui)==(2 >> 1));
BOOST_CHECK((_1 & 1)(ui)==(2 & 1));
BOOST_CHECK((_1 | 1)(ui)==(2 | 1));
BOOST_CHECK((_1 ^ 1)(ui)==(2 ^ 1));
BOOST_CHECK((~_1)(ui)==~2u);
}
void comparison_operators() {
int i = 0, j = 1;
BOOST_CHECK((_1 < _2)(i, j) == true);
BOOST_CHECK((_1 <= _2)(i, j) == true);
BOOST_CHECK((_1 == _2)(i, j) == false);
BOOST_CHECK((_1 != _2)(i, j) == true);
BOOST_CHECK((_1 > _2)(i, j) == false);
BOOST_CHECK((_1 >= _2)(i, j) == false);
BOOST_CHECK((!(_1 < _2))(i, j) == false);
BOOST_CHECK((!(_1 <= _2))(i, j) == false);
BOOST_CHECK((!(_1 == _2))(i, j) == true);
BOOST_CHECK((!(_1 != _2))(i, j) == false);
BOOST_CHECK((!(_1 > _2))(i, j) == true);
BOOST_CHECK((!(_1 >= _2))(i, j) == true);
}
void logical_operators() {
bool t = true, f = false;
BOOST_CHECK((_1 && _2)(t, t) == true);
BOOST_CHECK((_1 && _2)(t, f) == false);
BOOST_CHECK((_1 && _2)(f, t) == false);
BOOST_CHECK((_1 && _2)(f, f) == false);
BOOST_CHECK((_1 || _2)(t, t) == true);
BOOST_CHECK((_1 || _2)(t, f) == true);
BOOST_CHECK((_1 || _2)(f, t) == true);
BOOST_CHECK((_1 || _2)(f, f) == false);
BOOST_CHECK((!_1)(t) == false);
BOOST_CHECK((!_1)(f) == true);
// test short circuiting
int i=0;
(false && ++_1)(i);
BOOST_CHECK(i==0);
i = 0;
(true && ++_1)(i);
BOOST_CHECK(i==1);
i = 0;
(false || ++_1)(i);
BOOST_CHECK(i==1);
i = 0;
(true || ++_1)(i);
BOOST_CHECK(i==0);
i = 0;
}
void unary_incs_and_decs() {
int i = 0;
BOOST_CHECK(_1++(i) == 0);
BOOST_CHECK(i == 1);
i = 0;
BOOST_CHECK(_1--(i) == 0);
BOOST_CHECK(i == -1);
i = 0;
BOOST_CHECK((++_1)(i) == 1);
BOOST_CHECK(i == 1);
i = 0;
BOOST_CHECK((--_1)(i) == -1);
BOOST_CHECK(i == -1);
i = 0;
// the result of prefix -- and ++ are lvalues
(++_1)(i) = 10;
BOOST_CHECK(i==10);
i = 0;
(--_1)(i) = 10;
BOOST_CHECK(i==10);
i = 0;
}
void compound_operators() {
int i = 1;
// normal variable as the left operand
(i += _1)(make_const(1));
BOOST_CHECK(i == 2);
(i -= _1)(make_const(1));
BOOST_CHECK(i == 1);
(i *= _1)(make_const(10));
BOOST_CHECK(i == 10);
(i /= _1)(make_const(2));
BOOST_CHECK(i == 5);
(i %= _1)(make_const(2));
BOOST_CHECK(i == 1);
// lambda expression as a left operand
(_1 += 1)(i);
BOOST_CHECK(i == 2);
(_1 -= 1)(i);
BOOST_CHECK(i == 1);
(_1 *= 10)(i);
BOOST_CHECK(i == 10);
(_1 /= 2)(i);
BOOST_CHECK(i == 5);
(_1 %= 2)(i);
BOOST_CHECK(i == 1);
// shifts
unsigned int ui = 2;
(_1 <<= 1)(ui);
BOOST_CHECK(ui==(2 << 1));
ui = 2;
(_1 >>= 1)(ui);
BOOST_CHECK(ui==(2 >> 1));
ui = 2;
(ui <<= _1)(make_const(1));
BOOST_CHECK(ui==(2 << 1));
ui = 2;
(ui >>= _1)(make_const(1));
BOOST_CHECK(ui==(2 >> 1));
// and, or, xor
ui = 2;
(_1 &= 1)(ui);
BOOST_CHECK(ui==(2 & 1));
ui = 2;
(_1 |= 1)(ui);
BOOST_CHECK(ui==(2 | 1));
ui = 2;
(_1 ^= 1)(ui);
BOOST_CHECK(ui==(2 ^ 1));
ui = 2;
(ui &= _1)(make_const(1));
BOOST_CHECK(ui==(2 & 1));
ui = 2;
(ui |= _1)(make_const(1));
BOOST_CHECK(ui==(2 | 1));
ui = 2;
(ui ^= _1)(make_const(1));
BOOST_CHECK(ui==(2 ^ 1));
}
void assignment_and_subscript() {
// assignment and subscript need to be defined as member functions.
// Hence, if you wish to use a normal variable as the left hand argument,
// you must wrap it with var to turn it into a lambda expression
using std::string;
string s;
(_1 = "one")(s);
BOOST_CHECK(s == string("one"));
(var(s) = "two")();
BOOST_CHECK(s == string("two"));
BOOST_CHECK((var(s)[_1])(make_const(2)) == 'o');
BOOST_CHECK((_1[2])(s) == 'o');
BOOST_CHECK((_1[_2])(s, make_const(2)) == 'o');
// subscript returns lvalue
(var(s)[_1])(make_const(1)) = 'o';
BOOST_CHECK(s == "too");
(_1[1])(s) = 'a';
BOOST_CHECK(s == "tao");
(_1[_2])(s, make_const(0)) = 'm';
BOOST_CHECK(s == "mao");
// TODO: tests for vector, set, map, multimap
}
class A {};
void address_of_and_dereference() {
A a; int i = 42;
BOOST_CHECK((&_1)(a) == &a);
BOOST_CHECK((*&_1)(i) == 42);
std::vector<int> vi; vi.push_back(1);
std::vector<int>::iterator it = vi.begin();
(*_1 = 7)(it);
BOOST_CHECK(vi[0] == 7);
// TODO: Add tests for more complex iterator types
}
void comma() {
int i = 100;
BOOST_CHECK((_1 = 10, 2 * _1)(i) == 20);
// TODO: that the return type is the exact type of the right argument
// (that r/l valueness is preserved)
}
void pointer_arithmetic() {
int ia[4] = { 1, 2, 3, 4 };
int* ip = ia;
int* ia_last = &ia[3];
const int cia[4] = { 1, 2, 3, 4 };
const int* cip = cia;
const int* cia_last = &cia[3];
// non-const array
BOOST_CHECK((*(_1 + 1))(ia) == 2);
// non-const pointer
BOOST_CHECK((*(_1 + 1))(ip) == 2);
BOOST_CHECK((*(_1 - 1))(ia_last) == 3);
// const array
BOOST_CHECK((*(_1 + 1))(cia) == 2);
// const pointer
BOOST_CHECK((*(_1 + 1))(cip) == 2);
BOOST_CHECK((*(_1 - 1))(cia_last) == 3);
// pointer arithmetic should not make non-consts const
(*(_1 + 2))(ia) = 0;
(*(_1 + 3))(ip) = 0;
BOOST_CHECK(ia[2] == 0);
BOOST_CHECK(ia[3] == 0);
// pointer - pointer
BOOST_CHECK((_1 - _2)(ia_last, ia) == 3);
BOOST_CHECK((_1 - _2)(cia_last, cia) == 3);
BOOST_CHECK((ia_last - _1)(ia) == 3);
BOOST_CHECK((cia_last - _1)(cia) == 3);
BOOST_CHECK((cia_last - _1)(cip) == 3);
}
int test_main(int, char *[]) {
arithmetic_operators();
bitwise_operators();
comparison_operators();
logical_operators();
unary_incs_and_decs();
compound_operators();
assignment_and_subscript();
address_of_and_dereference();
comma();
pointer_arithmetic();
cout_tests();
return 0;
}

View File

@@ -0,0 +1,148 @@
// phoenix_style_control_structures.cpp -- The Boost Lambda Library ------
//
// Copyright (C) 2000-2003 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000-2003 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/if.hpp"
#include "boost/lambda/loops.hpp"
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <functional>
using namespace boost::lambda;
using namespace std;
// If-else, while, do-while, for statements
int test_main(int, char *[]) {
vector<int> v;
v.clear();
v.push_back(1);
v.push_back(2);
v.push_back(3);
v.push_back(4);
v.push_back(5);
v.push_back(6);
v.push_back(7);
v.push_back(8);
v.push_back(9);
v.push_back(10);
int sum = 0;
//////////////////////////////////
for_each(v.begin(), v.end(),
if_(_1 > 3 && _1 <= 8)
[
sum += _1
]
);
BOOST_CHECK(sum == 4+5+6+7+8);
int gt = 0, eq = 0, lt = 0;
//////////////////////////////////
for_each(v.begin(), v.end(),
if_(_1 > 5)
[
++var(gt)
]
.else_
[
if_(_1 == 5)
[
++var(eq)
]
.else_
[
++var(lt)
]
]
);
BOOST_CHECK(lt==4);
BOOST_CHECK(eq==1);
BOOST_CHECK(gt==5);
vector<int> t = v;
int counta = 0;
int countb = 0;
//////////////////////////////////
for_each(v.begin(), v.end(),
(
while_(_1--)
[
++var(counta)
],
++var(countb)
)
);
BOOST_CHECK(counta == 55);
BOOST_CHECK(countb == 10);
v = t;
counta = 0; countb = 0;
//////////////////////////////////
for_each(v.begin(), v.end(),
(
do_
[
++var(counta)
]
.while_(_1--),
++var(countb)
)
);
BOOST_CHECK(counta == (2+11)*10/2);
BOOST_CHECK(countb == 10);
v = t;
counta = 0; countb = 0;
//////////////////////////////////
int iii;
for_each(v.begin(), v.end(),
(
for_(var(iii) = 0, var(iii) < _1, ++var(iii))
[
++var(counta)
],
++var(countb)
)
);
BOOST_CHECK(counta == (1+10)*10/2);
BOOST_CHECK(countb == 10);
v = t;
return 0;
}

57
test/rvalue_test.cpp Normal file
View File

@@ -0,0 +1,57 @@
// rvalue_test - test lambda function objects with rvalue arguments
//
// Copyright (c) 2007 Peter Dimov
//
// Distributed under 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
#include <boost/lambda/lambda.hpp>
#include <boost/detail/lightweight_test.hpp>
int main()
{
using namespace boost::lambda;
int x = 0;
int const y = 1;
int const z = 2;
BOOST_TEST( _1( x ) == 0 );
BOOST_TEST( _1( y ) == 1 );
BOOST_TEST( _1( 2 ) == 2 );
BOOST_TEST( _2( x, x ) == 0 );
BOOST_TEST( _2( x, y ) == 1 );
BOOST_TEST( _2( x, 2 ) == 2 );
BOOST_TEST( _2( 4, x ) == 0 );
BOOST_TEST( _2( 4, y ) == 1 );
BOOST_TEST( _2( 4, 2 ) == 2 );
(_1 = _2)( x, y );
BOOST_TEST( x == y );
(_1 = _2)( x, 3 );
BOOST_TEST( x == 3 );
(_2 = _1)( z, x );
BOOST_TEST( x == z );
(_2 = _1)( 4, x );
BOOST_TEST( x == 4 );
BOOST_TEST( _3( x, x, x ) == x );
BOOST_TEST( _3( x, x, y ) == y );
BOOST_TEST( _3( x, x, 2 ) == 2 );
BOOST_TEST( _3( x, 5, x ) == x );
BOOST_TEST( _3( x, 5, y ) == y );
BOOST_TEST( _3( x, 5, 2 ) == 2 );
BOOST_TEST( _3( 9, 5, x ) == x );
BOOST_TEST( _3( 9, 5, y ) == y );
BOOST_TEST( _3( 9, 5, 2 ) == 2 );
return boost::report_errors();
}

392
test/switch_construct.cpp Normal file
View File

@@ -0,0 +1,392 @@
// switch_test.cpp -- The Boost Lambda Library --------------------------
//
// Copyright (C) 2000-2003 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000-2003 Gary Powell (powellg@amazon.com)
//
// Distributed under 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)
//
// For more information, see www.boost.org
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/if.hpp"
#include "boost/lambda/switch.hpp"
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
// Check that elements 0 -- index are 1, and the rest are 0
bool check(const std::vector<int>& v, int index) {
using namespace boost::lambda;
int counter = 0;
std::vector<int>::const_iterator
result = std::find_if(v.begin(), v.end(),
! if_then_else_return(
var(counter)++ <= index,
_1 == 1,
_1 == 0)
);
return result == v.end();
}
void do_switch_no_defaults_tests() {
using namespace boost::lambda;
int i = 0;
std::vector<int> v,w;
// elements from 0 to 9
std::generate_n(std::back_inserter(v),
10,
var(i)++);
std::fill_n(std::back_inserter(w), 10, 0);
// ---
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0]))
)
);
BOOST_CHECK(check(w, 0));
std::fill_n(w.begin(), 10, 0);
// ---
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0])),
case_statement<1>(++var(w[1]))
)
);
BOOST_CHECK(check(w, 1));
std::fill_n(w.begin(), 10, 0);
// ---
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0])),
case_statement<1>(++var(w[1])),
case_statement<2>(++var(w[2]))
)
);
BOOST_CHECK(check(w, 2));
std::fill_n(w.begin(), 10, 0);
// ---
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0])),
case_statement<1>(++var(w[1])),
case_statement<2>(++var(w[2])),
case_statement<3>(++var(w[3]))
)
);
BOOST_CHECK(check(w, 3));
std::fill_n(w.begin(), 10, 0);
// ---
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0])),
case_statement<1>(++var(w[1])),
case_statement<2>(++var(w[2])),
case_statement<3>(++var(w[3])),
case_statement<4>(++var(w[4]))
)
);
BOOST_CHECK(check(w, 4));
std::fill_n(w.begin(), 10, 0);
// ---
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0])),
case_statement<1>(++var(w[1])),
case_statement<2>(++var(w[2])),
case_statement<3>(++var(w[3])),
case_statement<4>(++var(w[4])),
case_statement<5>(++var(w[5]))
)
);
BOOST_CHECK(check(w, 5));
std::fill_n(w.begin(), 10, 0);
// ---
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0])),
case_statement<1>(++var(w[1])),
case_statement<2>(++var(w[2])),
case_statement<3>(++var(w[3])),
case_statement<4>(++var(w[4])),
case_statement<5>(++var(w[5])),
case_statement<6>(++var(w[6]))
)
);
BOOST_CHECK(check(w, 6));
std::fill_n(w.begin(), 10, 0);
// ---
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0])),
case_statement<1>(++var(w[1])),
case_statement<2>(++var(w[2])),
case_statement<3>(++var(w[3])),
case_statement<4>(++var(w[4])),
case_statement<5>(++var(w[5])),
case_statement<6>(++var(w[6])),
case_statement<7>(++var(w[7]))
)
);
BOOST_CHECK(check(w, 7));
std::fill_n(w.begin(), 10, 0);
// ---
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0])),
case_statement<1>(++var(w[1])),
case_statement<2>(++var(w[2])),
case_statement<3>(++var(w[3])),
case_statement<4>(++var(w[4])),
case_statement<5>(++var(w[5])),
case_statement<6>(++var(w[6])),
case_statement<7>(++var(w[7])),
case_statement<8>(++var(w[8]))
)
);
BOOST_CHECK(check(w, 8));
std::fill_n(w.begin(), 10, 0);
}
void do_switch_yes_defaults_tests() {
using namespace boost::lambda;
int i = 0;
std::vector<int> v,w;
// elements from 0 to 9
std::generate_n(std::back_inserter(v),
10,
var(i)++);
std::fill_n(std::back_inserter(w), 10, 0);
int default_count;
// ---
default_count = 0;
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
default_statement(++var(default_count))
)
);
BOOST_CHECK(check(w, -1));
BOOST_CHECK(default_count == 10);
std::fill_n(w.begin(), 10, 0);
// ---
default_count = 0;
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0])),
default_statement(++var(default_count))
)
);
BOOST_CHECK(check(w, 0));
BOOST_CHECK(default_count == 9);
std::fill_n(w.begin(), 10, 0);
// ---
default_count = 0;
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0])),
case_statement<1>(++var(w[1])),
default_statement(++var(default_count))
)
);
BOOST_CHECK(check(w, 1));
BOOST_CHECK(default_count == 8);
std::fill_n(w.begin(), 10, 0);
// ---
default_count = 0;
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0])),
case_statement<1>(++var(w[1])),
case_statement<2>(++var(w[2])),
default_statement(++var(default_count))
)
);
BOOST_CHECK(check(w, 2));
BOOST_CHECK(default_count == 7);
std::fill_n(w.begin(), 10, 0);
// ---
default_count = 0;
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0])),
case_statement<1>(++var(w[1])),
case_statement<2>(++var(w[2])),
case_statement<3>(++var(w[3])),
default_statement(++var(default_count))
)
);
BOOST_CHECK(check(w, 3));
BOOST_CHECK(default_count == 6);
std::fill_n(w.begin(), 10, 0);
// ---
default_count = 0;
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0])),
case_statement<1>(++var(w[1])),
case_statement<2>(++var(w[2])),
case_statement<3>(++var(w[3])),
case_statement<4>(++var(w[4])),
default_statement(++var(default_count))
)
);
BOOST_CHECK(check(w, 4));
BOOST_CHECK(default_count == 5);
std::fill_n(w.begin(), 10, 0);
// ---
default_count = 0;
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0])),
case_statement<1>(++var(w[1])),
case_statement<2>(++var(w[2])),
case_statement<3>(++var(w[3])),
case_statement<4>(++var(w[4])),
case_statement<5>(++var(w[5])),
default_statement(++var(default_count))
)
);
BOOST_CHECK(check(w, 5));
BOOST_CHECK(default_count == 4);
std::fill_n(w.begin(), 10, 0);
// ---
default_count = 0;
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0])),
case_statement<1>(++var(w[1])),
case_statement<2>(++var(w[2])),
case_statement<3>(++var(w[3])),
case_statement<4>(++var(w[4])),
case_statement<5>(++var(w[5])),
case_statement<6>(++var(w[6])),
default_statement(++var(default_count))
)
);
BOOST_CHECK(check(w, 6));
BOOST_CHECK(default_count == 3);
std::fill_n(w.begin(), 10, 0);
// ---
default_count = 0;
std::for_each(v.begin(), v.end(),
switch_statement(
_1,
case_statement<0>(++var(w[0])),
case_statement<1>(++var(w[1])),
case_statement<2>(++var(w[2])),
case_statement<3>(++var(w[3])),
case_statement<4>(++var(w[4])),
case_statement<5>(++var(w[5])),
case_statement<6>(++var(w[6])),
case_statement<7>(++var(w[7])),
default_statement(++var(default_count))
)
);
BOOST_CHECK(check(w, 7));
BOOST_CHECK(default_count == 2);
std::fill_n(w.begin(), 10, 0);
}
void test_empty_cases() {
using namespace boost::lambda;
// ---
switch_statement(
_1,
default_statement()
)(make_const(1));
switch_statement(
_1,
case_statement<1>()
)(make_const(1));
}
int test_main(int, char* []) {
do_switch_no_defaults_tests();
do_switch_yes_defaults_tests();
test_empty_cases();
return EXIT_SUCCESS;
}