2
0
mirror of https://github.com/boostorg/lambda.git synced 2026-01-21 04:52:25 +00:00

Compare commits

..

147 Commits

Author SHA1 Message Date
Peter Dimov
0068b4d90d Update ci.yml 2025-05-03 03:20:27 +03:00
Peter Dimov
9b378ee3d0 Merge pull request #28 from grafikrobot/modular
Add support for modular build structure.
2025-05-02 19:13:07 +03:00
Rene Rivera
eb079473e2 Move project global include to target local include. 2025-04-07 17:37:01 -05:00
Rene Rivera
8e2446440c Sync from upstream. 2025-04-04 21:39:38 -05:00
Peter Dimov
593ddc7382 Apply Node20 workaround 2025-02-08 18:55:43 +02:00
Peter Dimov
9fd5cd190e Update test/CMakeLists.txt 2025-02-08 18:53:27 +02:00
Peter Dimov
cd036b65e2 Update ci.yml 2025-02-08 18:50:51 +02:00
Rene Rivera
7e792bbbef Update build deps. 2024-08-03 16:10:28 -05:00
Rene Rivera
bd56ab5976 Move inter-lib dependencies to a project variable and into the build targets. 2024-07-23 22:34:22 -05:00
Rene Rivera
717daf5483 Update copyright dates. 2024-07-20 22:52:03 -05:00
Rene Rivera
b3d68b5e4e Change all <source> references to <library>. 2024-07-20 19:40:11 -05:00
Rene Rivera
f26babea3c Bump B2 require to 5.2 2024-06-14 11:33:55 -05:00
Rene Rivera
0d1820513c Add requires-b2 check to top-level build file. 2024-05-05 09:00:01 -05:00
Rene Rivera
5968889209 Switch to library requirements instead of source. As source puts extra source in install targets. 2024-03-29 21:15:59 -05:00
Rene Rivera
ea61b3aa85 Make the library modular usable. 2024-03-11 08:38:17 -05:00
Peter Dimov
1555e9c7ff Update ci.yml 2023-11-17 17:21:43 +02:00
Peter Dimov
a3956c27c7 Remove C++03 compilers from appveyor.yml 2023-11-17 01:00:35 +02:00
Peter Dimov
ac26514243 Include boost/config.hpp in construct.hpp 2021-12-28 01:06:03 +02:00
Peter Dimov
6b124b66f7 Merge pull request #25 from RaisinTen/use-forward-in-construct.hpp
Use variadic templates to get rid of manual overloads in construct.hpp
2021-12-28 01:02:21 +02:00
Darshan Sen
568a4d2a63 Use variadic templates to get rid of manual overloads in construct.hpp
There is no need to write the overloads manually and limiting our users
to a max of 10 arguments when we can forward universal references to the
constructors.

Signed-off-by: Darshan Sen <darshan.sen@postman.com>
2021-12-27 12:01:24 +05:30
Peter Dimov
40b6f20419 Merge branch 'feature/issue-24' into develop 2021-12-27 00:14:01 +02:00
Peter Dimov
69dd8dd887 Include the definitions of the operator actions in bind.hpp (fixes #24) 2021-12-26 21:07:12 +02:00
Peter Dimov
b17a0c91cd Install libc++-12-dev 2021-12-26 20:52:22 +02:00
Peter Dimov
3bdaf7096d Add clang-12 w/ libc++ to ci.yml 2021-12-26 20:13:51 +02:00
Peter Dimov
0b84b23cf7 Disable issue24_test under C++03, as it uses std::function 2021-12-26 19:45:56 +02:00
Peter Dimov
0d81c1d25d Add issue24_test (refs #24) 2021-12-26 19:33:34 +02:00
Peter Dimov
cedabad897 Merge pull request #22 from eldiener/develop
[skip ci] Add "cxxstd" json field
2021-12-26 19:08:13 +02:00
Peter Dimov
24be4d3fe5 Add Boost::function to LINK_LIBRARIES 2021-12-26 17:52:59 +02:00
Peter Dimov
9709c066fe Disable failing test under msvc-14.0/release 2021-12-26 17:51:51 +02:00
Peter Dimov
dbca56c00f Disable failing test under msvc-12.0 and below 2021-12-26 17:36:36 +02:00
Peter Dimov
074bc275c8 Add Boost::any to LINK_LIBRARIES 2021-12-26 17:34:14 +02:00
Peter Dimov
b873d8ef81 Fix bind_test_advanced under C++20 2021-12-26 17:32:28 +02:00
Peter Dimov
4bdbb29860 Add CMake test files 2021-12-26 16:46:14 +02:00
Peter Dimov
e81d400b03 Add .github/workflows 2021-12-26 16:36:27 +02:00
Peter Dimov
5d87ace1e6 Update appveyor.yml 2021-12-26 16:36:11 +02:00
Peter Dimov
4007043b54 Merge branch 'feature/lwt' into develop 2021-05-18 06:21:38 +03:00
Peter Dimov
ca87d33f3d Disable UBSan on libc++ configuration; Clang 7 fails with a link error 2021-05-18 05:18:49 +03:00
Peter Dimov
95e1de198e Switch to LightweightTest to avoid deprecation warnings 2021-05-18 04:55:56 +03:00
Peter Dimov
86451f2238 Update test/Jamfile 2021-05-18 04:36:24 +03:00
Peter Dimov
a96b87e777 Merge branch 'develop' of https://github.com/Jac1494/lambda into feature/pr-17 2021-05-18 04:16:22 +03:00
Peter Dimov
bbbe1a9041 Update .travis.yml 2021-05-18 03:20:52 +03:00
Peter Dimov
1a8f8cfead Update .travis.yml 2021-05-18 03:18:03 +03:00
Peter Dimov
7be3075575 Merge branch 'develop' 2021-05-18 03:10:07 +03:00
Peter Dimov
ddf7dfe25e Add CMakeLists.txt 2021-03-19 04:33:05 +02:00
Edward Diener
b90488068a [skip ci] Add "cxxstd" json field. The "cxxstd" json field is being added to each Boost library's meta json information for libraries in order to specify the minumum C++ standard compilation level. The value of this field matches one of the values for 'cxxstd' in Boost.Build. The purpose of doing this is to provide information for the Boost website documentation for each library which will specify the minimum C++ standard compilation that an end-user must employ in order to use the particular library. This will aid end-users who want to know if they can successfully use a Boost library based on their C++ compiler's compilation level, without having to search the library's documentation to find this out. 2021-01-20 13:08:07 -05:00
Glen Fernandes
8de6d9cb9f Make all include guards BOOST_LAMBDA_ prefixed 2019-12-24 18:54:19 -05:00
Jaydeep Chauhan
641dd2b0a6 Disabled one test which returns local address 2019-07-25 18:19:15 +05:30
Glen Fernandes
d27fc70114 Merge pull request #14 from tinko92/develop
Fix broken sgi/stl links.
2019-04-24 05:49:02 +10:00
Tinko Bartels
1c11cf9570 Fix broken sgi/stl links. 2019-04-23 19:38:24 +02:00
Edward Diener
7355f36b9f Updated for b2 cmake support. 2018-12-19 22:30:41 -05:00
Edward Diener
8824e81d52 Merge branch 'develop' 2018-10-25 22:20:53 -04:00
Edward Diener
6395013860 Merge pull request #13 from danieljames/remove-random-shuffle-support-when-appropriate
Only support std::random_shuffle when available
2018-04-19 23:43:00 -04:00
Daniel James
8c0410fff5 Only support std::random_shuffle when available
It was removed in C++17. We could emulate it when it isn't available,
but that doesn't seem worth the effort.
2018-04-07 15:10:29 +01:00
Edward Diener
b8a2f400ac Merge branch 'develop' 2018-02-20 09:07:34 -05:00
Edward Diener
4fc4454f3e Merge pull request #12 from Kojoley/fix-unused-variable-warnings-from-core_hpp
Fixed unused variable warnings from core.hpp
2017-11-11 13:39:03 -05:00
Nikita Kniazev
02999cca47 Fixed unused variable warnings from core.hpp 2017-11-10 15:48:28 +03:00
eldiener
e8eda93ef0 Merge branch 'develop' 2017-10-30 11:44:46 -04:00
eldiener
9d171774af Removed --depth 1 2017-10-29 21:44:06 -04:00
eldiener
f4b5e00a4f Merge branch 'develop' 2017-10-27 22:27:04 -04:00
Edward Diener
42b499ec9b Better appveyor file setup. 2017-10-09 12:08:07 -04:00
Edward Diener
61119a8e37 Added Appveyor file and Travis CI file. 2017-10-09 08:18:50 -04:00
Edward Diener
4b00716f5f Merge branch 'develop' 2017-09-26 12:05:44 -04:00
Edward Diener
4baf512ed2 Removed executable flag. 2017-09-16 06:59:04 -04:00
Edward Diener
4c0ef8e469 Merge branch 'develop' 2017-01-04 11:21:46 -05:00
Edward Diener
18bc9b84cb Updated link for fc++. 2016-12-19 20:23:07 -05:00
Edward Diener
ad5673c9de Use std::bind instead of std::bind1st when appropriate 2016-11-07 12:42:43 -05:00
Rene Rivera
8d9106ab17 Add, and update, documentation build targets. 2016-10-10 11:39:50 -05:00
Rene Rivera
f12bd0ef93 Add, and update, documentation build targets. 2016-10-07 23:07:34 -05:00
Edward Diener
b788075b6d Merge branch 'develop' 2015-10-16 21:38:07 -04:00
Edward Diener
5508ede384 Merge pull request #10 from mclow/develop
Remove mentions of deprecated macros
2015-09-11 04:40:43 -04:00
Marshall Clow
e4b5434e27 Remove mentions of deprecated macros in documentation 2015-09-10 20:01:11 -07:00
Edward Diener
4c4387a277 Merge branch 'develop' 2015-07-19 00:12:41 -04:00
Edward Diener
0f44d72275 Remove unnecessary header. 2015-05-18 19:55:22 -04:00
Edward Diener
723485bfa7 Merge branch 'develop' of https://github.com/boostorg/lambda into develop 2015-05-18 19:05:23 -04:00
Edward Diener
f85d2f0025 Merge pull request #9 from eldiener/develop
Changes for type_traits Version2
2015-05-18 19:04:38 -04:00
Edward Diener
45c391b380 Merge branch 'develop' of https://github.com/boostorg/lambda into develop 2015-05-18 19:03:04 -04:00
Edward Diener
69482a3b49 Merge pull request #6 from alexhenrie/develop
Correct spelling of "suppress"
2015-05-18 18:46:55 -04:00
Edward Diener
0afac59bc1 Merge pull request #4 from jzmaddock/patch-5
Update operator_return_type_traits.hpp
2015-05-18 18:43:23 -04:00
Edward Diener
5a6ae7f79d Merge pull request #3 from jzmaddock/patch-4
Update return_type_traits.hpp
2015-05-18 18:42:17 -04:00
Edward Diener
9a581dafb7 Added 'void const' specialization to fix problem with clang 2015-05-06 16:23:39 -04:00
Edward Diener
5e574813a2 Simplifed using direct operators rather than mpl constructs. 2015-04-27 03:00:19 -04:00
Edward Diener
11a6698eec Remove ice_xxx.hpp header and change functionality to use mpl. 2015-03-31 03:32:50 -04:00
Edward Diener
5ba2e0aa6a This file needs to include the type_traits headers it actually uses - problem exposed by ongoing type traits rewrite. 2015-03-05 11:02:49 -05:00
Edward Diener
59e1516609 This header should include the type_traits headers it needs and not depend on implicit inclusion which will go away in the current type_traits rewrite. 2015-03-05 11:02:19 -05:00
Alex Henrie
fba5d5e822 Correct spelling of "suppress" 2015-02-07 01:57:05 -07:00
jzmaddock
635d0fb6ce Update operator_return_type_traits.hpp
This file needs to include the type_traits headers it actually uses - problem exposed by ongoing type traits rewrite.
2015-01-21 17:03:07 +00:00
jzmaddock
ba8e62af76 Update return_type_traits.hpp
This header should include the type_traits hedaers it needs and not depend on implicit inclusion which will go away in the current type_traits rewrite.
2015-01-21 17:00:41 +00:00
Noel Belcourt
545b6af540 Merge pull request #1 from jzmaddock/patch-2
Update Jamfile.v2

Thanks John.
2014-11-02 15:44:45 -07:00
Noel Belcourt
ce6b030b06 Merge pull request #2 from danieljames/metadata
Create metadata file.
2014-09-01 20:33:39 -06:00
Daniel James
ecf547cbef Add metadata file. 2014-08-18 15:55:52 +01:00
jzmaddock
aef7c9fe51 Update Jamfile.v2
There can be only one project named boost/doc - and we already have that under doc/
This fixes the PDF doc build.
2014-08-13 18:29:22 +01:00
Daniel James
677be04dd7 Create merge base for git. 2014-06-01 19:21:47 +01:00
Daniel James
7d1d0d4fdd Remove file accidentally recreated by git conversion.
Some old files deleted in the CVS days were accidentally restored, this
appears to be one of them. You can see it wasn't in subversion at:

http://svn.boost.org/svn/boost/trunk/libs/lambda/
2014-06-01 19:20:51 +01:00
Stephen Kelly
7d21ea7cbb Lambda: Remove obsolete GCC version checks.
[SVN r86072]
2013-09-30 16:00:14 +00:00
Stephen Kelly
0d069c2c0c Remove use of obsolete BOOST_NO_TEMPLATED_STREAMS macro.
It was only defined for no-longer-supported-gcc.

[SVN r86062]
2013-09-30 15:56:52 +00:00
Steven Watanabe
25d6c0e3b1 Merge lambda from the trunk.
[SVN r83442]
2013-03-15 18:07:37 +00:00
Steven Watanabe
4545234f94 Handle const lambda functors for nullary result_of. Fixes #6914.
[SVN r83020]
2013-02-19 19:52:03 +00:00
Steven Watanabe
657a0b9dd7 Handle nullary result_of. Fixes #6914.
[SVN r82935]
2013-02-16 20:26:34 +00:00
Steven Watanabe
fab5a8041b Remove name of unused parameter. Fixes #8033.
[SVN r82932]
2013-02-16 20:01:07 +00:00
Marshall Clow
55cd962166 Merge comment typo fixes to release; Fixes #7714
[SVN r82236]
2012-12-28 16:54:24 +00:00
Marshall Clow
9c376db7e5 Fixed 'the the' in comments; Refs #7714
[SVN r82235]
2012-12-28 16:51:09 +00:00
Steven Watanabe
3caa685662 Merge [67640] from the trunk.
[SVN r70065]
2011-03-17 16:29:28 +00:00
Steven Watanabe
2ed8d7f4df Fix return type deduction for pointers to data members. Fixes #4962. Fixes #4566.
[SVN r67640]
2011-01-03 22:31:21 +00:00
Daniel Walker
2c14c3a13b merged changeset 63726 from trunk
[SVN r63907]
2010-07-12 01:36:38 +00:00
Daniel Walker
4091f55a4b removed arity detection from has_xxx_template
[SVN r63726]
2010-07-07 20:44:59 +00:00
Steven Watanabe
0d0f71272e Merge lambda from the trunk
[SVN r63555]
2010-07-03 19:05:15 +00:00
Daniel James
08b3f6336c Merge documentation fixes.
* Use `doc/src/*.css` instead of `doc/html/*.css`.
* Remove wiki and people directories.
* Some documentation fixes.
* Left out `minimal.css` changes and boostbook changes because of clashes.


[SVN r63347]
2010-06-26 12:30:09 +00:00
Daniel James
45c6ba535c Update various libraries' documentation build.
Mostly to use the images and css files under doc/src instead of
doc/html, usually be deleting the settings in order to use the defaults.
Also add 'boost.root' to some builds in order to fix links which rely on
it.

[SVN r63146]
2010-06-20 18:00:48 +00:00
Steven Watanabe
57a605d7cc Revert [62617], since there is already a Jamfile for Lambda's tests
[SVN r62628]
2010-06-09 02:10:06 +00:00
Steven Watanabe
fcfcc42baf Enable using result_of with Boost.Lambda. Fixes #426. Fixes #864
[SVN r62627]
2010-06-09 01:39:48 +00:00
Jeremiah Willcock
c516504670 Changed compound assignment (and actually all binary operators) to copy their RHS arguments like the documentation said; added a test for this; fixes #4043
[SVN r62620]
2010-06-09 00:33:25 +00:00
Jeremiah Willcock
c479b3b7b7 Fixed warning
[SVN r62619]
2010-06-09 00:31:02 +00:00
Jeremiah Willcock
269ac93b1b Added Jamfile.v2 from Daniel Walker; refs #864
[SVN r62617]
2010-06-09 00:16:43 +00:00
Steven Watanabe
15d4e6ab79 Make sure that all top level headers in Lambda include their dependencies. Fixes #4203
[SVN r61881]
2010-05-09 20:07:07 +00:00
Steven Watanabe
77495bb7e1 Deal with warnings with /Za. Fixes #3485
[SVN r57479]
2009-11-08 04:11:21 +00:00
Troy D. Straszheim
c183b699bc rm cmake from trunk. I'm not entirely sure this is necessary to satisfy the inspect script, but I'm not taking any chances, and it is easy to put back
[SVN r56942]
2009-10-17 02:07:38 +00:00
Troy D. Straszheim
e368877636 rm cmake from the release branch before it goes out broken. Policy dictates that you never commit to release, you commit to trunk and merge to release.
[SVN r56941]
2009-10-17 01:10:45 +00:00
Troy D. Straszheim
3d4a3e7050 Copyrights on CMakeLists.txt to keep them from clogging up the inspect
reports.  This is essentially the same commit as r55095 on the release
branch.



[SVN r55159]
2009-07-26 00:49:56 +00:00
Troy D. Straszheim
22bc52b7c4 Add basic copyright/license to keep cmake out of the inspection report
[SVN r55095]
2009-07-22 21:51:01 +00:00
Steven Watanabe
8a943f6510 Merge [43113], [45097], [53261], [53343], [53648], [53649], and [53651] from the trunk
[SVN r53875]
2009-06-13 21:18:10 +00:00
Steven Watanabe
c14095472e Don't propagate constness from pointer to pointee. Fixes #1572
[SVN r53651]
2009-06-05 02:43:54 +00:00
Steven Watanabe
1afc4b6779 Use boost/detail/container_fwd.hpp. Fixes #2601
[SVN r53649]
2009-06-05 01:43:39 +00:00
Steven Watanabe
41eb864595 Add result_type to lambda::ret. Fixes #1222
[SVN r53648]
2009-06-05 01:20:06 +00:00
Jeremiah Willcock
0f60055086 Fixed tabs
[SVN r53343]
2009-05-28 14:49:25 +00:00
Steven Watanabe
d69f83d074 Merge [53061] and [53233] from the trunk
[SVN r53266]
2009-05-26 00:59:17 +00:00
Steven Watanabe
9a8e5d7784 Fix lambda regression with msvc 7.1
[SVN r53261]
2009-05-25 21:52:12 +00:00
Steven Watanabe
6985fca6ee Avoid ambiguities between boost::lambda::bind and std::bind with VC10. Fixes #3075
[SVN r53233]
2009-05-24 22:58:52 +00:00
Steven Watanabe
04ae944c3c Avoid using namespace std; to prevent ambiguity between boost and std components. Fixes #3025
[SVN r53061]
2009-05-17 00:25:06 +00:00
Steven Watanabe
0c4e251ebe Supress warnings on gcc and msvc. Fixes #1515
[SVN r51448]
2009-02-26 02:33:15 +00:00
John Maddock
0faeb3f19e Add Jamfile to build PDF versions of all the docs.
Tweaked some existing Jamfiles so that PDF build finds all the necessary image files etc.
Tweaked fo.xsl to provide more options by default, and improve formatting.

[SVN r51104]
2009-02-08 16:59:14 +00:00
Steven Watanabe
150736273e Add <async-exceptions>on. Fixes #2446
[SVN r50999]
2009-02-03 21:47:58 +00:00
Steven Watanabe
d5a98758fa Add specializations of plain_return_type_2 for std::string. Fixes #781
[SVN r50516]
2009-01-08 16:58:48 +00:00
Marshall Clow
cd3d5fd03a Typo: fixes bug #2583
[SVN r50413]
2008-12-30 18:27:43 +00:00
Michael A. Jackson
48a89b7705 Updating dependency information for modularized libraries.
[SVN r49628]
2008-11-07 17:05:27 +00:00
Michael A. Jackson
ec350abf06 Updating CMake files to latest trunk. Added dependency information for regression tests and a few new macros for internal use.
[SVN r49627]
2008-11-07 17:02:56 +00:00
Michael A. Jackson
d56abd61ce Continuing merge of CMake build system files into trunk with the encouragement of Doug Gregor
[SVN r49510]
2008-11-01 13:15:41 +00:00
Beman Dawes
2788ede42a With his kind permission, change Jaakko "Järvi" to "Jarvi"
[SVN r46808]
2008-06-28 13:45:21 +00:00
Marshall Clow
1c953ed38c Updated docs re bug #1855
[SVN r45097]
2008-05-03 23:45:30 +00:00
Marshall Clow
b2dc95bb18 Applied patch (fixes bug #1307)
[SVN r43113]
2008-02-05 16:15:35 +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
57 changed files with 1972 additions and 917 deletions

643
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,643 @@
name: CI
on:
pull_request:
push:
branches:
- master
- develop
- feature/**
env:
UBSAN_OPTIONS: print_stacktrace=1
jobs:
posix:
strategy:
fail-fast: false
matrix:
include:
- toolset: gcc-4.8
cxxstd: "11"
os: ubuntu-latest
container: ubuntu:18.04
install: g++-4.8
- toolset: gcc-5
cxxstd: "11,14,1z"
os: ubuntu-latest
container: ubuntu:18.04
install: g++-5
- toolset: gcc-6
cxxstd: "11,14,1z"
os: ubuntu-latest
container: ubuntu:18.04
install: g++-6
- toolset: gcc-7
cxxstd: "11,14,17"
container: ubuntu:20.04
os: ubuntu-latest
install: g++-7
- toolset: gcc-8
cxxstd: "11,14,17,2a"
container: ubuntu:20.04
os: ubuntu-latest
install: g++-8
- toolset: gcc-9
cxxstd: "11,14,17,2a"
container: ubuntu:20.04
os: ubuntu-latest
- toolset: gcc-10
cxxstd: "11,14,17,2a"
container: ubuntu:20.04
os: ubuntu-latest
install: g++-10
- toolset: gcc-11
cxxstd: "11,14,17,2a"
os: ubuntu-22.04
- toolset: gcc-12
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
install: g++-12
- toolset: gcc-13
cxxstd: "11,14,17,20,2b"
container: ubuntu:24.04
os: ubuntu-latest
install: g++-13
- toolset: gcc-14
cxxstd: "11,14,17,20,2b"
container: ubuntu:24.04
os: ubuntu-latest
install: g++-14
- toolset: clang
compiler: clang++-3.9
cxxstd: "11,14"
os: ubuntu-latest
container: ubuntu:18.04
install: clang-3.9
- toolset: clang
compiler: clang++-4.0
cxxstd: "11,14"
os: ubuntu-latest
container: ubuntu:18.04
install: clang-4.0
- toolset: clang
compiler: clang++-5.0
cxxstd: "11,14,1z"
os: ubuntu-latest
container: ubuntu:18.04
install: clang-5.0
- toolset: clang
compiler: clang++-6.0
cxxstd: "11,14,17"
container: ubuntu:20.04
os: ubuntu-latest
install: clang-6.0
- toolset: clang
compiler: clang++-7
cxxstd: "11,14,17"
container: ubuntu:20.04
os: ubuntu-latest
install: clang-7
- toolset: clang
compiler: clang++-8
cxxstd: "11,14,17"
container: ubuntu:20.04
os: ubuntu-latest
install: clang-8
- toolset: clang
compiler: clang++-9
cxxstd: "11,14,17,2a"
container: ubuntu:20.04
os: ubuntu-latest
install: clang-9
- toolset: clang
compiler: clang++-10
cxxstd: "11,14,17,2a"
container: ubuntu:20.04
os: ubuntu-latest
install: clang-10
- toolset: clang
compiler: clang++-11
cxxstd: "11,14,17,2a"
container: ubuntu:20.04
os: ubuntu-latest
install: clang-11
- toolset: clang
compiler: clang++-12
cxxstd: "11,14,17,2a"
container: ubuntu:20.04
os: ubuntu-latest
install: clang-12
- toolset: clang
compiler: clang++-13
cxxstd: "11,14,17,20,2b"
container: ubuntu:22.04
os: ubuntu-latest
install: clang-13
- toolset: clang
compiler: clang++-14
cxxstd: "11,14,17,20,2b"
container: ubuntu:22.04
os: ubuntu-latest
install: clang-14
- toolset: clang
compiler: clang++-15
cxxstd: "11,14,17,20,2b"
container: ubuntu:22.04
os: ubuntu-latest
install: clang-15
- toolset: clang
compiler: clang++-16
cxxstd: "11,14,17,20,2b"
container: ubuntu:24.04
os: ubuntu-latest
install: clang-16
- toolset: clang
compiler: clang++-17
cxxstd: "11,14,17,20,2b"
container: ubuntu:24.04
os: ubuntu-latest
install: clang-17
- toolset: clang
compiler: clang++-18
cxxstd: "11,14,17,20,2b"
container: ubuntu:24.04
os: ubuntu-latest
install: clang-18
- toolset: clang
cxxstd: "11,14,17,20,2b"
os: macos-13
- toolset: clang
cxxstd: "11,14,17,20,2b"
os: macos-14
- toolset: clang
cxxstd: "11,14,17,20,2b"
os: macos-15
runs-on: ${{matrix.os}}
container:
image: ${{matrix.container}}
volumes:
- /node20217:/node20217:rw,rshared
- ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }}
defaults:
run:
shell: bash
steps:
- name: Setup container environment
if: matrix.container
run: |
apt-get update
apt-get -y install sudo python3 git g++ curl xz-utils
- name: Install nodejs20glibc2.17
if: ${{ startsWith( matrix.container, 'ubuntu:1' ) }}
run: |
curl -LO https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz
tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217
ldd /__e/node20/bin/node
- uses: actions/checkout@v4
- name: Install packages
if: matrix.install
run: |
sudo apt-get update
sudo apt-get -y install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python3 tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
./bootstrap.sh
./b2 -d0 headers
- name: Create user-config.jam
if: matrix.compiler
run: |
echo "using ${{matrix.toolset}} : : ${{matrix.compiler}} ;" > ~/user-config.jam
- name: Run tests
run: |
cd ../boost-root
STDLIB=${{matrix.stdlib}}
./b2 -j3 libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release ${STDLIB:+stdlib=$STDLIB}
windows:
strategy:
fail-fast: false
matrix:
include:
- toolset: msvc-14.0
cxxstd: "14,latest"
addrmd: 32,64
os: windows-2019
- toolset: msvc-14.2
cxxstd: "14,17,20,latest"
addrmd: 32,64
os: windows-2019
- toolset: msvc-14.3
cxxstd: "14,17,20,latest"
addrmd: 32,64
os: windows-2022
- toolset: clang-win
cxxstd: "14,17,latest"
addrmd: 32,64
os: windows-2022
- toolset: gcc
cxxstd: "11,14,17,2a"
addrmd: 64
os: windows-2019
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
cmd /c bootstrap
b2 -d0 headers
- name: Run tests
shell: cmd
run: |
cd ../boost-root
b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release
posix-cmake-subdir:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
- os: ubuntu-24.04
- os: macos-13
- os: macos-14
- os: macos-15
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install packages
if: matrix.install
run: sudo apt install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
- name: Use library with add_subdirectory
run: |
cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test
mkdir __build__ && cd __build__
cmake ..
cmake --build .
ctest --output-on-failure --no-tests=error
posix-cmake-install:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
- os: ubuntu-24.04
- os: macos-13
- os: macos-14
- os: macos-15
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install packages
if: matrix.install
run: sudo apt install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
- name: Configure
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local ..
- name: Install
run: |
cd ../boost-root/__build__
cmake --build . --target install
- name: Use the installed library
run: |
cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__
cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
cmake --build .
ctest --output-on-failure --no-tests=error
posix-cmake-test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
- os: ubuntu-24.04
- os: macos-13
- os: macos-14
- os: macos-15
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install packages
if: matrix.install
run: sudo apt install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
- name: Configure
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON ..
- name: Build tests
run: |
cd ../boost-root/__build__
cmake --build . --target tests
- name: Run tests
run: |
cd ../boost-root/__build__
ctest --output-on-failure --no-tests=error
windows-cmake-subdir:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
- name: Use library with add_subdirectory (Debug)
shell: cmd
run: |
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test
mkdir __build__ && cd __build__
cmake ..
cmake --build . --config Debug
ctest --output-on-failure --no-tests=error -C Debug
- name: Use library with add_subdirectory (Release)
shell: cmd
run: |
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test/__build__
cmake --build . --config Release
ctest --output-on-failure --no-tests=error -C Release
windows-cmake-install:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
- name: Configure
shell: cmd
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
- name: Install (Debug)
shell: cmd
run: |
cd ../boost-root/__build__
cmake --build . --target install --config Debug
- name: Install (Release)
shell: cmd
run: |
cd ../boost-root/__build__
cmake --build . --target install --config Release
- name: Use the installed library (Debug)
shell: cmd
run: |
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test && mkdir __build__ && cd __build__
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
cmake --build . --config Debug
ctest --output-on-failure --no-tests=error -C Debug
- name: Use the installed library (Release)
shell: cmd
run: |
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test/__build__
cmake --build . --config Release
ctest --output-on-failure --no-tests=error -C Release
windows-cmake-test:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
- name: Configure
shell: cmd
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DBUILD_TESTING=ON ..
- name: Build tests (Debug)
shell: cmd
run: |
cd ../boost-root/__build__
cmake --build . --target tests --config Debug
- name: Run tests (Debug)
shell: cmd
run: |
cd ../boost-root/__build__
ctest --output-on-failure --no-tests=error -C Debug
- name: Build tests (Release)
shell: cmd
run: |
cd ../boost-root/__build__
cmake --build . --target tests --config Release
- name: Run tests (Release)
shell: cmd
run: |
cd ../boost-root/__build__
ctest --output-on-failure --no-tests=error -C Release

163
.travis.yml Normal file
View File

@@ -0,0 +1,163 @@
# Copyright 2016 Edward Diener
# Copyright 2016, 2017, 2021 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
language: cpp
dist: xenial
branches:
only:
- master
- develop
- /feature\/.*/
env:
matrix:
- BOGUS_JOB=true
matrix:
exclude:
- env: BOGUS_JOB=true
include:
- os: linux
compiler: g++-4.4
env: TOOLSET=gcc CXXSTD=98
addons:
apt:
packages:
- g++-4.4
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.6
env: TOOLSET=gcc CXXSTD=03,0x
addons:
apt:
packages:
- g++-4.6
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.8
env: TOOLSET=gcc CXXSTD=03,11
addons:
apt:
packages:
- g++-4.8
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-5
env: TOOLSET=gcc CXXSTD=03,11,14
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-7
env: TOOLSET=gcc CXXSTD=03,11,14,17
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-9
env: TOOLSET=gcc CXXSTD=03,11,14,17
addons:
apt:
packages:
- g++-9
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: bionic
compiler: g++-10
env: TOOLSET=gcc CXXSTD=03,11,14,17,2a
addons:
apt:
packages:
- g++-10
sources:
- sourceline: "ppa:ubuntu-toolchain-r/test"
- os: linux
dist: bionic
compiler: g++-11
env: UBSAN=1 TOOLSET=gcc CXXSTD=03,11,14,17,20 UBSAN_OPTIONS=print_stacktrace=1 LINKFLAGS=-fuse-ld=gold
addons:
apt:
packages:
- g++-11
sources:
- sourceline: "ppa:ubuntu-toolchain-r/test"
- os: linux
compiler: clang++-11
env: TOOLSET=clang CXXSTD=03,11,14,17,20
addons:
apt:
packages:
- clang-11
sources:
- ubuntu-toolchain-r-test
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-11 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
- os: linux
compiler: clang++-12
env: UBSAN=1 TOOLSET=clang CXXSTD=03,11,14,17,20 UBSAN_OPTIONS=print_stacktrace=1
addons:
apt:
packages:
- clang-12
sources:
- ubuntu-toolchain-r-test
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-12 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
- os: linux
dist: bionic
compiler: clang++-libc++
env: TOOLSET=clang CXXSTD=03,11,14,17,2a
addons:
apt:
packages:
- libc++-dev
- os: osx
compiler: clang++
env: UBSAN=1 TOOLSET=clang CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- cd ..
- git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule update --init tools/boostdep
- cp -r $TRAVIS_BUILD_DIR/* libs/lambda
- python tools/boostdep/depinst/depinst.py lambda
- ./bootstrap.sh
- ./b2 headers
script:
- |-
echo "using $TOOLSET : : $TRAVIS_COMPILER ;" > ~/user-config.jam
- ./b2 -j3 libs/lambda/test toolset=$TOOLSET cxxstd=$CXXSTD variant=debug,release ${UBSAN:+cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined linkflags=-fsanitize=undefined define=UBSAN=1 debug-symbols=on} ${LINKFLAGS:+linkflags=$LINKFLAGS}
notifications:
email:
on_success: always

View File

@@ -1,21 +1,34 @@
#----------------------------------------------------------------------------
# This file was automatically generated from the original CMakeLists.txt file
# Add a variable to hold the headers for the library
set (lib_headers
lambda
# Generated by `boostdep --cmake lambda`
# Copyright 2020 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.16)
project(boost_lambda VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_lambda INTERFACE)
add_library(Boost::lambda ALIAS boost_lambda)
target_include_directories(boost_lambda INTERFACE include)
target_link_libraries(boost_lambda
INTERFACE
Boost::bind
Boost::config
Boost::core
Boost::detail
Boost::iterator
Boost::mpl
Boost::preprocessor
Boost::tuple
Boost::type_traits
Boost::utility
)
# Add a library target to the build system
boost_library_project(
lambda
# SRCDIRS
TESTDIRS test
HEADERS ${lib_headers}
# DOCDIRS
# DESCRIPTION
MODULARIZED
# AUTHORS
# MAINTAINERS
)
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
add_subdirectory(test)
endif()

46
appveyor.yml Normal file
View File

@@ -0,0 +1,46 @@
# Copyright 2016-2021 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
version: 1.0.{build}-{branch}
shallow_clone: true
branches:
only:
- master
- develop
- /feature\/.*/
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-14.0
ADDRMD: 32,64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: msvc-14.1
CXXSTD: 14,17,latest
ADDRMD: 32,64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
TOOLSET: clang-win
CXXSTD: 14,17,latest
ADDRMD: 32,64
install:
- set BOOST_BRANCH=develop
- if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
- cd ..
- git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule update --init tools/boostdep
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\lambda\
- python tools/boostdep/depinst/depinst.py lambda
- cmd /c bootstrap
- b2 -d0 headers
build: off
test_script:
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
- if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
- b2 -j3 libs/lambda/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% variant=debug,release embed-manifest-via=linker

30
build.jam Normal file
View File

@@ -0,0 +1,30 @@
# Copyright René Ferdinand Rivera Morell 2023-2024
# 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)
require-b2 5.2 ;
constant boost_dependencies :
/boost/bind//boost_bind
/boost/config//boost_config
/boost/core//boost_core
/boost/detail//boost_detail
/boost/iterator//boost_iterator
/boost/mpl//boost_mpl
/boost/preprocessor//boost_preprocessor
/boost/tuple//boost_tuple
/boost/type_traits//boost_type_traits
/boost/utility//boost_utility ;
project /boost/lambda
;
explicit
[ alias boost_lambda : : :
: <include>include <library>$(boost_dependencies) ]
[ alias all : boost_lambda test ]
;
call-if : boost-library lambda
;

View File

@@ -1,4 +1,4 @@
project boost/doc ;
project lambda/doc ;
import boostbook : boostbook ;
# Are these really the correct images??
@@ -6,6 +6,16 @@ path-constant images : ../../spirit/phoenix/doc/html ;
boostbook lambda-doc : lambda.xml
:
<xsl:param>boost.root=../../../..
<format>pdf:<xsl:param>img.src.path=$(images)/
;
###############################################################################
alias boostdoc
: lambda.xml
:
:
: ;
explicit boostdoc ;
alias boostrelease ;
explicit boostrelease ;

View File

@@ -3281,7 +3281,7 @@ was dropped.
<abbrev>SGI02</abbrev>
<title>The SGI Standard Template Library</title>
<pubdate>2002</pubdate>
<bibliomisc><ulink url="http://www.sgi.com/tech/stl/">www.sgi.com/tech/stl/</ulink></bibliomisc>
<bibliomisc><ulink url="https://www.boost.org/sgi/stl/">www.boost.org/sgi/stl/</ulink></bibliomisc>
</biblioentry>
@@ -3435,7 +3435,7 @@ was dropped.
<firstname>Brian</firstname>
<surname>McNamara</surname>
</author>
<bibliomisc><ulink url="http://www.cc.gatech.edu/~yannis/fc++/">www.cc.gatech.edu/~yannis/fc++/</ulink>
<bibliomisc><ulink url="http://yanniss.github.io/fc++/">yanniss.github.io/fc++/ </ulink>
</bibliomisc>
<pubdate>2002</pubdate>
</biblioentry>

View File

@@ -44,7 +44,7 @@
<para>
The Boost Lambda Library (BLL in the sequel) is a C++ template
library, which implements form of <emphasis>lambda abstractions</emphasis> for C++.
library, which implements a form of <emphasis>lambda abstractions</emphasis> for C++.
The term originates from functional programming and lambda calculus, where a lambda abstraction defines an unnamed function.
The primary motivation for the BLL is to provide flexible and
convenient means to define unnamed function objects for STL algorithms.
@@ -3191,7 +3191,7 @@ to extend the library with new features.
<appendix>
<section>
<title>Rationale for some of the design decisions</title>
<section id="lambda.why_weak_arity">
@@ -3256,7 +3256,7 @@ was dropped.
</section>
</appendix>
</section>
@@ -3286,7 +3286,7 @@ was dropped.
<abbrev>SGI02</abbrev>
<title>The SGI Standard Template Library</title>
<pubdate>2002</pubdate>
<bibliomisc><ulink url="http://www.sgi.com/tech/stl/">www.sgi.com/tech/stl/</ulink></bibliomisc>
<bibliomisc><ulink url="https://www.boost.org/sgi/stl/">www.boost.org/sgi/stl/</ulink></bibliomisc>
</biblioentry>
@@ -3440,7 +3440,7 @@ was dropped.
<firstname>Brian</firstname>
<surname>McNamara</surname>
</author>
<bibliomisc><ulink url="http://www.cc.gatech.edu/~yannis/fc++/">www.cc.gatech.edu/~yannis/fc++/</ulink>
<bibliomisc><ulink url="http://yanniss.github.io/fc++/">yanniss.github.io/fc++/ </ulink>
</bibliomisc>
<pubdate>2002</pubdate>
</biblioentry>

View File

@@ -684,6 +684,8 @@ struct rotate_copy {
// random_shuffle ---------------------------------
#ifndef BOOST_NO_CXX98_RANDOM_SHUFFLE
struct random_shuffle {
template <class Args>
@@ -703,6 +705,7 @@ struct random_shuffle {
};
#endif
// partition ---------------------------------

View File

@@ -14,6 +14,11 @@
#include "boost/lambda/core.hpp"
// Required for std::is_assignable to work on the result of bind()
#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/bind_functions.hpp"
#endif

View File

@@ -15,12 +15,16 @@
#define BOOST_LAMBDA_CASTS_HPP
#include "boost/lambda/detail/suppress_unused.hpp"
#include "boost/lambda/core.hpp"
#include <typeinfo>
namespace boost {
namespace lambda {
template<class Act, class Args>
struct return_type_N;
template<class T> class cast_action;
template<class T> class static_cast_action;

View File

@@ -11,8 +11,8 @@
URL: http://spirit.sourceforge.net/
==============================================================================*/
#ifndef PHOENIX_CLOSURES_HPP
#define PHOENIX_CLOSURES_HPP
#ifndef BOOST_LAMBDA_CLOSURES_HPP
#define BOOST_LAMBDA_CLOSURES_HPP
///////////////////////////////////////////////////////////////////////////////
#include "boost/lambda/core.hpp"
@@ -251,7 +251,7 @@ private:
closure& operator=(closure const&); // no assign
template <int N, typename ClosureT>
friend struct closure_member;
friend class closure_member;
template <typename ClosureT>
friend class closure_frame;

View File

@@ -14,6 +14,14 @@
#if !defined(BOOST_LAMBDA_CONSTRUCT_HPP)
#define BOOST_LAMBDA_CONSTRUCT_HPP
#include "boost/type_traits/remove_cv.hpp"
#include "boost/type_traits/is_pointer.hpp"
#include "boost/config.hpp"
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#include <utility>
#endif
namespace boost {
namespace lambda {
@@ -25,6 +33,12 @@ template<class T> struct constructor {
template <class U> struct sig { typedef T type; };
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class... Args>
T operator()(Args&&... args) const {
return T(std::forward<Args>(args)...);
}
#else
T operator()() const {
return T();
}
@@ -78,6 +92,7 @@ template<class T> struct constructor {
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);
}
#endif
};
@@ -134,6 +149,12 @@ template<class T> struct new_ptr {
template <class U> struct sig { typedef T* type; };
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class... Args>
T* operator()(Args&&... args) const {
return new T(std::forward<Args>(args)...);
}
#else
T* operator()() const {
return new T();
}
@@ -187,6 +208,7 @@ template<class T> struct new_ptr {
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);
}
#endif
};

View File

@@ -17,6 +17,7 @@
#include "boost/lambda/detail/operator_actions.hpp"
#include "boost/lambda/detail/operator_return_type_traits.hpp"
#include "boost/lambda/detail/control_structures_impl.hpp"
#include "boost/lambda/if.hpp"
#include "boost/lambda/loops.hpp"
#endif

View File

@@ -22,6 +22,8 @@
#ifndef BOOST_LAMBDA_CORE_HPP
#define BOOST_LAMBDA_CORE_HPP
#include "boost/config.hpp"
#include "boost/type_traits/transform_traits.hpp"
#include "boost/type_traits/cv_traits.hpp"
@@ -66,9 +68,9 @@ namespace {
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;
boost::lambda::placeholder1_type& BOOST_ATTRIBUTE_UNUSED _1 = free1;
boost::lambda::placeholder2_type& BOOST_ATTRIBUTE_UNUSED _2 = free2;
boost::lambda::placeholder3_type& BOOST_ATTRIBUTE_UNUSED _3 = free3;
// _1, _2, ... naming scheme by Peter Dimov
} // unnamed

View File

@@ -1,550 +0,0 @@
// Boost Lambda Library -- control_structures_impl.hpp ---------------------
// Copyright (C) 1999, 2000 Jaakko Jarvi (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

@@ -12,25 +12,170 @@
#ifndef BOOST_LAMBDA_FUNCTION_ADAPTORS_HPP
#define BOOST_LAMBDA_FUNCTION_ADAPTORS_HPP
#include "boost/mpl/has_xxx.hpp"
#include "boost/tuple/tuple.hpp"
#include "boost/type_traits/same_traits.hpp"
#include "boost/type_traits/remove_reference.hpp"
#include "boost/type_traits/remove_cv.hpp"
#include "boost/type_traits/add_const.hpp"
#include "boost/type_traits/add_volatile.hpp"
#include "boost/utility/result_of.hpp"
namespace boost {
namespace lambda {
namespace detail {
BOOST_MPL_HAS_XXX_TEMPLATE_DEF(sig)
template<class Tuple>
struct remove_references_from_elements {
typedef typename boost::tuples::cons<
typename boost::remove_reference<typename Tuple::head_type>::type,
typename remove_references_from_elements<typename Tuple::tail_type>::type
> type;
};
template<>
struct remove_references_from_elements<boost::tuples::null_type> {
typedef boost::tuples::null_type type;
};
}
template <class Func> struct function_adaptor {
typedef typename detail::remove_reference_and_cv<Func>::type plainF;
#if !defined(BOOST_NO_RESULT_OF)
// Support functors that use the boost::result_of return type convention.
template<class Tuple, int Length, bool HasSig>
struct result_converter;
template<class Tuple, int Length>
struct result_converter<Tuple, Length, true>
: plainF::template sig<
typename detail::remove_references_from_elements<Tuple>::type
>
{};
template<class Tuple>
struct result_converter<Tuple, 0, false>
: result_of<plainF()>
{};
template<class Tuple>
struct result_converter<Tuple, 1, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type)
>
{};
template<class Tuple>
struct result_converter<Tuple, 2, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type,
typename tuples::element<2, Tuple>::type)
>
{};
template<class Tuple>
struct result_converter<Tuple, 3, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type,
typename tuples::element<2, Tuple>::type,
typename tuples::element<3, Tuple>::type)
>
{};
template<class Tuple>
struct result_converter<Tuple, 4, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type,
typename tuples::element<2, Tuple>::type,
typename tuples::element<3, Tuple>::type,
typename tuples::element<4, Tuple>::type)
>
{};
template<class Tuple>
struct result_converter<Tuple, 5, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type,
typename tuples::element<2, Tuple>::type,
typename tuples::element<3, Tuple>::type,
typename tuples::element<4, Tuple>::type,
typename tuples::element<5, Tuple>::type)
>
{};
template<class Tuple>
struct result_converter<Tuple, 6, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type,
typename tuples::element<2, Tuple>::type,
typename tuples::element<3, Tuple>::type,
typename tuples::element<4, Tuple>::type,
typename tuples::element<5, Tuple>::type,
typename tuples::element<6, Tuple>::type)
>
{};
template<class Tuple>
struct result_converter<Tuple, 7, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type,
typename tuples::element<2, Tuple>::type,
typename tuples::element<3, Tuple>::type,
typename tuples::element<4, Tuple>::type,
typename tuples::element<5, Tuple>::type,
typename tuples::element<6, Tuple>::type,
typename tuples::element<7, Tuple>::type)
>
{};
template<class Tuple>
struct result_converter<Tuple, 8, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type,
typename tuples::element<2, Tuple>::type,
typename tuples::element<3, Tuple>::type,
typename tuples::element<4, Tuple>::type,
typename tuples::element<5, Tuple>::type,
typename tuples::element<6, Tuple>::type,
typename tuples::element<7, Tuple>::type,
typename tuples::element<8, Tuple>::type)
>
{};
template<class Tuple>
struct result_converter<Tuple, 9, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type,
typename tuples::element<2, Tuple>::type,
typename tuples::element<3, Tuple>::type,
typename tuples::element<4, Tuple>::type,
typename tuples::element<5, Tuple>::type,
typename tuples::element<6, Tuple>::type,
typename tuples::element<7, Tuple>::type,
typename tuples::element<8, Tuple>::type,
typename tuples::element<9, Tuple>::type)
>
{};
// 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;
// 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.
template <class Args>
struct sig
: result_converter<
Args
, tuples::length<typename Args::tail_type>::value
, detail::has_sig<plainF>::value
>
{};
#else // BOOST_NO_RESULT_OF
template <class Args> class sig {
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;
typedef typename plainF::template sig<
typename detail::remove_references_from_elements<Args>::type
>::type type;
};
#endif
template<class RET, class A1>
static RET apply(A1& a1) {
@@ -95,22 +240,26 @@ struct function_adaptor<T Object::*> {
// 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 boost::remove_reference<
argument_type
>::type unref_type;
typedef typename detail::IF<boost::is_const<argument_type>::value,
typedef typename detail::IF<boost::is_const<unref_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,
typedef typename detail::IF<boost::is_volatile<unref_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;
typedef typename detail::IF<boost::is_reference<argument_type>::value,
typename boost::add_reference<properly_cvd_return_type>::type,
typename boost::remove_cv<T>::type
>::RET type;
};
template <class RET>

View File

@@ -22,13 +22,6 @@
# 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__

View File

@@ -13,6 +13,12 @@
#ifndef BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_HPP
#define BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_HPP
#include "boost/type_traits/add_reference.hpp"
#include "boost/type_traits/add_const.hpp"
#include "boost/type_traits/remove_const.hpp"
#include "boost/lambda/detail/lambda_fwd.hpp"
#include "boost/lambda/detail/lambda_traits.hpp"
namespace boost {
namespace lambda {
@@ -40,7 +46,7 @@ public:
explicit identity(par_t t) : elem(t) {}
template <typename SigArgs>
struct sig { typedef element_t type; };
struct sig { typedef typename boost::remove_const<element_t>::type type; };
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return elem; }
@@ -270,6 +276,8 @@ class lambda_functor_base<explicit_return_type_action<RET>, Args>
public:
Args args;
typedef RET result_type;
explicit lambda_functor_base(const Args& a) : args(a) {}
template <class SigArgs> struct sig { typedef RET type; };
@@ -375,7 +383,7 @@ public: \
\
template<class SigArgs> struct sig { \
typedef typename \
detail::deduce_non_ref_argument_types<Args, SigArgs>::type rets_t; \
detail::deduce_argument_types<Args, SigArgs>::type rets_t; \
public: \
typedef typename \
return_type_N_prot<Act, rets_t>::type type; \

View File

@@ -13,6 +13,31 @@
#ifndef BOOST_LAMBDA_LAMBDA_FUNCTORS_HPP
#define BOOST_LAMBDA_LAMBDA_FUNCTORS_HPP
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/utility/result_of.hpp>
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
#include <boost/mpl/or.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_array.hpp>
#define BOOST_LAMBDA_DISABLE_IF_ARRAY1(A1, R1)\
typename lazy_disable_if<is_array<A1>, typename R1 >::type
#define BOOST_LAMBDA_DISABLE_IF_ARRAY2(A1, A2, R1, R2) \
typename lazy_disable_if<mpl::or_<is_array<A1>, is_array<A2> >, typename R1, R2 >::type
#define BOOST_LAMBDA_DISABLE_IF_ARRAY3(A1, A2, A3, R1, R2, R3) \
typename lazy_disable_if<mpl::or_<is_array<A1>, is_array<A2>, is_array<A3> >, typename R1, R2, R3 >::type
#else
#define BOOST_LAMBDA_DISABLE_IF_ARRAY1(A1, R1) typename R1::type
#define BOOST_LAMBDA_DISABLE_IF_ARRAY2(A1, A2, R1, R2) typename R1, R2::type
#define BOOST_LAMBDA_DISABLE_IF_ARRAY3(A1, A2, A3, R1, R2, R3) typename R1, R2, R3::type
#endif
namespace boost {
namespace lambda {
@@ -137,6 +162,25 @@ public:
inherited::template sig<null_type>::type
nullary_return_type;
// Support for boost::result_of.
template <class Sig> struct result;
template <class F>
struct result<F()> {
typedef nullary_return_type type;
};
template <class F, class A>
struct result<F(A)> {
typedef typename sig<tuple<F, A> >::type type;
};
template <class F, class A, class B>
struct result<F(A, B)> {
typedef typename sig<tuple<F, A, B> >::type type;
};
template <class F, class A, class B, class C>
struct result<F(A, B, C)> {
typedef typename sig<tuple<F, A, B, C> >::type type;
};
nullary_return_type operator()() const {
return inherited::template
call<nullary_return_type>
@@ -152,7 +196,7 @@ public:
}
template<class A>
typename inherited::template sig<tuple<A const&> >::type
BOOST_LAMBDA_DISABLE_IF_ARRAY1(A, inherited::template sig<tuple<A const&> >)
operator()(A const& a) const {
return inherited::template call<
typename inherited::template sig<tuple<A const&> >::type
@@ -168,7 +212,7 @@ public:
}
template<class A, class B>
typename inherited::template sig<tuple<A const&, B&> >::type
BOOST_LAMBDA_DISABLE_IF_ARRAY2(A, B, inherited::template sig<tuple<A const&, B&> >)
operator()(A const& a, B& b) const {
return inherited::template call<
typename inherited::template sig<tuple<A const&, B&> >::type
@@ -176,7 +220,7 @@ public:
}
template<class A, class B>
typename inherited::template sig<tuple<A&, B const&> >::type
BOOST_LAMBDA_DISABLE_IF_ARRAY2(A, B, inherited::template sig<tuple<A&, B const&> >)
operator()(A& a, B const& b) const {
return inherited::template call<
typename inherited::template sig<tuple<A&, B const&> >::type
@@ -184,7 +228,7 @@ public:
}
template<class A, class B>
typename inherited::template sig<tuple<A const&, B const&> >::type
BOOST_LAMBDA_DISABLE_IF_ARRAY2(A, B, inherited::template sig<tuple<A const&, B const&> >)
operator()(A const& a, B const& b) const {
return inherited::template call<
typename inherited::template sig<tuple<A const&, B const&> >::type
@@ -201,7 +245,7 @@ public:
}
template<class A, class B, class C>
typename inherited::template sig<tuple<A const&, B const&, C const&> >::type
BOOST_LAMBDA_DISABLE_IF_ARRAY3(A, B, C, inherited::template sig<tuple<A const&, B const&, C const&> >)
operator()(A const& a, B const& b, C const& c) const
{
return inherited::template call<
@@ -254,6 +298,38 @@ public:
} // namespace lambda
} // namespace boost
namespace boost {
#if !defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_NO_CXX11_DECLTYPE)
template<class T>
struct result_of<boost::lambda::lambda_functor<T>()>
{
typedef typename boost::lambda::lambda_functor<T>::nullary_return_type type;
};
template<class T>
struct result_of<const boost::lambda::lambda_functor<T>()>
{
typedef typename boost::lambda::lambda_functor<T>::nullary_return_type type;
};
#endif
template<class T>
struct tr1_result_of<boost::lambda::lambda_functor<T>()>
{
typedef typename boost::lambda::lambda_functor<T>::nullary_return_type type;
};
template<class T>
struct tr1_result_of<const boost::lambda::lambda_functor<T>()>
{
typedef typename boost::lambda::lambda_functor<T>::nullary_return_type type;
};
}
// is_placeholder
#include <boost/is_placeholder.hpp>

View File

@@ -16,6 +16,7 @@
#include "boost/type_traits/cv_traits.hpp"
#include "boost/type_traits/function_traits.hpp"
#include "boost/type_traits/object_traits.hpp"
#include "boost/tuple/tuple.hpp"
namespace boost {
namespace lambda {
@@ -281,6 +282,11 @@ struct const_copy_argument<void> {
typedef void type;
};
template<>
struct const_copy_argument<void const> {
typedef void type;
};
// Does the same as const_copy_argument, but passes references through as such
template<class T>

View File

@@ -12,9 +12,16 @@
#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/type_traits/is_same.hpp"
#include "boost/type_traits/is_pointer.hpp"
#include "boost/type_traits/is_float.hpp"
#include "boost/type_traits/is_convertible.hpp"
#include "boost/type_traits/remove_pointer.hpp"
#include "boost/type_traits/remove_const.hpp"
#include "boost/type_traits/remove_reference.hpp"
#include "boost/indirect_reference.hpp"
#include "boost/detail/container_fwd.hpp"
#include <cstddef> // needed for the ptrdiff_t
#include <iosfwd> // for istream and ostream
@@ -58,10 +65,6 @@ template <> struct promote_code<long double> { static const int value = 700; };
} // namespace lambda
} // namespace boost
namespace std {
template<class T> class complex;
}
namespace boost {
namespace lambda {
namespace detail {
@@ -228,37 +231,15 @@ template <> struct contentsof_type<null_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 boost::remove_reference<type1>::type no_reference;
typedef typename detail::IF<
is_reference<type1>::value,
const no_reference &,
const no_reference
>::RET type;
typedef typename contentsof_type<A>::type type;
};
template <class A> struct contentsof_type<volatile A> {
typedef typename contentsof_type<A>::type type1;
typedef typename boost::remove_reference<type1>::type no_reference;
typedef typename detail::IF<
is_reference<type1>::value,
volatile no_reference &,
volatile no_reference
>::RET type;
typedef typename contentsof_type<A>::type type;
};
template <class A> struct contentsof_type<const volatile A> {
typedef typename contentsof_type<A>::type type1;
typedef typename boost::remove_reference<type1>::type no_reference;
typedef typename detail::IF<
is_reference<type1>::value,
const volatile no_reference &,
const volatile no_reference
>::RET type;
typedef typename contentsof_type<A>::type type;
};
// standard iterator traits should take care of the pointer types
@@ -561,36 +542,6 @@ struct return_type_2<bitwise_action<Act>, A, B>
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,
@@ -627,7 +578,6 @@ public:
};
#endif
} // end detail
@@ -856,44 +806,6 @@ struct return_type_2<other_action<subscript_action>, A, B> {
};
} // 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;

View File

@@ -37,16 +37,16 @@ inline const \
lambda_functor< \
lambda_functor_base< \
ACTION, \
tuple<lambda_functor<Arg>, typename CONVERSION <CONSTB>::type> \
tuple<lambda_functor<Arg>, typename const_copy_argument <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 const_copy_argument <CONSTB>::type>\
> \
(tuple<lambda_functor<Arg>, typename CONVERSION <CONSTB>::type>(a, b)); \
(tuple<lambda_functor<Arg>, typename const_copy_argument <CONSTB>::type>(a, b)); \
}
@@ -161,23 +161,6 @@ namespace detail {
// 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<
@@ -198,7 +181,6 @@ template<class T> struct convert_istream_to_ref_others_to_c_plain_by_default {
typename const_copy_argument <T>::type
>::RET type;
};
#endif
} // detail

View File

@@ -284,7 +284,7 @@ inline const
lambda_functor<
lambda_functor_base<do_nothing_action, null_type>
>
make_void(const Arg1& a1) {
make_void(const Arg1&) {
return
lambda_functor_base<do_nothing_action, null_type>();
}

View File

@@ -19,10 +19,6 @@
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
@@ -77,8 +73,7 @@ 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,
is_protectable<Act>::value && is_lambda_functor<A>::value,
lambda_functor<
lambda_functor_base<
Act,
@@ -112,9 +107,7 @@ namespace detail {
// 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,
boost::is_reference<T>::value && !boost::is_const<non_ref_T>::value,
detail::identity_mapping<T>,
const_copy_argument<non_ref_T> // handles funtion and array
>::type type; // types correctly
@@ -148,11 +141,8 @@ template <class Act, class A, class B> struct return_type_2_prot {
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,
is_protectable<Act>::value &&
(is_lambda_functor<A>::value || is_lambda_functor<B>::value),
lambda_functor<
lambda_functor_base<
Act,
@@ -187,11 +177,8 @@ struct return_type_2_comma
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,
is_protectable<other_action<comma_action> >::value && // it is protectable
(is_lambda_functor<A>::value || is_lambda_functor<B>::value),
lambda_functor<
lambda_functor_base<
other_action<comma_action>,
@@ -216,8 +203,6 @@ typedef typename
// 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;

View File

@@ -10,8 +10,8 @@
// ------------------------------------------------------------
#ifndef BOOST_LAMBDA_SUPRESS_UNUSED_HPP
#define BOOST_LAMBDA_SUPRESS_UNUSED_HPP
#ifndef BOOST_LAMBDA_SUPPRESS_UNUSED_HPP
#define BOOST_LAMBDA_SUPPRESS_UNUSED_HPP
namespace boost {
namespace lambda {

View File

@@ -14,6 +14,7 @@
#if !defined(BOOST_LAMBDA_EXCEPTIONS_HPP)
#define BOOST_LAMBDA_EXCEPTIONS_HPP
#include "boost/lambda/core.hpp"
#include "boost/lambda/detail/control_constructs_common.hpp"
namespace boost {

View File

@@ -345,7 +345,7 @@ public:
// 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
// if_ and the leading dot and the trailing underscore before
// and after .else_.
//
///////////////////////////////////////////////////////////////////////////////

View File

@@ -24,11 +24,6 @@
#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

@@ -348,7 +348,7 @@ while_(CondT const& cond)
// 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 after do_ and the leading dot and the trailing
// underscore before and after .while_.
//
///////////////////////////////////////////////////////////////////////////////

16
meta/libraries.json Normal file
View File

@@ -0,0 +1,16 @@
{
"key": "lambda",
"name": "Lambda",
"authors": [
"Jaakko Järvi",
"Gary Powell"
],
"description": "Define small unnamed function objects at the actual call site, and more.",
"category": [
"Function-objects"
],
"maintainers": [
"Jaakko Jarvi <jarvi -at- cs.tamu.edu>"
],
"cxxstd": "03"
}

View File

@@ -1 +0,0 @@
boost_module(lambda DEPENDS tuple)

View File

@@ -1,18 +1,11 @@
boost_additional_test_dependencies(lambda BOOST_DEPENDS test any)
# Copyright 2018, 2019 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
boost_test_run(algorithm_test DEPENDS boost_test_exec_monitor)
boost_test_run(bind_tests_simple DEPENDS boost_test_exec_monitor)
boost_test_run(bind_tests_advanced DEPENDS boost_test_exec_monitor)
boost_test_run(bind_tests_simple_f_refs DEPENDS boost_test_exec_monitor)
boost_test_run(bll_and_function DEPENDS boost_test_exec_monitor)
boost_test_run(lambda_cast_test
cast_test.cpp DEPENDS boost_test_exec_monitor)
boost_test_run(constructor_tests DEPENDS boost_test_exec_monitor)
boost_test_run(control_structures DEPENDS boost_test_exec_monitor)
boost_test_run(exception_test DEPENDS boost_test_exec_monitor)
boost_test_run(extending_rt_traits DEPENDS boost_test_exec_monitor)
boost_test_run(is_instance_of_test DEPENDS boost_test_exec_monitor)
boost_test_run(member_pointer_test DEPENDS boost_test_exec_monitor)
boost_test_run(operator_tests_simple DEPENDS boost_test_exec_monitor)
boost_test_run(phoenix_control_structures DEPENDS boost_test_exec_monitor)
boost_test_run(switch_construct DEPENDS boost_test_exec_monitor)
include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
if(HAVE_BOOST_TEST)
boost_test_jamfile(FILE Jamfile LINK_LIBRARIES Boost::lambda Boost::core Boost::any Boost::function Boost::smart_ptr)
endif()

View File

@@ -1,33 +1,36 @@
# Lambda library
# Copyright (C) 2001-2003 Jaakko Järvi
# Copyright (C) 2001-2003 Jaakko J<EFBFBD>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)
# 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 <toolset>msvc:<asynch-exceptions>on
project : requirements <library>/boost/lambda//boost_lambda ;
run algorithm_test.cpp ;
run bind_tests_advanced.cpp : : : <library>/boost/any//boost_any ;
run bind_tests_simple.cpp ;
run bind_tests_simple_f_refs.cpp ;
run bll_and_function.cpp ;
run cast_test.cpp ;
run constructor_tests.cpp ;
run control_structures.cpp ;
run exception_test.cpp
: : : <toolset>msvc-14.0,<variant>release:<build>no # crash with 8 catch blocks
;
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 ]
;
run extending_rt_traits.cpp ;
run is_instance_of_test.cpp ;
run istreambuf_test.cpp ;
run member_pointer_test.cpp ;
run operator_tests_simple.cpp ;
run phoenix_control_structures.cpp ;
run result_of_tests.cpp ;
run ret_test.cpp ;
run rvalue_test.cpp ;
run switch_construct.cpp ;
link issue24_test.cpp ;

View File

@@ -11,7 +11,8 @@
// test using BLL and boost::function
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include <boost/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
@@ -46,15 +47,9 @@ void test_foreach() {
// More tests needed (for all algorithms)
int test_main(int, char *[]) {
int main() {
test_foreach();
return 0;
return boost::report_errors();
}

View File

@@ -2,6 +2,7 @@
//
// Copyright (C) 2000-2003 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2000-2003 Gary Powell (powellg@amazon.com)
// Copyright (C) 2010 Steven Watanabe
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -12,13 +13,17 @@
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include <boost/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
#include "boost/any.hpp"
#include "boost/type_traits/is_reference.hpp"
#include "boost/mpl/assert.hpp"
#include "boost/mpl/if.hpp"
#include <iostream>
@@ -27,7 +32,8 @@
#include <algorithm>
using namespace boost::lambda;
using namespace boost::lambda;
namespace bl = boost::lambda;
int sum_0() { return 0; }
int sum_1(int a) { return a; }
@@ -91,7 +97,7 @@ int call_with_100(const F& f) {
// 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));
return bl::bind(unlambda(f), _1)(make_const(100));
// for other functors than lambda functors, unlambda has no effect
// (except for making them const)
@@ -116,11 +122,37 @@ void test_unlambda() {
BOOST_CHECK(call_with_101(_1 + 1) == 102);
BOOST_CHECK(call_with_100(bind(std_functor(std::bind1st(std::plus<int>(), 1)), _1)) == 101);
#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
BOOST_CHECK(call_with_100(bl::bind(std_functor(std::bind1st(std::plus<int>(), 1)), _1)) == 101);
#elif BOOST_CXX_VERSION > 201703L
// In C++20, standard functors no longer have ::result_type
BOOST_CHECK(call_with_100(bl::bind(std::bind(std::plus<int>(), 1, std::placeholders::_1), _1)) == 101);
#elif defined(BOOST_MSVC) && BOOST_MSVC < 1900
// Mysterious failures under msvc-12.0 and below
#else
BOOST_CHECK(call_with_100(bl::bind(std_functor(std::bind(std::plus<int>(), 1, std::placeholders::_1)), _1)) == 101);
#endif
#if BOOST_CXX_VERSION <= 201703L
// 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);
bl::bind(std_functor(std::plus<int>()), _1, _2)(i, i);
#else
// In C++20, standard functors no longer have ::result_type
bl::bind(std::plus<int>(), _1, _2)(i, i);
#endif
}
@@ -351,7 +383,56 @@ void test_break_const()
BOOST_CHECK(i == 3);
}
int test_main(int, char *[]) {
template<class T>
struct func {
template<class Args>
struct sig {
typedef typename boost::tuples::element<1, Args>::type arg1;
// If the argument type is not the same as the expected type,
// return void, which will cause an error. Note that we
// can't just assert that the types are the same, because
// both const and non-const versions can be instantiated
// even though only one is ultimately used.
typedef typename boost::mpl::if_<boost::is_same<arg1, T>,
typename boost::remove_const<arg1>::type,
void
>::type type;
};
template<class U>
U operator()(const U& arg) const {
return arg;
}
};
void test_sig()
{
int i = 1;
BOOST_CHECK(bind(func<int>(), 1)() == 1);
BOOST_CHECK(bind(func<const int>(), _1)(static_cast<const int&>(i)) == 1);
BOOST_CHECK(bind(func<int>(), _1)(i) == 1);
}
class base {
public:
virtual int foo() = 0;
};
class derived : public base {
public:
virtual int foo() {
return 1;
}
};
void test_abstract()
{
derived d;
base& b = d;
BOOST_CHECK(bind(&base::foo, var(b))() == 1);
BOOST_CHECK(bind(&base::foo, *_1)(&b) == 1);
}
int main() {
test_nested_binds();
test_unlambda();
@@ -360,17 +441,7 @@ int test_main(int, char *[]) {
test_const_parameters();
test_rvalue_arguments();
test_break_const();
return 0;
test_sig();
test_abstract();
return boost::report_errors();
}

View File

@@ -12,15 +12,14 @@
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include <boost/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include "boost/lambda/bind.hpp"
#include <iostream>
using namespace std;
using namespace boost::lambda;
using namespace boost::lambda;
int sum_of_args_0() { return 0; }
@@ -82,7 +81,24 @@ void test_member_functions()
// bind(&A::add, a, _1);
}
int test_main(int, char *[]) {
struct B {
B(int n) : i(n) {};
int i;
};
void test_data_members()
{
using boost::ref;
B b(10);
BOOST_CHECK(bind(&B::i, ref(b))() == 10);
BOOST_CHECK(bind(&B::i, b)() == 10);
BOOST_CHECK(bind(&B::i, _1)(b) == 10);
BOOST_CHECK(bind(&B::i, _1)(B(11)) == 11);
bind(&B::i, ref(b))() = 1;
BOOST_CHECK(b.i == 1);
}
int main() {
int i = 1; int j = 2; int k = 3;
int result;
@@ -168,5 +184,5 @@ int test_main(int, char *[]) {
test_member_functions();
return 0;
return boost::report_errors();
}

View File

@@ -12,15 +12,14 @@
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include <boost/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include "boost/lambda/bind.hpp"
#include <iostream>
using namespace std;
using namespace boost::lambda;
using namespace boost::lambda;
int sum_of_args_0() { return 0; }
@@ -59,7 +58,7 @@ void test_member_functions()
// bind(&A::add, a, _1);
}
int test_main(int, char *[]) {
int main() {
int i = 1; int j = 2; int k = 3;
int result;
@@ -146,5 +145,5 @@ int test_main(int, char *[]) {
test_member_functions();
return 0;
return boost::report_errors();
}

View File

@@ -11,7 +11,8 @@
// test using BLL and boost::function
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include <boost/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include "boost/lambda/lambda.hpp"
@@ -54,15 +55,9 @@ void test_function() {
}
int test_main(int, char *[]) {
int main() {
test_function();
return 0;
return boost::report_errors();
}

View File

@@ -12,7 +12,8 @@
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include <boost/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include "boost/lambda/lambda.hpp"
@@ -29,7 +30,7 @@ class base {
public:
virtual std::string class_name() const { return "const base"; }
virtual std::string class_name() { return "base"; }
virtual ~base() {}
};
class derived : public base {
@@ -100,8 +101,8 @@ void do_test() {
}
int test_main(int, char *[]) {
int main() {
do_test();
return 0;
return boost::report_errors();
}

View File

@@ -0,0 +1,18 @@
# Copyright 2018, 2019 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
cmake_minimum_required(VERSION 3.5...3.16)
project(cmake_install_test LANGUAGES CXX)
find_package(boost_lambda REQUIRED)
find_package(boost_core REQUIRED)
add_executable(quick ../quick.cpp)
target_link_libraries(quick Boost::lambda Boost::core)
enable_testing()
add_test(quick quick)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

View File

@@ -0,0 +1,21 @@
# Copyright 2018, 2019, 2021 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
cmake_minimum_required(VERSION 3.5...3.16)
project(cmake_subdir_test LANGUAGES CXX)
set(BOOST_INCLUDE_LIBRARIES lambda)
add_subdirectory(../../../../ deps/boost)
# --target check
add_executable(quick ../quick.cpp)
target_link_libraries(quick Boost::lambda Boost::core)
enable_testing()
add_test(quick quick)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

View File

@@ -12,7 +12,8 @@
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include <boost/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include "boost/lambda/lambda.hpp"
@@ -29,7 +30,7 @@
#endif
using namespace boost::lambda;
using namespace std;
namespace bl = boost::lambda;
template<class T>
bool check_tuple(int n, const T& t)
@@ -212,17 +213,17 @@ int count_deletes::count = 0;
void test_news_and_deletes ()
{
int* i[10];
for_each(i, i+10, _1 = bind(new_ptr<int>(), 2));
std::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));
std::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>()));
std::for_each(ct, ct+10, _1 = bind(new_ptr<count_deletes>()));
count_deletes::count = 0;
for_each(ct, ct+10, bind(delete_ptr(), _1));
std::for_each(ct, ct+10, bind(delete_ptr(), _1));
BOOST_CHECK(count_deletes::count == 10);
}
@@ -240,19 +241,19 @@ void test_array_new_and_delete()
void delayed_construction()
{
vector<int> x(3);
vector<int> y(3);
std::vector<int> x(3);
std::vector<int> y(3);
fill(x.begin(), x.end(), 0);
fill(y.begin(), y.end(), 1);
std::fill(x.begin(), x.end(), 0);
std::fill(y.begin(), y.end(), 1);
vector<pair<int, int> > v;
std::vector<std::pair<int, int> > v;
transform(x.begin(), x.end(), y.begin(), back_inserter(v),
bind(constructor<pair<int, int> >(), _1, _2) );
std::transform(x.begin(), x.end(), y.begin(), std::back_inserter(v),
bl::bind(constructor<std::pair<int, int> >(), _1, _2) );
}
int test_main(int, char *[]) {
int main() {
constructor_all_lengths();
new_ptr_all_lengths();
@@ -261,5 +262,5 @@ int test_main(int, char *[]) {
test_news_and_deletes();
test_array_new_and_delete();
return 0;
return boost::report_errors();
}

View File

@@ -11,7 +11,8 @@
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include <boost/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/if.hpp"
@@ -115,9 +116,9 @@ void simple_ifs () {
}
int test_main(int, char *[])
int main()
{
simple_loops();
simple_ifs();
return 0;
return boost::report_errors();
}

View File

@@ -11,7 +11,8 @@
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include <boost/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include "boost/lambda/lambda.hpp"
@@ -595,7 +596,7 @@ void return_type_matching() {
BOOST_CHECK(a == 'b');
}
int test_main(int, char *[]) {
int main() {
try
{
@@ -613,9 +614,5 @@ int test_main(int, char *[]) {
}
return EXIT_SUCCESS;
return boost::report_errors();
}

View File

@@ -12,7 +12,8 @@
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include <boost/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include "boost/lambda/bind.hpp"
#include "boost/lambda/lambda.hpp"
@@ -381,14 +382,8 @@ void test_binary_operators() {
}
int test_main(int, char *[]) {
int main() {
test_unary_operators();
test_binary_operators();
return 0;
return boost::report_errors();
}

View File

@@ -12,7 +12,8 @@
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include <boost/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include "boost/lambda/detail/is_instance_of.hpp"
@@ -45,7 +46,7 @@ template <bool b> class X {};
X<boost::lambda::is_instance_of_2<int, A2>::value> x;
int test_main(int, char *[]) {
int main() {
using boost::lambda::is_instance_of_1;
using boost::lambda::is_instance_of_2;
@@ -73,7 +74,6 @@ 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;
return boost::report_errors();
}

26
test/issue24_test.cpp Normal file
View File

@@ -0,0 +1,26 @@
// Copyright 2021 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/lambda/bind.hpp>
#include <boost/config.hpp>
#include <functional>
#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
#include <boost/config/pragma_message.hpp>
BOOST_PRAGMA_MESSAGE( "Skipping test because BOOST_NO_CXX11_HDR_FUNCTIONAL is defined" )
int main() {}
#else
void func()
{
}
int main()
{
std::function<void()>( boost::lambda::bind( func ) );
}
#endif

View File

@@ -7,7 +7,7 @@
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/lambda/lambda.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/core/lightweight_test.hpp>
#include <iterator>
#include <sstream>
#include <algorithm>

View File

@@ -12,7 +12,8 @@
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include <boost/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include "boost/lambda/lambda.hpp"
@@ -182,11 +183,10 @@ void test_overloaded_pointer_to_member()
}
int test_main(int, char *[]) {
int main() {
pointer_to_data_member_tests();
pointer_to_member_function_tests();
test_overloaded_pointer_to_member();
return 0;
return boost::report_errors();
}

View File

@@ -13,12 +13,15 @@
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include <boost/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/detail/suppress_unused.hpp"
#include <boost/shared_ptr.hpp>
#include <vector>
#include <map>
#include <set>
@@ -233,6 +236,22 @@ void compound_operators() {
(_1 %= 2)(i);
BOOST_CHECK(i == 1);
// lambda expression as a left operand with rvalue on RHS
(_1 += (0 + 1))(i);
BOOST_CHECK(i == 2);
(_1 -= (0 + 1))(i);
BOOST_CHECK(i == 1);
(_1 *= (0 + 10))(i);
BOOST_CHECK(i == 10);
(_1 /= (0 + 2))(i);
BOOST_CHECK(i == 5);
(_1 %= (0 + 2))(i);
BOOST_CHECK(i == 1);
// shifts
unsigned int ui = 2;
(_1 <<= 1)(ui);
@@ -323,8 +342,18 @@ void address_of_and_dereference() {
(*_1 = 7)(it);
BOOST_CHECK(vi[0] == 7);
const std::vector<int>::iterator cit(it);
(*_1 = 8)(cit);
BOOST_CHECK(vi[0] == 8);
// TODO: Add tests for more complex iterator types
boost::shared_ptr<int> ptr(new int(0));
(*_1 = 7)(ptr);
BOOST_CHECK(*ptr == 7);
const boost::shared_ptr<int> cptr(ptr);
(*_1 = 8)(cptr);
BOOST_CHECK(*ptr == 8);
}
@@ -380,7 +409,7 @@ void pointer_arithmetic() {
}
int test_main(int, char *[]) {
int main() {
arithmetic_operators();
bitwise_operators();
@@ -393,11 +422,5 @@ int test_main(int, char *[]) {
comma();
pointer_arithmetic();
cout_tests();
return 0;
return boost::report_errors();
}

View File

@@ -12,7 +12,8 @@
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include <boost/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/if.hpp"
@@ -36,7 +37,7 @@ using namespace std;
// If-else, while, do-while, for statements
int test_main(int, char *[]) {
int main() {
vector<int> v;
v.clear();
@@ -143,6 +144,5 @@ int test_main(int, char *[]) {
v = t;
return 0;
return boost::report_errors();
}

15
test/quick.cpp Normal file
View File

@@ -0,0 +1,15 @@
// Copyright 2021 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/lambda/lambda.hpp>
#include <boost/core/lightweight_test.hpp>
int main()
{
using namespace boost::lambda;
BOOST_TEST_EQ( (_1 + _2)(1, 2), 3 );
return boost::report_errors();
}

317
test/result_of_tests.cpp Normal file
View File

@@ -0,0 +1,317 @@
// result_of_tests.cpp -- The Boost Lambda Library ------------------
//
// Copyright (C) 2010 Steven Watanabe
//
// 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/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include <boost/lambda/bind.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>
struct with_result_type {
typedef int result_type;
int operator()() const { return 0; }
int operator()(int) const { return 1; }
int operator()(int, int) const { return 2; }
int operator()(int, int, int) const { return 3; }
int operator()(int, int, int, int) const { return 4; }
int operator()(int, int, int, int, int) const { return 5; }
int operator()(int, int, int, int, int, int) const { return 6; }
int operator()(int, int, int, int, int, int, int) const { return 7; }
int operator()(int, int, int, int, int, int, int, int) const { return 8; }
int operator()(int, int, int, int, int, int, int, int, int) const { return 9; }
};
struct with_result_template_value {
template<class Sig>
struct result;
template<class This>
struct result<This()> {
typedef int type;
};
template<class This, class A1>
struct result<This(A1)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int>));
typedef int type;
};
template<class This, class A1, class A2>
struct result<This(A1, A2)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int>));
BOOST_MPL_ASSERT((boost::is_same<A2, int>));
typedef int type;
};
template<class This, class A1, class A2, class A3>
struct result<This(A1, A2, A3)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int>));
BOOST_MPL_ASSERT((boost::is_same<A2, int>));
BOOST_MPL_ASSERT((boost::is_same<A3, int>));
typedef int type;
};
template<class This, class A1, class A2, class A3, class A4>
struct result<This(A1, A2, A3, A4)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int>));
BOOST_MPL_ASSERT((boost::is_same<A2, int>));
BOOST_MPL_ASSERT((boost::is_same<A3, int>));
BOOST_MPL_ASSERT((boost::is_same<A4, int>));
typedef int type;
};
template<class This, class A1, class A2, class A3, class A4, class A5>
struct result<This(A1, A2, A3, A4, A5)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int>));
BOOST_MPL_ASSERT((boost::is_same<A2, int>));
BOOST_MPL_ASSERT((boost::is_same<A3, int>));
BOOST_MPL_ASSERT((boost::is_same<A4, int>));
BOOST_MPL_ASSERT((boost::is_same<A5, int>));
typedef int type;
};
template<class This, class A1, class A2, class A3, class A4, class A5, class A6>
struct result<This(A1, A2, A3, A4, A5, A6)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int>));
BOOST_MPL_ASSERT((boost::is_same<A2, int>));
BOOST_MPL_ASSERT((boost::is_same<A3, int>));
BOOST_MPL_ASSERT((boost::is_same<A4, int>));
BOOST_MPL_ASSERT((boost::is_same<A5, int>));
BOOST_MPL_ASSERT((boost::is_same<A6, int>));
typedef int type;
};
template<class This, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
struct result<This(A1, A2, A3, A4, A5, A6, A7)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int>));
BOOST_MPL_ASSERT((boost::is_same<A2, int>));
BOOST_MPL_ASSERT((boost::is_same<A3, int>));
BOOST_MPL_ASSERT((boost::is_same<A4, int>));
BOOST_MPL_ASSERT((boost::is_same<A5, int>));
BOOST_MPL_ASSERT((boost::is_same<A6, int>));
BOOST_MPL_ASSERT((boost::is_same<A7, int>));
typedef int type;
};
template<class This, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
struct result<This(A1, A2, A3, A4, A5, A6, A7, A8)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int>));
BOOST_MPL_ASSERT((boost::is_same<A2, int>));
BOOST_MPL_ASSERT((boost::is_same<A3, int>));
BOOST_MPL_ASSERT((boost::is_same<A4, int>));
BOOST_MPL_ASSERT((boost::is_same<A5, int>));
BOOST_MPL_ASSERT((boost::is_same<A6, int>));
BOOST_MPL_ASSERT((boost::is_same<A7, int>));
BOOST_MPL_ASSERT((boost::is_same<A8, int>));
typedef int type;
};
template<class This, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
struct result<This(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int>));
BOOST_MPL_ASSERT((boost::is_same<A2, int>));
BOOST_MPL_ASSERT((boost::is_same<A3, int>));
BOOST_MPL_ASSERT((boost::is_same<A4, int>));
BOOST_MPL_ASSERT((boost::is_same<A5, int>));
BOOST_MPL_ASSERT((boost::is_same<A6, int>));
BOOST_MPL_ASSERT((boost::is_same<A7, int>));
BOOST_MPL_ASSERT((boost::is_same<A8, int>));
BOOST_MPL_ASSERT((boost::is_same<A9, int>));
typedef int type;
};
int operator()() const { return 0; }
int operator()(int) const { return 1; }
int operator()(int, int) const { return 2; }
int operator()(int, int, int) const { return 3; }
int operator()(int, int, int, int) const { return 4; }
int operator()(int, int, int, int, int) const { return 5; }
int operator()(int, int, int, int, int, int) const { return 6; }
int operator()(int, int, int, int, int, int, int) const { return 7; }
int operator()(int, int, int, int, int, int, int, int) const { return 8; }
int operator()(int, int, int, int, int, int, int, int, int) const { return 9; }
};
struct with_result_template_reference {
template<class Sig>
struct result;
template<class This>
struct result<This()> {
typedef int type;
};
template<class This, class A1>
struct result<This(A1)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int&>));
typedef int type;
};
template<class This, class A1, class A2>
struct result<This(A1, A2)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int&>));
BOOST_MPL_ASSERT((boost::is_same<A2, int&>));
typedef int type;
};
template<class This, class A1, class A2, class A3>
struct result<This(A1, A2, A3)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int&>));
BOOST_MPL_ASSERT((boost::is_same<A2, int&>));
BOOST_MPL_ASSERT((boost::is_same<A3, int&>));
typedef int type;
};
template<class This, class A1, class A2, class A3, class A4>
struct result<This(A1, A2, A3, A4)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int&>));
BOOST_MPL_ASSERT((boost::is_same<A2, int&>));
BOOST_MPL_ASSERT((boost::is_same<A3, int&>));
BOOST_MPL_ASSERT((boost::is_same<A4, int&>));
typedef int type;
};
template<class This, class A1, class A2, class A3, class A4, class A5>
struct result<This(A1, A2, A3, A4, A5)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int&>));
BOOST_MPL_ASSERT((boost::is_same<A2, int&>));
BOOST_MPL_ASSERT((boost::is_same<A3, int&>));
BOOST_MPL_ASSERT((boost::is_same<A4, int&>));
BOOST_MPL_ASSERT((boost::is_same<A5, int&>));
typedef int type;
};
template<class This, class A1, class A2, class A3, class A4, class A5, class A6>
struct result<This(A1, A2, A3, A4, A5, A6)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int&>));
BOOST_MPL_ASSERT((boost::is_same<A2, int&>));
BOOST_MPL_ASSERT((boost::is_same<A3, int&>));
BOOST_MPL_ASSERT((boost::is_same<A4, int&>));
BOOST_MPL_ASSERT((boost::is_same<A5, int&>));
BOOST_MPL_ASSERT((boost::is_same<A6, int&>));
typedef int type;
};
template<class This, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
struct result<This(A1, A2, A3, A4, A5, A6, A7)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int&>));
BOOST_MPL_ASSERT((boost::is_same<A2, int&>));
BOOST_MPL_ASSERT((boost::is_same<A3, int&>));
BOOST_MPL_ASSERT((boost::is_same<A4, int&>));
BOOST_MPL_ASSERT((boost::is_same<A5, int&>));
BOOST_MPL_ASSERT((boost::is_same<A6, int&>));
BOOST_MPL_ASSERT((boost::is_same<A7, int&>));
typedef int type;
};
template<class This, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
struct result<This(A1, A2, A3, A4, A5, A6, A7, A8)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int&>));
BOOST_MPL_ASSERT((boost::is_same<A2, int&>));
BOOST_MPL_ASSERT((boost::is_same<A3, int&>));
BOOST_MPL_ASSERT((boost::is_same<A4, int&>));
BOOST_MPL_ASSERT((boost::is_same<A5, int&>));
BOOST_MPL_ASSERT((boost::is_same<A6, int&>));
BOOST_MPL_ASSERT((boost::is_same<A7, int&>));
BOOST_MPL_ASSERT((boost::is_same<A8, int&>));
typedef int type;
};
template<class This, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
struct result<This(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
BOOST_MPL_ASSERT((boost::is_same<A1, int&>));
BOOST_MPL_ASSERT((boost::is_same<A2, int&>));
BOOST_MPL_ASSERT((boost::is_same<A3, int&>));
BOOST_MPL_ASSERT((boost::is_same<A4, int&>));
BOOST_MPL_ASSERT((boost::is_same<A5, int&>));
BOOST_MPL_ASSERT((boost::is_same<A6, int&>));
BOOST_MPL_ASSERT((boost::is_same<A7, int&>));
BOOST_MPL_ASSERT((boost::is_same<A8, int&>));
BOOST_MPL_ASSERT((boost::is_same<A9, int&>));
typedef int type;
};
int operator()() const { return 0; }
int operator()(int) const { return 1; }
int operator()(int, int) const { return 2; }
int operator()(int, int, int) const { return 3; }
int operator()(int, int, int, int) const { return 4; }
int operator()(int, int, int, int, int) const { return 5; }
int operator()(int, int, int, int, int, int) const { return 6; }
int operator()(int, int, int, int, int, int, int) const { return 7; }
int operator()(int, int, int, int, int, int, int, int) const { return 8; }
int operator()(int, int, int, int, int, int, int, int, int) const { return 9; }
};
template<class F>
typename boost::result_of<F()>::type apply0(F f) {
return f();
}
template<class A, class F>
typename boost::result_of<F(A)>::type apply1(F f, A a) {
return f(a);
}
template<class A, class B, class F>
typename boost::result_of<F(A, B)>::type apply2(F f, A a, B b) {
return f(a, b);
}
template<class A, class B, class C, class F>
typename boost::result_of<F(A, B, C)>::type apply3(F f, A a, B b, C c) {
return f(a, b, c);
}
using namespace boost::lambda;
int main() {
BOOST_CHECK(boost::lambda::bind(with_result_type())() == 0);
BOOST_CHECK(boost::lambda::bind(with_result_type(), 1)() == 1);
BOOST_CHECK(boost::lambda::bind(with_result_type(), 1, 2)() == 2);
BOOST_CHECK(boost::lambda::bind(with_result_type(), 1, 2, 3)() == 3);
BOOST_CHECK(boost::lambda::bind(with_result_type(), 1, 2, 3, 4)() == 4);
BOOST_CHECK(boost::lambda::bind(with_result_type(), 1, 2, 3, 4, 5)() == 5);
BOOST_CHECK(boost::lambda::bind(with_result_type(), 1, 2, 3, 4, 5, 6)() == 6);
BOOST_CHECK(boost::lambda::bind(with_result_type(), 1, 2, 3, 4, 5, 6, 7)() == 7);
BOOST_CHECK(boost::lambda::bind(with_result_type(), 1, 2, 3, 4, 5, 6, 7, 8)() == 8);
BOOST_CHECK(boost::lambda::bind(with_result_type(), 1, 2, 3, 4, 5, 6, 7, 8, 9)() == 9);
// Nullary result_of fails
//BOOST_CHECK(boost::lambda::bind(with_result_template_value())() == 0);
BOOST_CHECK(boost::lambda::bind(with_result_template_value(), 1)() == 1);
BOOST_CHECK(boost::lambda::bind(with_result_template_value(), 1, 2)() == 2);
BOOST_CHECK(boost::lambda::bind(with_result_template_value(), 1, 2, 3)() == 3);
BOOST_CHECK(boost::lambda::bind(with_result_template_value(), 1, 2, 3, 4)() == 4);
BOOST_CHECK(boost::lambda::bind(with_result_template_value(), 1, 2, 3, 4, 5)() == 5);
BOOST_CHECK(boost::lambda::bind(with_result_template_value(), 1, 2, 3, 4, 5, 6)() == 6);
BOOST_CHECK(boost::lambda::bind(with_result_template_value(), 1, 2, 3, 4, 5, 6, 7)() == 7);
BOOST_CHECK(boost::lambda::bind(with_result_template_value(), 1, 2, 3, 4, 5, 6, 7, 8)() == 8);
BOOST_CHECK(boost::lambda::bind(with_result_template_value(), 1, 2, 3, 4, 5, 6, 7, 8, 9)() == 9);
int one = 1,
two = 2,
three = 3,
four = 4,
five = 5,
six = 6,
seven = 7,
eight = 8,
nine = 9;
// Nullary result_of fails
//BOOST_CHECK(boost::lambda::bind(with_result_template_reference())() == 0);
BOOST_CHECK(boost::lambda::bind(with_result_template_reference(), var(one))() == 1);
BOOST_CHECK(boost::lambda::bind(with_result_template_reference(), var(one), var(two))() == 2);
BOOST_CHECK(boost::lambda::bind(with_result_template_reference(), var(one), var(two), var(three))() == 3);
BOOST_CHECK(boost::lambda::bind(with_result_template_reference(), var(one), var(two), var(three), var(four))() == 4);
BOOST_CHECK(boost::lambda::bind(with_result_template_reference(), var(one), var(two), var(three), var(four), var(five))() == 5);
BOOST_CHECK(boost::lambda::bind(with_result_template_reference(), var(one), var(two), var(three), var(four), var(five), var(six))() == 6);
BOOST_CHECK(boost::lambda::bind(with_result_template_reference(), var(one), var(two), var(three), var(four), var(five), var(six), var(seven))() == 7);
BOOST_CHECK(boost::lambda::bind(with_result_template_reference(), var(one), var(two), var(three), var(four), var(five), var(six), var(seven), var(eight))() == 8);
BOOST_CHECK(boost::lambda::bind(with_result_template_reference(), var(one), var(two), var(three), var(four), var(five), var(six), var(seven), var(eight), var(nine))() == 9);
// Check using result_of with lambda functors
BOOST_CHECK(apply0(constant(0)) == 0);
// returns local address and leads to undefined behavior
//~ BOOST_CHECK(apply1<int>(_1, one) == 1);
BOOST_CHECK(apply1<int&>(_1, one) == 1);
BOOST_CHECK(apply1<const int&>(_1, one) == 1);
BOOST_CHECK((apply2<int, int>(_1 + _2, one, two) == 3));
BOOST_CHECK((apply2<int&, int&>(_1 + _2, one, two) == 3));
BOOST_CHECK((apply2<const int&, const int&>(_1 + _2, one, two) == 3));
BOOST_CHECK((apply3<int, int, int>(_1 + _2 + _3, one, two, three) == 6));
BOOST_CHECK((apply3<int&, int&, int&>(_1 + _2 + _3, one, two, three) == 6));
BOOST_CHECK((apply3<const int&, const int&, const int&>(_1 + _2 + _3, one, two, three) == 6));
return boost::report_errors();
}

54
test/ret_test.cpp Normal file
View File

@@ -0,0 +1,54 @@
// ret_test.cpp - The Boost Lambda Library -----------------------
//
// Copyright (C) 2009 Steven Watanabe
//
// 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/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include <boost/lambda/lambda.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>
template<class R, class F>
void test_ret(R r, F f) {
typename F::result_type x = f();
BOOST_MPL_ASSERT((boost::is_same<R, typename F::result_type>));
BOOST_CHECK(x == r);
}
template<class R, class F, class T1>
void test_ret(R r, F f, T1& t1) {
typename F::result_type x = f(t1);
BOOST_MPL_ASSERT((boost::is_same<R, typename F::result_type>));
BOOST_CHECK(x == r);
}
class add_result {
public:
add_result(int i = 0) : value(i) {}
friend bool operator==(const add_result& lhs, const add_result& rhs) {
return(lhs.value == rhs.value);
}
private:
int value;
};
class addable {};
add_result operator+(addable, addable) {
return add_result(7);
}
int main() {
addable test;
test_ret(add_result(7), boost::lambda::ret<add_result>(boost::lambda::_1 + test), test);
test_ret(8.0, boost::lambda::ret<double>(boost::lambda::constant(7) + 1));
return boost::report_errors();
}

View File

@@ -7,7 +7,7 @@
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/lambda/lambda.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/core/lightweight_test.hpp>
int main()
{

View File

@@ -12,7 +12,8 @@
// -----------------------------------------------------------------------
#include <boost/test/minimal.hpp> // see "Header Implementation Option"
#include <boost/core/lightweight_test.hpp>
#define BOOST_CHECK BOOST_TEST
#include "boost/lambda/lambda.hpp"
@@ -379,14 +380,13 @@ void test_empty_cases() {
}
int test_main(int, char* []) {
int main() {
do_switch_no_defaults_tests();
do_switch_yes_defaults_tests();
test_empty_cases();
return EXIT_SUCCESS;
return boost::report_errors();
}