Compare commits

...

462 Commits

Author SHA1 Message Date
Andrey Semashev
9984eff746 Replaced macos-13 with macos-15 in GitHub Actions.
The macos-13 image is retired, macos-15 is now available.
2025-12-13 20:44:34 +03:00
Andrey Semashev
2592296b41 Merge pull request #115 from Flamefire/test-link-update
Update Link to regression test matrix in README
2025-08-25 19:06:57 +03:00
Alexander Grund
923aedf577 Update Link to regression test matrix in README 2025-08-25 17:26:33 +02:00
Andrey Semashev
67861ef6ad Fixed AppVeyor image name for 32-bit MinGW-w64 gcc 8.3. 2025-06-17 04:21:49 +03:00
Andrey Semashev
a526242486 Check whether Boost.Graph supports the current compiler.
Recent change to Boost.Math, on which Boost.Graph depends, made it
incompatible with MSVC 14.0. Rather than check for a specific compiler
version, add a configure-time check whether Boost.Graph compiles (or
at least the part that is used in Boost.Parameter tests). Disable the
tests that depend on Boost.Graph if that check fails.

Refs https://github.com/boostorg/math/issues/1275.
2025-06-17 00:49:48 +03:00
Andrey Semashev
c86e3e4dec Removed unneeded dependency on Boost.Graph.
The literate/default-expression-evaluation0 test did not actually need
anything from Boost.Graph, so remove the dependency.
2025-06-17 00:49:48 +03:00
Andrey Semashev
253b11d0df Removed MinGW-w64 gcc 6.3 job from AppVeyor.
The compiler does not provide synchronization lib, which is needed by
Boost.Atomic.
2025-06-17 00:47:41 +03:00
Andrey Semashev
248b911831 Split clang-cl 32 and 64-bit jobs, add MinGW-w64 gcc 8 jobs.
The clang-cl builds fail with "unable to load mspdbcore.dll", so split
it into 32 and 64-bit jobs and invoke env setup scripts for each of the
job.

Also add MinGW-w64 jobs with gcc 8.1.
2025-06-16 14:41:13 +03:00
Andrey Semashev
530564aa2a Increased GitHub Actions jobs timeout. 2025-06-13 11:39:47 +03:00
Andrey Semashev
e67ba43bc9 Use Azure mirrors of Ubuntu .deb repositories in containers.
This reduces the likelihood of spurious CI failures caused by DDoS filters
being triggered by massive numbers of concurrent CI jobs.
2025-06-13 03:51:42 +03:00
Andrey Semashev
782f1b14a9 Added new gcc and clang jobs to GitHub Actions. 2025-06-13 03:51:21 +03:00
Andrey Semashev
1e842b3f34 Removed windows-2019 GitHub Actions jobs.
The windows-2019 image is deprecated and is about to be removed.
2025-06-13 03:49:28 +03:00
Andrey Semashev
a5a7e548db Removed obsolete GHA images, added new compilers. 2025-04-19 19:46:15 +03:00
René Ferdinand Rivera Morell
c142f7bdc2 Add support for modular build structure. (#114)
* Make the library modular usable.

* Switch to library requirements instead of source. As source puts extra source in install targets.

* Add requires-b2 check to top-level build file.

* Bump B2 require to 5.2

* Change all <source> references to <library>.

* Update copyright dates.

* Move inter-lib dependencies to a project variable and into the build targets.

* Update build deps.
2024-08-19 00:55:03 +03:00
Andrey Semashev
dadb7c1222 Removed gcc-4.7 from GitHub Actions.
The compiler is not able to handle Boost.LexicalCast.
2024-08-19 00:46:49 +03:00
Andrey Semashev
ea493c7cd7 Removed legacy MinGW job from AppVeyor.
Legacy MinGW seems to not support std::mutex, which is used by some of
the test dependencies.
2024-07-28 01:09:05 +03:00
Andrey Semashev
f31a7acfcc Replaced macos-11 GHA image with 12, 13 and 14 since 11 is being removed. 2024-05-21 01:21:31 +03:00
Andrey Semashev
c07f2b8d37 Merge pull request #113 from grafikrobot/modular
This removes test project ID that will conflict with modular ID.
2024-03-02 11:33:48 +03:00
Rene Rivera
c540c03077 This removes the superflous test project ID that will conflict with the modular project IDs for all libraries. 2024-03-01 21:04:42 -06:00
Andrey Semashev
40a1a578a0 Added Windows jobs to GHA CI. 2024-02-06 01:02:25 +03:00
Andrey Semashev
d830d33246 Replaced actions/checkout usage with manual download commands.
This fixes the deprecation warnings for actions/checkout@v3. actions/checkout@v4
is not functional because of the upstream bug:

https://github.com/actions/checkout/issues/1590
2024-02-06 01:00:41 +03:00
Andrey Semashev
0915736af0 Reduced CI job timeouts. 2024-02-06 00:59:09 +03:00
Andrey Semashev
5db4ec8318 Added gcc-13 and clang-17 CI jobs. 2024-02-06 00:57:36 +03:00
Andrey Semashev
9328dbb7c3 Removed $Date$ tags from docs.
These tags were not being updated for a long time now.
2024-01-03 01:35:20 +03:00
Andrey Semashev
c4a9b94080 Removed gcc-4.6 from CI as it lacks C++11 template aliases used in Boost.TypeOf. 2023-11-17 17:53:29 +03:00
Andrey Semashev
8fe5cf5d0d Remove C++03 CI jobs, use gcc-11 libstdc++ in clang-12 through 15.
Clang 12 through 15 does not support libstdc++-13 in C++23 mode.
2023-11-17 13:55:43 +03:00
Andrey Semashev
6538609cf5 Trim trailing spaces. 2023-06-05 16:06:33 +03:00
Andrey Semashev
02e1c566f7 Copy boost::timer to tests since the original is deprecated and giving errors.
We're not using Boost.Timer v2 components to avoid linking tests with its
separately compiled binary. The legacy boost::timer is fine for the test
purposes.
2023-06-05 16:03:18 +03:00
Andrey Semashev
b35192723c Add clang-16 CI jobs, switch to clang-15 from stock Ubuntu repos. 2023-06-05 03:21:51 +03:00
Andrey Semashev
e1f75be395 Updated to GHA checkout@v3 to avoid deprecation warnings. 2022-10-18 17:58:37 +03:00
Andrey Semashev
fae4c2dacc GitHub Actions config update.
- Added gcc-12 and clang-13 through 15 jobs.
- Added C++23 testing for gcc and clang on Linux.
- Updated clang version for UBSAN job.
- Updated Ubuntu version for clang jobs to avoid having to use external APT
  repository.
- Updated python package installation for compatibility with Ubuntu 22.04.
2022-09-10 01:45:30 +03:00
Andrey Semashev
665cdbc94c Switched gcc-9 to ubuntu-20.04 GHA CI image. 2022-08-14 17:55:06 +03:00
Andrey Semashev
df9ea43b66 Replaced ubuntu-18.04 GHA CI images with containers.
Also use ubuntu-latest image for jobs that are running in a container.
2022-08-14 14:12:49 +03:00
Andrey Semashev
0376be4112 Switch to macos-11 GHA image as macos-10.15 is deprecated. 2022-08-12 16:02:38 +03:00
Andrey Semashev
c82f2ec688 Added VS2022 and clang-win jobs and C++20 and C++latest jobs to AppVeyor CI. 2022-06-06 03:04:12 +03:00
Andrey Semashev
9780d8338f Removed Python tests.
All Python-related functionality, including tests, were moved to a separate
parameter_python submodule.
2021-12-08 18:27:27 +03:00
Andrey Semashev
b06ee2bf8a Updated check for apt-add-repository capabilities.
In Ubuntu 20.04 there appeared an updated version of the
software-properties-common package in focal-updates, which ships a newer
apt-add-repository version that doesn't support -P/-S/-U command line arguments.

Since we cannot rely on package version checks to determine apt-add-repository
capabilities, we have to parse its --help output instead.

Also, made source list processing more protected against spaces.
2021-11-16 00:57:49 +03:00
Andrey Semashev
d52fef9cb1 Fixed git version check on Mac OS. 2021-09-26 20:42:21 +03:00
Andrey Semashev
56bd845cff Disable python tests under UBSAN because of failures. 2021-09-16 01:47:49 +03:00
Andrey Semashev
d95a1617a1 Added libpython-dev and libpython3-dev installation in containers. 2021-09-16 01:37:47 +03:00
Andrey Semashev
7192dd51a9 Fixed GHA link. 2021-09-15 21:51:35 +03:00
Andrey Semashev
40f362bea3 Updated README.md to replace Travis CI links with GitHub Actions. 2021-09-15 21:50:22 +03:00
Andrey Semashev
badc449092 Added GitHub Actions CI config. 2021-09-15 21:48:02 +03:00
Andrey Semashev
a1986ac445 Removed Travis CI config.
Since Travis CI no longer runs free jobs for open source projects,
we are migrating to GitHub Actions instead.
2021-09-15 21:46:49 +03:00
Peter Dimov
94bfc0544a Update tests/CMakeLists.txt 2021-06-07 03:33:22 +03:00
Peter Dimov
91b5d79782 Update test/CMakeLists.txt 2021-05-30 08:10:46 +03:00
Peter Dimov
aeb122089c Regenerate CMakeLists.txt 2021-05-30 07:37:42 +03:00
Andrey Semashev
27d0bfaf8c Merge branch 'develop' 2021-03-17 17:35:27 +03:00
Andrey Semashev
e38b1160ae Disabled python tests on Cygwin and Cygwin64 on AppVeyor CI.
Python headers are not installed in Cygwin and Cygwin64, so the compiler
picks up Win32 headers in C:\Python27\Include and fails.
2021-03-17 12:12:39 +03:00
Andrey Semashev
6f4cdc939d Fixed Boost.Bind deprecated warnings in tests. 2021-03-17 11:55:40 +03:00
Andrey Semashev
63104db02c Added a missing include in test. 2021-03-17 11:55:40 +03:00
Andrey Semashev
8f1405b880 Converted clang APT references to source lines for Tranis CI.
APT references are not consistently defined for all clang versions
on all Ubuntu instances, so just always use explicit APT source lines.
2021-03-17 11:55:40 +03:00
Andrey Semashev
c397e90107 Fixed a typo in AppVeyor CI config. 2021-03-17 02:58:33 +03:00
Andrey Semashev
b3ed2d1bcf CI updates: new compilers, git checkout and job running optimizations. 2021-03-17 02:51:46 +03:00
Andrey Semashev
3eada7d595 Added README.md. 2021-03-17 01:53:38 +03:00
Andrey Semashev
9f0b903f88 Corrected typos and added a reference to PR for MSVC 2015 workaround. 2021-03-14 14:10:23 +03:00
Andrey Semashev
187377089a Merge pull request #109 from OBorce/fix-msvc2015-default_r_
Fix default_r_ move constructor on MSVC 2015
2021-03-14 14:06:02 +03:00
Boris Oncev
983bf6bebc Fix default_r_ move constructor on MSVC 2015
MSVC 2015 misscompiles moves for classes containing RValue refs
using the default generated move constructor when moving into a
function.

Example of reproduction:

struct RValueHolder {
  std::string&& str;
};

bool buggy_move(RValueHolder dead) {
  // here str is not referencing the string any more
  return dead.str == "p";
}

TEST(Bug, TmpBug) {
  std::string p = "p";
  auto t = RValueHolder{ std::move(p) };
  auto res = buggy_move(std::move(t));
  EXPECT_TRUE(res);
}

Fixes boostorg/log#132
2021-03-14 09:20:36 +00:00
Edward Diener
e16f1025d7 Merge pull request #107 from eldiener/develop
[skip ci] Add "cxxstd" json field
2021-01-21 02:01:06 -05:00
Edward Diener
7d168437b7 [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 23:57:10 -05:00
Glen Fernandes
d59eb4aadd Merge branch 'develop' 2020-09-05 13:51:56 -04:00
Edward Diener
9fc61ba8ff Merge pull request #103 from eldiener/develop
Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74. Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost conf…
2020-08-14 23:49:25 -04:00
Edward Diener
fb1a25471c Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers. 2020-03-31 14:17:56 -04:00
Glen Fernandes
59306fe2ed Merge pull request #99 from Lastique/fix_arg_with_default_rvalue
Fix argument value selection with an rvalue default
2020-03-23 11:07:24 -04:00
Andrey Semashev
201a7e20d0 Fix argument value selection with an rvalue default.
In C++11 mode, when named parameter pack was a single tagged argument,
parameter value was not extracted when an rvalue default value was
provided by the user (instead, the default value was returned). This
commit adds a missing overload for default_r_, which returns the parameter
value.

Fixes https://github.com/boostorg/parameter/issues/97.
2020-03-15 18:20:34 +03:00
Glen Fernandes
c31433af1f Merge branch 'develop' 2019-12-21 15:09:35 -05:00
Glen Fernandes
0f548424a5 BOOST_PARAMETER_ prefix include guard macros 2019-12-18 08:45:43 -05:00
Cromwell D. Enage
ba78e65f93 Merge 'develop' to 'master' 2019-10-09 05:45:12 -04:00
Cromwell D. Enage
5a2328751a Reinstate documentation with corrections 2019-10-09 05:41:21 -04:00
CromwellEnage
e80fba3fd9 Reinstate documentation with corrections 2019-10-09 05:39:39 -04:00
Cromwell D. Enage
0d482ed0cf Merge with boostorg/parameter 2019-09-02 17:21:15 -04:00
Cromwell D. Enage
1baff677d5 Temporarily remove broken documentation source files.
Temporarily disable document autogeneration.
2019-08-08 22:00:01 -04:00
CromwellEnage
a028278ec5 Temporarily disable document autogeneration 2019-08-08 19:19:42 -04:00
CromwellEnage
3d430b22be Temporarily remove broken documentation source files. 2019-08-07 23:18:32 -04:00
Cromwell D. Enage
c2f24094f1 Merge 'develop' to 'master' 2019-06-28 20:32:25 -04:00
Cromwell D. Enage
a6024c0ec7 Merge with boostorg/parameter 2019-06-28 17:35:49 -04:00
Cromwell D. Enage
6037aee098 Merge pull request #87 from CromwellEnage/fix_issues
Remove unnecessary BOOST_CONSTEXPR occurrences
2019-06-28 17:25:42 -04:00
CromwellEnage
2d7414f095 Remove unnecessary BOOST_CONSTEXPR occurrences
Fix Issue #86.
2019-06-28 05:55:16 -04:00
Cromwell D. Enage
a0ed362e76 Merge 'develop' to 'master' 2019-06-20 23:03:43 -04:00
Cromwell D. Enage
015aff617b Merge with boostorg/parameter 2019-06-20 17:45:26 -04:00
Cromwell D. Enage
e2d589dec7 Upgrade .travis.yml
* Add clang++-6.0 with cxxstd=2a for linux, clang++-7 for linux, and clang++-8 for linux to test matrix.
* Change sources to adapt to change in Travis Cl test environment from "trusty" to "xenial".
2019-06-20 16:23:46 -04:00
CromwellEnage
f933d797fe Upgrade .travis.yml
* Add clang++-6.0 with cxxstd=2a for linux, clang++-7 for linux, and clang++-8 for linux to test matrix.
* Change sources to adapt to change in Travis Cl test environment from "trusty" to "xenial".
2019-06-19 20:54:20 -04:00
Cromwell D. Enage
979d8091ad Merge with boostorg/parameter 2019-04-30 08:56:27 -04:00
Cromwell D. Enage
75e9295748 Merge pull request #76 from Mike-Devel/min_cmake
Add minimal cmake support
2019-04-30 08:54:02 -04:00
Cromwell D. Enage
dc6cb9a2fd Merge pull request #82 from boostorg/develop
Merge 'develop' to 'master'
2019-04-30 08:34:43 -04:00
Cromwell D. Enage
c28195f464 Merge with boostorg/parameter 2019-04-29 23:54:59 -04:00
Cromwell D. Enage
3876bdf4b2 Merge pull request #81 from CromwellEnage/fix_regressions
Fix compiler errors for MSVC-14.2
2019-04-29 23:51:13 -04:00
CromwellEnage
0bb3ba54da Fix compiler errors for MSVC-14.2 2019-04-29 18:07:43 -04:00
Cromwell D. Enage
8f2cd502bf Merge pull request #77 from boostorg/develop
Merge 'develop' changes
2019-04-28 00:16:18 -04:00
Cromwell D. Enage
914b0a32c8 Merge with boostorg/parameter 2019-04-27 17:50:04 -04:00
Cromwell D. Enage
0ba17c2e2a Merge pull request #79 from CromwellEnage/doc_reference
Add missing reference documentation for lazy_value_type
2019-04-27 17:46:44 -04:00
CromwellEnage
e3849687e4 Add missing reference documentation for lazy_value_type 2019-04-27 16:24:26 -04:00
Cromwell D. Enage
e24f86a7fa Merge with boostorg/parameter 2019-04-27 16:23:15 -04:00
Cromwell D. Enage
384cd299ec Merge pull request #78 from CromwellEnage/update_scripts
Update appveyor.yml to handle changes in Boost.Build
2019-04-27 16:21:57 -04:00
CromwellEnage
241be29095 Update appveyor.yml to handle changes in Boost.Build 2019-04-27 14:45:20 -04:00
Cromwell D. Enage
309dd7e1c1 Merge with boostorg/parameter 2019-04-27 14:44:00 -04:00
Cromwell D. Enage
dbf4dd24f5 Merge pull request #75 from CromwellEnage/feature_compose
Add metafunction result_of::compose
2019-04-27 07:57:48 -04:00
Cromwell D. Enage
6509aa3bad Merge pull request #74 from CromwellEnage/update_config
Set BOOST_PARAMETER_COMPOSE_MAX_ARITY to 20 for GCC 5-
2019-04-27 07:57:11 -04:00
Mike Dev
3ced1d1ac8 [CMake] Remove unnecessary dependency for test 2019-04-15 17:12:12 +02:00
Mike Dev
5e80ac9882 [CMake] Fix whitespace 2019-04-15 12:36:31 +02:00
Mike Dev
7812625cdd [CMake] Allow running of (some) unit tests from cmake 2019-04-15 11:51:06 +02:00
Mike Dev
fd2ecd6924 [CMake] Add minimal cmake support for add_subdirectory 2019-04-15 11:50:24 +02:00
CromwellEnage
7d1cee2cb7 Add metafunction result_of::compose
Some Boost.Graph algorithms return one of their optional named function parameters.  If the user doesn't specify the parameter, then the default return type must necessarily be different.  This metafunction is needed to help facilitate computation of such a return type without resorting to decltype(), which not all compilers support.
2019-02-19 10:55:25 -05:00
CromwellEnage
352f6fb4a8 Set BOOST_PARAMETER_COMPOSE_MAX_ARITY to 20 for GCC 5-
The Boost regression test matrix shows failures with GCC 5 due to running out of heap space. The goal of this commit is to eliminate these failures.
2019-02-15 16:51:06 -05:00
CromwellEnage
2482e7db56 Set BOOST_PARAMETER_COMPOSE_MAX_ARITY to 20 for MinGW
In my GitHub fork of Boost.Graph, I've been upgrading some algorithms to use BOOST_PARAMETER_FUNCTION, but MinGW with GCC 5.3.0 has been running out of heap space on some of the affected tests.  The goal of this commit is to eliminate these occurrences.
2019-02-14 08:36:29 -05:00
Cromwell D. Enage
52c440a5ae Merge with boostorg/parameter 2019-02-14 08:30:12 -05:00
Edward Diener
9f778f0d62 Merge pull request #73 from CromwellEnage/feature_parameter_dependent_return_types
Improve support for parameter-dependent return types of functions generated by preprocessor macros
2019-02-04 10:23:43 -05:00
CromwellEnage
af3411f506 Restrict #include statements to one line each 2019-02-03 23:27:46 -05:00
CromwellEnage
66a363b4c6 Remove extraneous whitespace 2019-02-02 19:53:08 -05:00
CromwellEnage
e0b16eb3e9 Improve support for parameter-dependent return types of functions generated by preprocessor macros
The code generation macros are supposed to support parameter-dependent return types, but it turns out that they currently don't really do that.  This commit fixes the issue.
2019-02-02 09:31:15 -05:00
Cromwell D. Enage
4170d35555 Merge with boostorg/parameter 2019-02-02 08:21:49 -05:00
Edward Diener
541e9ade24 Merge pull request #71 from CromwellEnage/internal_fixes
Eliminate warnings regarding undefined inline functions
2019-01-25 17:14:04 -05:00
CromwellEnage
3bf8242fe4 Eliminate warnings regarding undefined inline functions 2019-01-22 03:19:38 -05:00
Cromwell D. Enage
9bde4a2260 Merge with boostorg/parameter 2019-01-22 03:06:49 -05:00
Edward Diener
f453a586f3 Merge pull request #70 from CromwellEnage/feature_mp11
Reinstate MP11 support for ArgumentPacks
2019-01-21 16:43:09 -05:00
CromwellEnage
7b2d3f6e41 Reinstate MP11 support for ArgumentPacks
Argument packs qualify as Boost.MP11-style maps as well as MPL sequences.  These maps store the keyword tag types as their keys.
2019-01-21 01:14:59 -05:00
Cromwell D. Enage
2b796a8746 Merge with boostorg/parameter 2019-01-21 01:09:19 -05:00
Edward Diener
e7c2118e91 Merge pull request #69 from CromwellEnage/feature_mp11
Modify MP11 support
2019-01-20 07:36:29 -05:00
CromwellEnage
6bce8119bf Disable MP11 usage for affected tests 2019-01-19 17:42:41 -05:00
CromwellEnage
fe73177b6c Modify MP11 support
These are breaking changes to PR #66.

* Remove are_tagged_arguments_mp11 and is_argument_pack_mp11.  They were reviewed as redundant.
* Remove MP11 support for ArgumentPack models for now.  (This feature relied on templates that were not supposed to be specialized.)
2019-01-19 15:15:20 -05:00
Cromwell D. Enage
59616f3a0a Merge with boostorg/parameter 2019-01-19 13:20:19 -05:00
Edward Diener
54a3f15a57 Merge pull request #68 from CromwellEnage/doc_nullptr
Remove erroneous 'std::' prefix from nullptr in documentation
2019-01-19 11:23:48 -05:00
Edward Diener
9a84ed5cdb Merge pull request #67 from CromwellEnage/remove_dependency_on_tti
Remove dependency on Boost.TTI
2019-01-19 11:23:01 -05:00
CromwellEnage
8d1c3f57a1 Remove erroneous 'std::' prefix from nullptr in documentation 2019-01-17 15:23:06 -05:00
CromwellEnage
fb5683766b Remove dependency on Boost.TTI
Replace BOOST_TTI_DETAIL_NULLPTR with BOOST_PARAMETER_AUX_PP_NULLPTR.
2019-01-17 15:14:48 -05:00
Cromwell D. Enage
977ff25b1b Merge with boostorg/parameter 2019-01-17 15:00:27 -05:00
Edward Diener
4a5356b229 Merge pull request #66 from CromwellEnage/feature_mp11
Support Boost.MP11 when feasible
2019-01-16 18:44:14 -05:00
CromwellEnage
69db508992 Support Boost.MP11 when feasible
* Add are_tagged_arguments_mp11 and is_argument_pack_mp11 metafunctions when Boost.MP11 is usable.
* Predicate requirements can be encoded as Boost.MP11-style quoted metafunctions as well as by MPL binary metafunction classes.
* Argument packs qualify as Boost.MP11-style lists as well as MPL sequences.
* Internal components and test programs use Boost.MP11 and C++11 type traits vice MPL and Boost.TypeTraits when Boost.MP11 is usable.
2019-01-16 12:03:44 -05:00
Cromwell D. Enage
689a9525d4 Merge with boostorg/parameter 2019-01-16 09:57:59 -05:00
Edward Diener
e2896116be Merge pull request #64 from CromwellEnage/feature_constexpr
Qualify applicable constructors & functions with BOOST_CONSTEXPR
2019-01-16 09:09:22 -05:00
Edward Diener
313cde1d99 Merge pull request #63 from CromwellEnage/test_suite
Update test suite
2019-01-16 09:08:43 -05:00
CromwellEnage
ead2cb4519 Qualify applicable constructors & functions with BOOST_CONSTEXPR
The reference documentation specifies this for some of the constructors and functions.
2019-01-16 03:43:48 -05:00
CromwellEnage
a2f68bea6c Update test suite
* Add "test/literate/parameter-enabled-function-call-operators0.cpp" to test suite under alias 'parameter_literate_tests'.
* Add compose() test routine to "test/compose.cpp"
* Replace LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC with LIBS_PARAMETER_TEST_COMPILE_FAILURE_VENDOR_SPECIFIC in case compilers other than MSVC start exhibiting errant behavior.
* Adjust for the fact that BOOST_PARAMETER_MAX_ARITY is defined regardless of whether or not BOOST_PARAMETER_HAS_PERFECT_FORWARDING is defined.
* Use minimal file headers to #include vice <boost/parameter.hpp>.
2019-01-16 03:21:13 -05:00
Cromwell D. Enage
b5f02c0aaa Merge with boostorg/parameter 2019-01-16 00:52:05 -05:00
Edward Diener
515c80fad5 Merge pull request #62 from CromwellEnage/test_deduced_unmatched_arg
Update deduced_unmatched_arg.cpp
2019-01-15 23:09:51 -05:00
Edward Diener
b531b64f7b Merge pull request #61 from CromwellEnage/feature_compose_max_arity
Add configuration macro BOOST_PARAMETER_COMPOSE_MAX_ARITY
2019-01-15 23:08:22 -05:00
Edward Diener
1fde7ae869 Merge pull request #60 from CromwellEnage/test_fix
Fix typos
2019-01-15 23:07:46 -05:00
Edward Diener
cb267e5125 Merge pull request #58 from CromwellEnage/test_preprocessor_guards
Update BOOST_PARAMETER_*_ARITY preprocessor guard statements
2019-01-15 23:07:17 -05:00
Edward Diener
387449a12c Merge pull request #57 from CromwellEnage/test_evaluate_category_16
Update evaluate_category_16.cpp
2019-01-15 23:06:55 -05:00
CromwellEnage
c465139bc2 Update deduced_unmatched_arg.cpp
* Normalize license wording.
* Add statements to #include header files that directly define components used in this test.
* Qualify by namespace vice using declarations.
2019-01-14 22:51:12 -05:00
CromwellEnage
e5337e2503 Add configuration macro BOOST_PARAMETER_COMPOSE_MAX_ARITY
Decouple the compose() function and the BOOST_PARAMETER_NO_SPEC_* code generation macros from BOOST_PARAMETER_MAX_ARITY for older compilers so their generated functions can take in more arguments.
2019-01-14 17:05:14 -05:00
CromwellEnage
f2083c84ec Fix typos 2019-01-14 16:55:16 -05:00
CromwellEnage
261819d9bb Update evaluate_category_16.cpp
* Update BOOST_PARAMETER_*_ARITY preprocessor guard statements.
* Use minimal header files to #include.
* Use namespace qualification
2019-01-14 14:46:20 -05:00
CromwellEnage
6451c94720 Update BOOST_PARAMETER_*_ARITY preprocessor guard statements 2019-01-14 14:43:08 -05:00
Cromwell D. Enage
b208f3a837 Merge with boostorg/parameter 2019-01-14 13:10:17 -05:00
Edward Diener
cadc4ecbff Merge pull request #55 from CromwellEnage/test_efficiency
Use minimal header file to #include
2019-01-14 12:53:36 -05:00
Edward Diener
7c9e79aa6e Merge pull request #54 from CromwellEnage/test_singular
Move #include statement to correct place
2019-01-14 12:50:53 -05:00
Edward Diener
b20458faa0 Merge pull request #53 from CromwellEnage/test_max_arity_preproc_guards
Update BOOST_PARAMETER_*_ARITY preprocessor guard statements
2019-01-14 12:49:33 -05:00
Edward Diener
f28b14e686 Merge pull request #52 from CromwellEnage/feature_compose_and_macros
Add are_tagged_arguments<>, compose(), and code generation macros
2019-01-14 12:47:54 -05:00
Edward Diener
5c3dc99d82 Merge pull request #50 from CromwellEnage/workaround_gcc3_or_less
Add workarounds for GCC 3.x or earlier
2019-01-14 12:46:44 -05:00
Edward Diener
55e977964a Merge pull request #49 from CromwellEnage/doc_reference_upgrade
Upgrade reference documentation
2019-01-14 12:43:54 -05:00
Edward Diener
7a430fdfd0 Merge pull request #47 from CromwellEnage/feature_mp11
Introduce support for Boost.MP11
2019-01-14 12:43:30 -05:00
Edward Diener
dab935934e Merge pull request #45 from CromwellEnage/preprocessor_generated_overloads
Upgrade code generation macros
2019-01-14 12:35:37 -05:00
Edward Diener
5d3964f4b6 Merge pull request #44 from CromwellEnage/literate_update
Update literate tests and tutorial documentation
2019-01-14 12:33:26 -05:00
Edward Diener
26cf7a7003 Merge pull request #42 from CromwellEnage/travis_upgrade
Upgrade .travis.yml
2019-01-14 12:32:32 -05:00
CromwellEnage
0a1cd586c0 Change access scope of implementation typedefs from public to private; change spelling 2019-01-14 00:23:59 -05:00
CromwellEnage
d5165a3388 Move #include statement to correct place 2019-01-13 22:58:46 -05:00
CromwellEnage
81406effc8 Upgrade reference documentation
* Add example to compose() function documentation.
* Add cross-referencing hyperlinks & hyperlinks to C++ standard documentation.
2019-01-13 22:53:31 -05:00
CromwellEnage
cada51d711 Fix numbering & const font 2019-01-13 22:35:33 -05:00
CromwellEnage
a9ee94a21b Use minimal header file to #include 2019-01-04 11:43:48 -05:00
CromwellEnage
af65130fa1 Update BOOST_PARAMETER_*_ARITY preprocessor guard statements
Adjust for the fact that BOOST_PARAMETER_MAX_ARITY is defined regardless of whether or not BOOST_PARAMETER_HAS_PERFECT_FORWARDING is defined.
2019-01-04 11:40:07 -05:00
CromwellEnage
a876a4b400 Move #include statement to correct place 2019-01-04 11:32:46 -05:00
CromwellEnage
016f949eba Add are_tagged_arguments<>, compose(), and code generation macros
* Add variadic metafunction boost::parameter::are_tagged_arguments to help improve overload resolution capabilities.  Used by compose() and the new BOOST_PARAMETER_NO_SPEC_* code generation macros.
* Add variadic function template compose() which takes in named arguments and returns them in an argument pack.
* Add code generation macros BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR, BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR, BOOST_PARAMETER_NO_SPEC_FUNCTION, BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION, BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION, BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR, BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR, BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR, and BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR.
2019-01-04 08:39:53 -05:00
CromwellEnage
fe34412116 Add workarounds for GCC 3.x or earlier
* Fix compiler error: base `boost::reference_wrapper<int>' with only non-default constructor in class without a constructor.
* Ignore normalized_argument_types test failures.
2019-01-04 03:57:15 -05:00
CromwellEnage
dcef517081 Upgrade reference documentation
Add usage examples to & remove unnecessary implementation details from reference documentation.
2019-01-04 03:45:54 -05:00
CromwellEnage
c228d46eaf Introduce support for Boost.MP11
<boost/parameter/config.hpp>
* Introduce configuration macros BOOST_PARAMETER_CAN_USE_MP11 and BOOST_PARAMETER_DISABLE_MP11 usage.
* Update perfect forwarding support requirements to fix regressions on test matrix.

<boost/parameter/parameters.hpp>
* Allow mp11::mp_list to be default parameter_spec type if available.
2019-01-04 02:33:50 -05:00
CromwellEnage
250de8367d Upgrade code generation macros
Enable preprocessor-generated function call operator overloads & overloads of the same name to coexist even with deduced arguments.  SFINAE required.
2019-01-01 20:12:13 -05:00
CromwellEnage
01be812580 Update literate tests and tutorial documentation
* Fix compiler failures showing up on regression test matrix due to void return type.
* Fix gcc-3.4 failures showing up regression test matrix due to binding string literals to non-const references to char const*.
* Update tutorial documentation to match literate tests.
2019-01-01 05:27:18 -05:00
CromwellEnage
cbc2663a6c Upgrade .travis.yml
Add clang++-6.0 for linux to test matrix.
2018-12-22 04:58:29 -05:00
Cromwell D. Enage
dd89b991cf Merge with boostorg/parameter 2018-12-22 03:09:43 -05:00
Edward Diener
ee106a3aa1 Updated for b2 cmake support. 2018-12-19 22:32:58 -05:00
Cromwell D. Enage
a5d0ec380f Merge with boostorg/parameter 2018-12-02 06:19:23 -05:00
Edward Diener
28efddc033 Merge pull request #38 from CromwellEnage/doc_index
Fix argument composition tutorial documentation
2018-12-02 01:38:32 -05:00
Edward Diener
756b98bf32 Merge pull request #37 from CromwellEnage/mpl_has_key
Fix mpl::has_key_impl<parameter::aux::arg_list_tag> specialization
2018-12-02 01:37:03 -05:00
CromwellEnage
1626f23369 Fix argument composition tutorial documentation
The compose.cpp test program does not use LIBS_PARAMETER_TEST_COMPILE_FAILURE_2 or LIBS_PARAMETER_TEST_COMPILE_FAILURE_3.
2018-11-29 14:30:27 -05:00
CromwellEnage
655fb40414 Fix mpl::has_key_impl<parameter::aux::arg_list_tag> specialization
<boost/parameter/aux_/arg_list.hpp>
* Use parameter::value_type vice mpl::find.

"test/compose.cpp"
* Test that mpl::has_key evaluates to mpl::false_ for keyword tags that are not in parameter::aux::arg_list.

"test/singular.cpp"
* Test that mpl::has_key evaluates to mpl::false_ for keyword tags that are not in parameter::aux::tagged_argument or parameter::aux::tagged_argument_rref.
2018-11-29 14:20:36 -05:00
Cromwell D. Enage
a083d58c31 Merge with boostorg/parameter 2018-11-28 23:10:47 -05:00
Edward Diener
6a749bcfb1 Change to distinguish parameter_python_test further between 32 and 64 bit Windows builds. 2018-11-23 00:00:07 -05:00
Cromwell D. Enage
35cf0d50cd Merge with boostorg/parameter 2018-11-21 23:31:24 -05:00
Edward Diener
a65875a7c9 Merge pull request #36 from CromwellEnage/template_keyword_and_docs
Upgrade boost::parameter::template_keyword and move to public interface; improve documentation
2018-11-21 22:31:39 -05:00
CromwellEnage
4f776ec9cb Move boost::parameter::template_keyword to public interface
Also move BOOST_PARAMETER_TEMPLATE_KEYWORD macro definition to <boost/parameter/template_keyword.hpp>, but #include this new header file in <boost/parameter/name.hpp> for backward compatibility.
2018-11-21 11:51:12 -05:00
CromwellEnage
c65bbf50a3 Upgrade BOOST_PARAMETER_TEMPLATE_KEYWORD; improve documentation
<boost/parameter/aux_/template_keyword.hpp>
* Apply a modified version of David Abrahams' patch from <https://svn.boost.org/trac10/ticket/2793> which eliminates the need to wrap function types in boost::function or std::function instantiations.

"test/function_type_tpl_param.cpp"
* Demonstrate that keyword types generated by BOOST_PARAMETER_TEMPLATE_KEYWORD now store function types as-is without wrapping them in boost::function or std::function instantiations.

"doc/reference.rst"
"doc/html/reference.html"
* Add BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING as a configuration macro.
* Mention by what libraries other macros which are not a part of Parameter itself are defined.
* Mention which non-Boost.Parameter macros can be altered to affect the Boost.Parameter configuration.
2018-11-21 05:48:14 -05:00
Cromwell D. Enage
c3c6cf76ca Merge with boostorg/parameter 2018-11-21 01:53:14 -05:00
Edward Diener
b565d53bf8 Do not run python test for clang-linux under Windows. 2018-11-20 20:46:13 -05:00
Edward Diener
f41a26af82 Merge pull request #35 from CromwellEnage/stop_the_ice_ing
Define BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY as 0 by default
2018-11-20 13:07:45 -05:00
CromwellEnage
53fa67da1c Define BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY as 0 by default
User library tests have been reporting numerous failures due to internal compiler errors that occur when perfect forwarding is unsupported.  Setting BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY to zero eliminates these failures.  By doing this in Boost.Parameter, we relieve user code of the burden of doing this in their end.  The trade-off is that our own tests need to define BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY explicitly in order to take advantage of the benefits of not having to wrap boost::ref() or std::ref() around non-const lvalues.  As this was always a C++03 workaround, the change should be worth the trade-off.

On an unrelated note, Travis Cl just deprecated "sudo: false".  See <https://blog.travis-ci.com/2018-10-04-combining-linux-infrastructures>.
2018-11-20 08:51:32 -05:00
Cromwell D. Enage
1b2840bfdb Merge with boostorg/parameter 2018-11-20 08:26:02 -05:00
Edward Diener
9179318680 Merge pull request #34 from CromwellEnage/fix_issues
Fix Issue #31, Issue #32, Issue #33
2018-11-20 08:15:17 -05:00
CromwellEnage
7f046f4782 Fix test/Jamfile.v2
s/<version>/<toolset-gcc:version>
2018-11-20 01:50:06 -05:00
CromwellEnage
aab40aafd0 Fix test/Jamfile.v2
Ensure unique test names across aliases.
2018-11-19 21:43:56 -05:00
CromwellEnage
9b8a995b56 Update test/Jamfile.v2
Mark python_test failures on mingw as expected.
2018-11-19 14:54:26 -05:00
CromwellEnage
0283ec60df Fix test suite
"test/Jamfile.v2"
* Rearrange aliases to enable turning off certain tests when they fail for specific compiler configurations
* Reinstate test-suite statement until an undeprecated version can be found.

".travis.yml"
"appveyor.yml"
* Remove specification of alias names
2018-11-19 08:44:56 -05:00
CromwellEnage
716ccb9d85 Rename aliases
Make clear that certain tests run only on certain compilers.
2018-11-17 13:04:24 -05:00
CromwellEnage
a93c420fc7 Fix Issue #31, Issue #32, Issue #33
* Change test/evaluate_category.cpp and test/preprocessor_eval_category.cpp so that the tests pass for msvc-8.0, msvc-9.0, msvc-10.0, and msvc-11.0.
* Change test/Jamfile.v2 so that the compose_fail test runs only for msvc-11.0.
* Ensure that file permissions for header and source files do not include execute.
2018-11-17 11:33:48 -05:00
Cromwell D. Enage
a4f295906f Merge with boostorg/parameter 2018-11-16 23:29:32 -05:00
Edward Diener
d5cd72d2fd Remove executable permissions. 2018-11-16 21:42:25 -05:00
Cromwell D. Enage
318a460d43 Merge with boostorg/parameter 2018-11-16 20:46:52 -05:00
Edward Diener
c8549fc46d Turn off python test for mingw(-64)/gcc 2018-11-16 14:32:16 -05:00
Cromwell D. Enage
302e80397a Merge with boostorg/parameter 2018-11-16 07:41:59 -05:00
Edward Diener
f831585e63 Updated for msvc and particular tests. 2018-11-16 07:19:21 -05:00
Edward Diener
a195406157 Merge pull request #30 from CromwellEnage/tagged_argument_rref
Add missing boost::parameter::aux::tagged_argument_rref::operator[] overloads
2018-11-16 05:10:01 -05:00
CromwellEnage
3c494b663f Add missing boost::parameter::aux::tagged_argument_rref::operator[] overloads
Ultimately needed by "libs/graph/test/isomorphism.hpp"
2018-11-16 02:58:27 -05:00
Edward Diener
3ecf27411b Fixed code when specifying as_lvalue. 2018-11-14 20:22:54 -05:00
Edward Diener
e51b85d85f Distinguish same named run time tests by target. 2018-11-14 12:48:09 -05:00
Cromwell D. Enage
b72c8748a2 Merge with boostorg/parameter 2018-11-12 08:08:49 -05:00
Edward Diener
3bd15375ec Merge pull request #29 from CromwellEnage/comment_fix
Fix multi-line comment
2018-11-12 07:46:24 -05:00
CromwellEnage
05e7eee563 Restrict comment to single line. 2018-11-11 21:51:29 -05:00
CromwellEnage
661e8a699e Fix multi-line comment 2018-11-11 09:27:44 -05:00
Cromwell D. Enage
e5f96c8766 Merge with boostorg/parameter 2018-11-10 15:23:37 -05:00
Edward Diener
22129376c1 Merge pull request #28 from CromwellEnage/nested_keyword
Add keyword generation macro BOOST_PARAMETER_NESTED_KEYWORD
2018-11-10 15:12:16 -05:00
CromwellEnage
7a5d5358b9 Update boost::parameter::aux::tagged_argument
Make inheritance public.
2018-11-10 07:34:20 -05:00
CromwellEnage
65af83cdbe Update compose.cpp
Add code to test BOOST_PARAMETER_NESTED_KEYWORD.
2018-11-10 07:23:29 -05:00
CromwellEnage
61d17aeb43 Add keyword generation macro BOOST_PARAMETER_NESTED_KEYWORD
Upon approval and merging of this commit, replace the definition of BOOST_PARAMETER_NESTED_KEYWORD in <boost/accumulators/accumulators_fwd.hpp> with #include <boost/parameter/nested_keyword.hpp>.
2018-11-09 17:26:37 -05:00
Cromwell D. Enage
87b73e0fc8 Merge with boostorg/parameter 2018-11-09 11:33:40 -05:00
Edward Diener
6d9d61dd3a Merge pull request #27 from CromwellEnage/arg_list_as_mpl_assoc_seq
Add metafunction boost::parameter::is_argument_pack
2018-11-09 10:09:57 -05:00
CromwellEnage
66b4af0125 Add metafunction boost::parameter::is_argument_pack
Also upgrade boost::parameter::aux::arg_list, boost::parameter::aux::tagged_argument, and boost::parameter::aux::tagged_argument_rref to model the MPL Associative Sequence concept.
2018-11-09 00:32:34 -05:00
Cromwell D. Enage
aaf76c5759 Merge with boostorg/parameter 2018-11-08 01:50:20 -05:00
Edward Diener
6a53e1ac6b Merge pull request #26 from CromwellEnage/perfect_forwarding_with_cxx03_support
Reinstate C++03 workarounds
2018-11-07 18:18:11 -05:00
CromwellEnage
8ad69bc3f3 Fix .travis.yml
Mark ICE failures as expected.
2018-11-07 12:08:22 -05:00
CromwellEnage
00ac706ad8 Reinstate C++03 workarounds
Resolve merge conflicts arising from merging PR#23 into boostorg:develop.
2018-11-07 10:30:26 -05:00
Cromwell D. Enage
899891d1a3 Merge with boostorg/parameter 2018-11-07 10:14:24 -05:00
Edward Diener
80e1289bf0 Merge pull request #23 from CromwellEnage/perfect_forwarding
Support perfect forwarding
2018-11-07 08:21:55 -05:00
CromwellEnage
9b7eef1fe3 Update boost/parameter/config.hpp
Remove dependency on Boost.Move macros.
2018-11-06 14:11:12 -05:00
CromwellEnage
dceef04330 Update boost/parameter/aux_/maybe.hpp
Remove unused #include statements.
2018-10-31 01:52:54 -04:00
CromwellEnage
5fb1ef2871 Fix boost/parameter/parameters.hpp
Change erroneous #include statement from <boost/fusion/container/vector/vector_fwd.hpp> to <boost/fusion/container/list/list_fwd.hpp>.
2018-10-31 00:41:49 -04:00
CromwellEnage
44b34e10f6 Remove c++03 support.
* Replace calls to boost::forward with calls to std::forward.

<boost/parameter/config.hpp>
* Relax perfect forwarding requirements so that msvc-12.0 passes muster.

<boost/parameter/parameters.hpp>
* Use boost::mpl::vector if neither boost::fusion::list nor boost::fusion::deque are true variadic MPL sequences.

.travis.yml
appveyor.yml
* Remove test configurations of compilers that fail perfect forwarding requirements.
* Consolidate for fewer jobs.
2018-10-30 08:42:18 -04:00
CromwellEnage
0112583599 Support perfect forwarding
1. The end of section 3.2.1 of the current home page tutorial notes "that because of the forwarding problem, parameter::parameters::operator() can't accept non-const rvalues."  Add code to eliminate this problem.  As a positive side effect, Boost.Parameter-enabled functions and constructors are no longer bound by BOOST_PARAMETER_MAX_ARITY on compilers that support perfect forwarding. User code can now check for this support by detecting the configuration macro BOOST_PARAMETER_HAS_PERFECT_FORWARDING, or manually turn off this support by defining the configuration macro BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING.  See "test/evaluate_category.cpp" and "test/preprocessor_eval_category.cpp" for example usage.

2. Add parameter category qualifiers "consume" and "move_from"(current qualifiers are "in", "out", "in_out", and "forward") based on http://www.modernescpp.com/index.php/c-core-guidelines-how-to-pass-function-parameters.

3. Update documentation to reflect the above changes.
2018-10-29 10:10:01 -04:00
Cromwell D. Enage
77a9508a65 Merge with boostorg/parameter 2018-10-29 07:39:29 -04:00
Edward Diener
cace644c0e Merge pull request #22 from CromwellEnage/restructure_tests
Restructure tests
2018-10-29 05:02:57 -04:00
CromwellEnage
d526784e05 FIx misspelling. 2018-10-28 23:34:31 -04:00
CromwellEnage
5b554b5f44 Remove dependency on boost::container::string
Replace with std::string.
2018-10-28 22:49:55 -04:00
CromwellEnage
06a0cc79e5 Prettify code 2018-10-28 22:14:17 -04:00
CromwellEnage
278a728906 Restructure tests.
<boost/parameter/parameters.hpp>:
* Add preprocessor conditional statement to prevent generation of ill-formed function call operator overloads.

"test/maybe.cpp"
"test/singular.cpp"
"test/tutorial.cpp"
"test/sfinae.cpp"
"test/earwicker.cpp"
* Replace BOOST_PARAMETER_KEYWORD statements with BOOST_PARAMETER_NAME statements.

"test/optional_deduced_sfinae.cpp"
"test/normalized_argument_types.cpp"
"test/literate/*.cpp"
* Use Boost.Core.LightweightTest where int main() is available.
* Replace assert statements with BOOST_TEST_EQ statements.

"test/basics.hpp"
* Remove preprocessor statements regarding borland, gcc-2, and msvc workarounds.

"test/ntp.cpp"
"test/sfinae.cpp"
"test/earwicker.cpp"
"test/normalized_argument_types.cpp"
"test/basics.hpp"
* Add preprocessor conditional statement to #error out if BOOST_PARAMETER_MAX_ARITY is set to an insufficient value.

"test/basics.cpp"
"test/deduced.cpp"
"test/macros.cpp"
"test/preprocessor.cpp"
"test/preprocessor_deduced.cpp"
* Replace S and char const* expressions with boost::container::string expressions.
* Uncomment any code that fails to compile, but add preprocessor conditional statement so that test suites can incorporate compile-fail statements regarding the code in question.
* Ensure that int main() returns boost::process_errors().

"test/literate/deduced-template-parameters0.cpp":
"test/literate/exercising-the-code-so-far0.cpp":
* Enclose BOOST_MPL_ASSERT statements within MPL_TEST_CASE block.

"test/literate/defining-the-keywords1.cpp":
* Add graphs::tag::graph::qualifier type definition because perfect forwarding code will check for it.
* Replace deprecated keyword::get() invocation with keyword::instance invocation.

test/Jamfile.v2:
* Add modifier <define>BOOST_PARAMETER_MAX_ARITY=# to run, run-fail, compile, and compile-fail statements to conserve compiler memory usage on GitHub's side.
* Add modifier <preserve-target-tests>off to run and run-fail statements to conserve executable space on GitHub's side.
* Separate bpl-test statement into its own target, parameter_python_test, which fails on xcode8.3 as well as on mingw and msvc compilers with address-model=64.
* The next commit (which will implement perfect forwarding) will subsume test/literate/Jamfile.v2 into this file.  Strangely enough, attempting to do so now will result in compiler errors.

.travis.yml:
* Add g++-4.7, g++-4.8, g++-4.9, clang++-3.5, clang++-3.6, clang++-3.7, clang++-3.8, clang++-3.9, clang++-4.0, xcode7.3, and xcode8.3 compiler configurations.
* Split compiler configurations by available CXXSTD values.  (This will keep the job times within limits for the next commit.)
* Ensure that the xcode8.3 compiler configurations exclude parameter_python_test from the test suite.

appveyor.yml:
* Add compiler configurations that support address-model=64 to the test matrix.
* Ensure that the new configurations exclude parameter_python_test from the test suite.
2018-10-28 13:13:07 -04:00
Cromwell D. Enage
79e042b590 Merge with boostorg/parameter 2018-10-25 22:29:20 -04:00
Edward Diener
57e3674bdd Merge pull request #21 from CromwellEnage/qualified_name
Support additional parameter categories
2018-10-25 21:59:19 -04:00
CromwellEnage
7441b2e72b Support additional parameter categories
Add parameter category qualifier "forward" (current qualifiers are "in", "out", and "in_out") based on http://www.modernescpp.com/index.php/c-core-guidelines-how-to-pass-function-parameters.  Add new usage syntax BOOST_PARAMETER_NAME((object-name), namespace-name) qualifier(tag-name)) and BOOST_PARAMETER_NAME(qualifier(name)).  (Existing code that uses qualifiers directly and correctly with BOOST_PARAMETER_FUNCTION and other code generation macros should remain unaffected for now, so no breaking changes.)  The reason for the change in usage is to enable applying of parameter category constraints to Boost.Parameter-enabled functions and constructors invoked through argument composition.  (Otherwise, it is currently possible to use argument composition to bypass parameter category constraints applied in BOOST_PARAMETER_FUNCTION et. al.) See "test/compose.cpp" for example usage.
2018-10-25 19:17:41 -04:00
Cromwell D. Enage
105bde609d Merge with boostorg/parameter 2018-10-25 14:00:08 -04:00
Edward Diener
1f25e851bc Merge pull request #20 from CromwellEnage/function_call_operator
Support Boost.Parameter-enabled function call operators.
2018-10-25 10:47:02 -04:00
CromwellEnage
c54b59f8b7 Support Boost.Parameter-enabled function call operators.
* Add code generation macros BOOST_PARAMETER_FUNCTION_CALL_OPERATOR and BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR to <boost/parameter/preprocessor.hpp>.
* Also, add documentation for BOOST_PARAMETER_CONST_MEMBER_FUNCTION, BOOST_PARAMETER_BASIC_FUNCTION, BOOST_PARAMETER_BASIC_MEMBER_FUNCTION, and BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION.
2018-10-25 07:58:11 -04:00
Cromwell D. Enage
8dcdeb307c Merge with boostorg/parameter 2018-10-25 05:55:34 -04:00
Edward Diener
3eb4c31f6f Merge pull request #18 from CromwellEnage/more_modular
Restructure code
2018-10-24 21:53:21 -04:00
CromwellEnage
b0785c2931 Update documentation
Document that boost::parameter::required, boost::parameter::optional, and boost::parameter::deduced are defined in their own header files, which are in turn #included by <boost/parameter/parameters.hpp>.
2018-10-24 16:54:44 -04:00
CromwellEnage
0fdf92a4e3 Update keyword.hpp
Add #include statement for forward declaration.
2018-10-24 12:42:14 -04:00
CromwellEnage
5f5d777691 Restructure code
<boost/parameter/name.hpp>:
* Move support metafunction definitions and BOOST_PARAMETER_TAG_PLACEHOLDER_TYPE macro definition to <boost/parameter/aux_/name.hpp>.
* Move BOOST_PARAMETER_IS_BINARY macro definition to <boost/parameter/aux_/preprocessor/is_binary.hpp>.
* Use BOOST_PARAMETER_TAG_PLACEHOLDER_TYPE macro.
2018-10-24 12:32:27 -04:00
CromwellEnage
2169c5adb4 Restructure code
<boost/parameter/aux_/arg_list.hpp>:
Move forward declarations to their own header files.

<boost/parameter/aux_/tagged_argument.hpp>:
* Move boost::parameter::aux::tagged_argument_base, boost::parameter::aux::is_tagged_argument_aux, and boost::parameter::aux::is_tagged_argument to <boost/parameter/aux_/is_tagged_argument.hpp>
* Remove unnecessary forward declarations.

<boost/parameter/parameters.hpp>:
* Move support metafunction definitions to their own header files in directory boost/parameter/aux_/pack.
* Move support macro definitions to <boost/parameter/aux_/preprocessor/no_perfect_forwarding_begin.hpp> and their corresponding #undef statements to <boost/parameter/aux_/preprocessor/no_perfect_forwarding_end.hpp>.

<boost/parameter/aux_/overloads.hpp> works at the preprocessor level, so move to <boost/parameter/aux_/preprocessor/overloads.hpp>.

<boost/parameter/preprocessor.hpp>:
* Move voidstar type definition to <boost/parameter/aux_/void.hpp>.
* Move support metafunctions to their own header files in directory boost/parameter/aux_/pp_impl.
* Move support macros to header files in directory boost/parameter/aux_/preprocessor/impl.
2018-10-24 12:09:26 -04:00
Cromwell D. Enage
38ef081b68 Merge with boostorg/parameter 2018-10-23 15:21:48 -04:00
Edward Diener
3fdc70d227 Merge pull request #17 from CromwellEnage/compose_with_function_as_argument
Upgrade boost::parameter::aux::tagged_argument
2018-10-23 15:02:02 -04:00
CromwellEnage
8df8cb6417 Update test suite
test/compose.cpp:
Change workarounds from boost::function to std::function since msvc-11.0 reports having a C++11-compliant <functional> header.
Add LIBS_PARAMETER_TEST_RUN_FAILURE configuration macro to facilitate run-fail testing.

test/Jamfile.v2:
Replaced deprecated test-suite statement with alias statements.
Added run-fail test case under its own alias statement.

appveyor.yml:
Add mingw compiler configurations to the test matrix.
Update msvc-11.0 configuration to also execute the run-fail test.

travis.yml:
Ensure that only the standard tests are run, not the run-fail test.
2018-10-23 03:42:03 -04:00
Cromwell D. Enage
7b3f03cb67 Merge pull request #2 from boostorg/develop
Merge with boostorg/parameter
2018-10-19 13:26:03 -04:00
CromwellEnage
42c2996cda Revert "Move preprocessor conditional expressions from main() in test/compose.cpp to tagged_argument.hpp" 2018-10-19 13:05:55 -04:00
CromwellEnage
779fd40e4a Move preprocessor conditional expressions from main() in test/compose.cpp to tagged_argument.hpp
Test the behavior of MSVC-11.0.
2018-10-19 12:24:50 -04:00
CromwellEnage
03c1b24665 Update test/Jamfile.v2
Change compile statement to run statement for compose.cpp
2018-10-19 11:19:11 -04:00
Edward Diener
6fc8feb510 Merge pull request #16 from CromwellEnage/unwrap_cv_reference
Upgrade boost::parameter::aux::unwrap_cv_reference
2018-10-19 09:19:10 -04:00
CromwellEnage
deb0c3b8a3 Upgrade boost::parameter::aux::tagged_argument
Add support for passing functions as arguments to Boost.Parameter-enabled functions.
2018-10-19 02:17:42 -04:00
CromwellEnage
2364c383fa Upgrade boost::parameter::aux::unwrap_cv_reference
Add support for std::reference_wrapper<> and std::ref().
2018-10-19 01:32:57 -04:00
Cromwell D. Enage
ce8ce02ef8 Merge pull request #1 from boostorg/develop
Merge with boostorg/parameter
2018-10-18 01:24:45 -04:00
Edward Diener
ff835044e2 Merge pull request #15 from CromwellEnage/function_type_tpl_param
Upgrade BOOST_PARAMETER_TEMPLATE_KEYWORD
2018-10-17 18:44:32 -04:00
CromwellEnage
5e332ad592 Fix test/Jamfile.v2
Change run statement to compile statement.
2018-10-16 05:04:37 -04:00
CromwellEnage
fb88905a99 Upgrade BOOST_PARAMETER_TEMPLATE_KEYWORD
Keyword templates generated by BOOST_PARAMETER_TEMPLATE_KEYWORD can now accept function types.
2018-10-16 05:01:27 -04:00
Peter Dimov
5d3e39325e Fix link to Python bindings 2018-10-16 06:40:55 +03:00
Peter Dimov
058b1394f5 Use glob instead of path.glob, as it's relative to the Jamfile 2018-10-16 06:26:47 +03:00
Peter Dimov
de183a3b75 Update the parameter_python submodule, as we still keep the Python tests here 2018-10-15 00:29:51 +03:00
Peter Dimov
28a8f75d83 Remove parameter_python documentation 2018-10-15 00:27:41 +03:00
Peter Dimov
2e9b937082 Remove parameter_python headers 2018-10-15 00:26:55 +03:00
Peter Dimov
61d476d4b6 Add libstdc++-5-dev for clang, or <complex> doesn't compile in C++14 mode 2018-10-14 07:35:10 +03:00
Peter Dimov
02a59d2091 Add return boost::report_errors(); 2018-10-13 19:50:17 +03:00
Peter Dimov
007a24b76c Add more Travis configurations 2018-10-13 04:44:05 +03:00
eldiener
672ae1c0ce Removed --depth 1 2017-10-29 21:44:39 -04:00
Edward Diener
f7829bd91c Better appveyor file setup. 2017-10-09 12:08:35 -04:00
Edward Diener
3736a0581e Added Appveyor file and Travis CI file. 2017-10-09 08:20:05 -04:00
Edward Diener
6f747e9869 Removed git executable tag. 2017-09-14 07:57:05 -04:00
Edward Diener
b31fc2bb17 Removed executable under git 2017-09-14 06:43:45 -04:00
Edward Diener
247536c841 Merge remote-tracking branch 'remotes/origin/master' into develop 2017-04-24 12:35:13 -04:00
Edward Diener
fd4a18d490 Merge branch 'develop' 2017-01-04 11:24:52 -05:00
Edward Diener
a2da4c32f5 Merge pull request #9 from rick68/patch-1
improve aux::arg_list<>::operator[]()
2016-12-24 01:27:15 -05:00
Wei-Ming Yang
a3b5ce8a93 improve aux::arg_list<>::operator[]()
Add the assert to avoid ugly message when invoked `arg_list<>::operator[](lazy_default<>)` with `maybe<>`
2016-11-23 09:53:54 +08:00
Edward Diener
612563e0fe Include math.h first to avoid Python _hypot redefinition bug 2016-11-07 15:33:55 -05:00
Edward Diener
904e2f5020 Use unique_ptr instead of auto_ptr where appropriate 2016-11-07 15:32:11 -05:00
Rene Rivera
c303922fe9 Add, and update, documentation build targets. 2016-10-10 11:39:51 -05:00
Rene Rivera
9a8ad86fd7 Add, and update, documentation build targets. 2016-10-07 23:07:35 -05:00
Edward Diener
0461c0a070 Merge branch 'develop'
Conflicts:
	doc/html/index.html
	doc/html/python.html
	doc/html/reference.html
	doc/index.rst
2015-10-15 01:01:28 -04:00
Edward Diener
6ad2d6b207 Fixed ADL problem upon invocation 2015-07-19 13:03:39 -04:00
Sebastien Loriot
45eebd0b85 fix a unused variable warning 2015-07-19 10:09:24 -04:00
Stephen Kelly
d6132a7645 Remove remaining occurances of BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
These evaded scripting.

[SVN r86249]
2015-07-19 10:08:31 -04:00
Stephen Kelly
3462c3dc06 Simplify multi-component ifdefs containing BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
[SVN r86248]
2015-07-19 10:08:17 -04:00
Stephen Kelly
bc19656218 Parameter: Remove obsolete MSVC version checks.
[SVN r86119]
2015-07-19 10:07:55 -04:00
Stephen Kelly
09cc5cf219 Parameter: Remove obsolete GCC version checks.
[SVN r86067]
2015-07-19 10:07:24 -04:00
Vicente J. Botet Escriba
dd466e7d54 Parameter: fix minor warnings.
[SVN r83985]
2015-07-19 10:06:01 -04:00
Edward Diener
368205ab37 Merge pull request #8 from sloriot/patch-2
fix a unused variable warning
2015-07-16 07:40:24 -04:00
Sebastien Loriot
9821c1a5f9 fix a unused variable warning 2015-07-16 13:11:12 +02:00
Edward Diener
d3a422ba6e Merge pull request #6 from eldiener/develop
Remove unneeded and incorrect #line directives, which just confuse so…
2015-05-29 13:13:07 -04:00
Edward Diener
aaf00c5449 Remove unneeded and incorrect #line directives, which just confuse some compilers, most notably VC++ which fails some tests purely on its confusion. 2015-05-27 10:03:38 -04:00
Daniel James
a9a4287f4d Add metadata file. 2015-01-25 21:28:29 +02:00
Peter Dimov
e1f43668e7 Merge pull request #5 from danieljames/metadata
Create metadata file.
2015-01-25 20:32:38 +02:00
Daniel James
3b34198a6f Add metadata file. 2014-08-18 15:08:36 +01:00
Michel Morin
49ab4faa2b Merge r86524 (Correct broken links to C++ standard papers); fixes #9212
[SVN r86673]
2013-11-13 03:22:55 +00:00
Michel Morin
54854d4a3a Correct broken links to C++ standard papers. Refs #9212.
[SVN r86524]
2013-10-30 12:51:24 +00:00
Beman Dawes
45295c87bc Merge 86392 from trunk. The spirit change was not applied because the file is not present in branches/release.
[SVN r86489]
2013-10-27 21:10:04 +00:00
Beman Dawes
0dcd40da74 Add Boost.Build support for the Git modular layout, using links to to new header locations, thus preventing breakage to vast amounts of user code and build setups. Being added to SVN so that changes will automatically propagate to Git and modular Boost. Thanks to Steven Watanabe, Jürgen Hunold, Vladimir Prus, and Bjørn Roald for developing this patch. Steven in particular conceived the approach and did the initial implementation, which was further refined by the other contributors.
[SVN r86392]
2013-10-22 15:23:42 +00:00
Stephen Kelly
a510824ee4 Remove remaining occurances of BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
These evaded scripting.

[SVN r86249]
2013-10-11 23:22:36 +00:00
Stephen Kelly
7465ba08d3 Simplify multi-component ifdefs containing BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
[SVN r86248]
2013-10-11 23:20:59 +00:00
Stephen Kelly
8dca3b7307 Parameter: Remove obsolete MSVC version checks.
[SVN r86119]
2013-10-01 08:48:50 +00:00
Stephen Kelly
51a02e0822 Parameter: Remove obsolete GCC version checks.
[SVN r86067]
2013-09-30 15:58:35 +00:00
Vladimir Prus
a07961f561 Undo previous commit, it was meant for another branch
[SVN r85888]
2013-09-25 08:32:03 +00:00
Vladimir Prus
4e26b448e9 Initial modular patch, from Bjorn.
[SVN r85884]
2013-09-25 08:13:57 +00:00
Vicente J. Botet Escriba
b5e57e0024 Parameter: fix minor warnings.
[SVN r83985]
2013-04-20 14:12:43 +00:00
Lorenzo Caminiti
b74489d477 Merged Boost.Parameter fixes from trunk to support accessing named paramter types tag::x::_.
[SVN r78851]
2012-06-07 18:21:25 +00:00
Tim Blechmann
475001a591 parameter: merge fix from trunk (required for boost.heap)
[SVN r76090]
2011-12-21 11:20:00 +00:00
Tim Blechmann
f9e0d1c5c3 parameter: merge enable_if fix from trunk
[SVN r76069]
2011-12-19 18:00:17 +00:00
Tim Blechmann
23ed477c44 parameter: access enable_if via namespace boost
[SVN r75902]
2011-12-11 14:30:27 +00:00
Tim Blechmann
6427d82103 [parameter] increase BOOST_PARAMETER_MAX_ARITY to 8
applying patch from ticket #6177




[SVN r75811]
2011-12-05 09:55:21 +00:00
Daniel Wallin
436209fa82 Fix Boost.Parameter documentation bugs. Properly test type requirements example.
[SVN r75417]
2011-11-08 22:00:12 +00:00
Daniel Wallin
9d66bd7632 Allow placeholder expressions in the type requirements for BOOST_PARAMETER_FUNCTION et al:
(root_vertex
     , (vertex_descriptor<graphs::graph::_>)
     , *vertices(graph).first)


[SVN r75415]
2011-11-08 21:57:28 +00:00
Daniel James
0b0ce28a8a Parameter: Merge [62231] from release - missing includes.
[SVN r70523]
2011-03-24 21:12:54 +00:00
Marshall Clow
bdcbf442bf Merge fix to release branch, fixes #4983
[SVN r68366]
2011-01-22 15:42:09 +00:00
Marshall Clow
15d8701d77 Fix typo in parameter doc, refs #4983
[SVN r68291]
2011-01-19 15:32:54 +00:00
Andrey Semashev
c9cf0ab0f5 Merged changes from trunk.
[SVN r62272]
2010-05-27 17:58:58 +00:00
Andrey Semashev
ee32bc6f67 Fixed test compilation with C++0x aware compilers. The bind and ref calls should be explicitly qualified with the boost namespace.
[SVN r62241]
2010-05-26 16:30:14 +00:00
Douglas Gregor
20301b3da4 Add some missing includes for the parameter library
[SVN r62231]
2010-05-26 07:47:05 +00:00
Andrey Semashev
c2177b122c Decoupled arg_list and maybe. This removes a few dependencies on other headers and speeds up compilation.
[SVN r62202]
2010-05-25 15:53:47 +00:00
Andrey Semashev
59e172adb3 Added missing include.
[SVN r60776]
2010-03-22 20:18:30 +00:00
Troy D. Straszheim
359b3a5c3a Fix for #3490, parameter depends on python. Use toplevel
aligned_storage and copy in referent_storage metafunction 
from python's detail namespace.  Passes all tests on gcc 4.3.3.



[SVN r57057]
2009-10-22 03:55:24 +00:00
Troy D. Straszheim
522c1e33b0 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
9f4334c1c1 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
Daniel James
7ff5c4b996 Merge some missing link/libraries changes. Fixes #2279,#3454.
Merged revisions 52231,53476 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r52231 | jewillco | 2009-04-07 17:46:32 +0100 (Tue, 07 Apr 2009) | 1 line
  
  Updating maintainer info for BGL, fixes #2279
........
  r53476 | jewillco | 2009-05-31 02:40:59 +0100 (Sun, 31 May 2009) | 1 line
  
  Fixed more links to property_map
........


[SVN r56226]
2009-09-15 21:16:58 +00:00
Troy D. Straszheim
298108e7ed 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
1b1499b94c Add basic copyright/license to keep cmake out of the inspection report
[SVN r55095]
2009-07-22 21:51:01 +00:00
Jeremiah Willcock
ae3bfbad46 Fixed more links to property_map
[SVN r53476]
2009-05-31 01:40:59 +00:00
Daniel Wallin
d8a61e4df7 Silence annoying GCC -Wshadow warnings.
Fixes #3034.


[SVN r53414]
2009-05-29 21:52:29 +00:00
Daniel Wallin
82b5cc0208 Silence "unused parameter" warning in BOOST_PARAMETER_FUNCTION().
Fixes #2808.


[SVN r53402]
2009-05-29 18:06:46 +00:00
Daniel Wallin
91623e6241 parameter-doc: Regenerated HTML from ReST source.
[SVN r50918]
2009-01-30 21:28:11 +00:00
Daniel Wallin
4af5c63d46 parameter-doc: Added missing default value on optional parameter
specification.


[SVN r50915]
2009-01-30 21:08:22 +00:00
David Deakins
1c2f56c672 Restored static-member-functions0 test
[SVN r50890]
2009-01-30 05:55:10 +00:00
Dave Abrahams
08b0a74035 Check in missing file (thanks for pointing that out, David Deakins!)
[SVN r50889]
2009-01-30 00:52:33 +00:00
David Deakins
4c8725641d Commented out missing test file
[SVN r50888]
2009-01-30 00:09:10 +00:00
Dave Abrahams
b91cd816c8 bug fix for value_type and numerous doc fixes, along with literate programming tests
[SVN r50863]
2009-01-28 23:33:37 +00:00
Michael A. Jackson
f9a2fba9ab 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
55792af45f 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
Dave Abrahams
e054a75533 Minor doc cleanups
[SVN r46954]
2008-07-01 15:59:23 +00:00
Daniel Wallin
834f245953 Fixed #1044. ArgumentPack is now available in the return type calculation
[SVN r45226]
2008-05-08 20:04:24 +00:00
Eric Niebler
ef9dfeb2d1 add missing #include
[SVN r44857]
2008-04-28 16:46:33 +00:00
Daniel James
98bcbbad78 Point links to the pages that used to be in 'more' to the site.
[SVN r43210]
2008-02-10 15:02:17 +00:00
Daniel Wallin
d9f0e42397 Applied part of patch from Jens Seidel in: http://svn.boost.org/trac/boost/ticket/1541.
Fixed missing includes.


[SVN r42415]
2008-01-02 17:20:44 +00:00
Markus Schöpflin
0a26a05500 Applied patch by Richard Webb from ticket #1541. This fixes the latest
parameter test failures.


[SVN r42413]
2008-01-02 11:41:33 +00:00
Beman Dawes
2e725894c6 // Add or correct comment identifying Boost library this header is associated with.
[SVN r41173]
2007-11-17 20:13:16 +00:00
Nicola Musatti
a4b2742095 Updated to support C++Builder 2007 Update 3 (bcc32 5.9.2)
[SVN r39945]
2007-10-11 21:09:07 +00:00
Nicola Musatti
2af6d0439e Updated to support C++Builder 2007 Update 3 (bcc32 5.9.2)
[SVN r39944]
2007-10-11 21:07:17 +00:00
Douglas Gregor
276d786ed9 We can no longer use is_base_and_derived with incomplete types, not that it worked well before
[SVN r39247]
2007-09-13 19:58:30 +00:00
Vladimir Prus
7689b5b9d0 Remove V1 Jamfiles
[SVN r38516]
2007-08-08 19:02:26 +00:00
Daniel Wallin
a28883d9ad Fixed typo.
[SVN r37581]
2007-05-03 14:17:06 +00:00
Daniel Wallin
45bac7b579 Regenerated HTML.
[SVN r37580]
2007-05-03 14:12:57 +00:00
Daniel Wallin
e4e6ba52c4 Fixed vertical ellipsis rendering.
[SVN r37578]
2007-05-03 14:11:05 +00:00
Daniel Wallin
6bb4b0ef8b Added reference for more of the PP interface.
[SVN r37577]
2007-05-03 14:10:06 +00:00
Daniel Wallin
e0416b8343 Included "deduced" parameters in the reference.
[SVN r37576]
2007-05-03 11:55:18 +00:00
Daniel Wallin
f8a1b652bc Fixed examples and removed use of boost::lambda.
[SVN r37550]
2007-05-01 14:43:47 +00:00
Dave Abrahams
f7611b8a1f Correct testing bugs:
either changing assert(...) or BOOST_ASSERT(...) to BOOST_TEST
    (in my code only)

    or adding "return boost::report_errors();" where it was clearly
    missing (and a pure bug, in anyone's code).


[SVN r37057]
2007-02-24 22:40:59 +00:00
Dave Abrahams
493a8b28a5 replace "write something here"
[SVN r36569]
2007-01-03 16:45:10 +00:00
Dave Abrahams
32ec272b6d Update with docutils patch for table styles
[SVN r36491]
2006-12-22 14:38:47 +00:00
Daniel Wallin
4c8c0cce93 Tried to address these comments by Dave:
The section on "special" keywords links to a part of the parameter lib
  tutorial that no longer exists. It also says "Therefore we need to tag the
  color keyword as a special keyword" but it never shows how to do such tagging!

  The whole thing about the forwarding function objects is unclear. You show
  one example, but you don't explain why it's needed and you don't explain the
  rules by which it was constructed, so it's not obvious how I would define my
  own.

Work in progress.


[SVN r36383]
2006-12-14 13:26:29 +00:00
Dave Abrahams
8fc7ba81cc Correct typo
[SVN r36006]
2006-11-11 22:25:16 +00:00
Daniel Wallin
5b2b1a47f8 More work on tests.
[SVN r35563]
2006-10-11 22:39:42 +00:00
Daniel Wallin
f3764c539e Worked on tests.
[SVN r35540]
2006-10-10 22:57:46 +00:00
Daniel Wallin
b67fbdff8f Fixed some regressions and added expected failure markup.
[SVN r35451]
2006-10-02 23:35:39 +00:00
Daniel Wallin
0e263f5602 Fixed python test regression and PP test failure.
[SVN r35404]
2006-09-29 00:30:42 +00:00
Daniel Wallin
3c815b31fe Changed how normalized_argument_types works to better match user
expectation.


[SVN r35363]
2006-09-28 13:10:44 +00:00
Daniel Wallin
dbbe37b8c1 Added namespace qualification to "index". Fixes ambiguity problems on
gcc.


[SVN r35359]
2006-09-28 10:22:12 +00:00
Daniel Wallin
ce712b8f30 Fixed typo.
[SVN r35358]
2006-09-28 10:17:40 +00:00
Daniel Wallin
913fa2eb44 Added test for lazy_defaults.
[SVN r35356]
2006-09-27 20:58:22 +00:00
Daniel Wallin
12c873d3e4 Made defaults always lazy in PP interface.
[SVN r35355]
2006-09-27 18:52:28 +00:00
Daniel Wallin
164c48c018 added expected failure markup
[SVN r35337]
2006-09-26 13:57:07 +00:00
Daniel Wallin
2ac8833532 Fixed regressions on borland.
[SVN r35334]
2006-09-26 09:51:38 +00:00
Markus Schöpflin
6556e278c6 Python header must be included first.
[SVN r35319]
2006-09-25 10:40:35 +00:00
Daniel Wallin
1a9e89cb8d Fixed typo
[SVN r35299]
2006-09-23 22:52:34 +00:00
Daniel Wallin
6d53a2b914 Fixed borland failures.
[SVN r35284]
2006-09-23 10:40:16 +00:00
Daniel Wallin
c7296b9a05 Added value_type metafunction and tag::x::_ convenience syntax.
[SVN r35258]
2006-09-21 17:29:15 +00:00
Dave Abrahams
6a5d61ce3c Fix inspection issues
[SVN r35239]
2006-09-21 02:40:19 +00:00
Dave Abrahams
e887f199e0 fix license
[SVN r35232]
2006-09-20 17:34:41 +00:00
Dave Abrahams
e7bd42b07a Add missing license/copyright
[SVN r35230]
2006-09-20 17:28:37 +00:00
Daniel Wallin
b9248d774f Improved error diagnostics. Made depdendent predicates work on
most compilers. Made optional deduced parameters fail SFINAE
when an unmatched parameter is supplied.


[SVN r35226]
2006-09-20 15:03:35 +00:00
Daniel Wallin
763a09c5aa Removed old tests.
[SVN r35214]
2006-09-19 18:22:55 +00:00
Dave Abrahams
07987bc97c SunPro workarounds (fixed)
[SVN r35206]
2006-09-19 15:33:48 +00:00
Dave Abrahams
b59c238a83 SunPro workarounds
[SVN r35205]
2006-09-19 15:31:32 +00:00
Daniel Wallin
9dfa5a8d9e Fixed typo and added SFINAE test.
[SVN r35196]
2006-09-19 13:12:44 +00:00
Daniel Wallin
3d0bdf694c Don't emit errors when using SFINAE.
[SVN r35194]
2006-09-19 11:49:34 +00:00
Daniel Wallin
b5c6e05ea0 Made arguments that isn't matched by any parameter-specs an error.
[SVN r35192]
2006-09-19 11:47:54 +00:00
Daniel Wallin
cc2a478afc Added missing include.
[SVN r35181]
2006-09-18 20:53:57 +00:00
Daniel Wallin
1dab8a1008 Added missing file.
[SVN r35178]
2006-09-18 20:47:46 +00:00
Daniel Wallin
4facdaafc3 New tagging algo. Tests for deduced parameters and preprocessor interface
for deduced parameters.


[SVN r35172]
2006-09-18 20:05:45 +00:00
Daniel Wallin
5190f65321 New algorithm for tagging arguments, and lots of changes to PP code.
[SVN r35168]
2006-09-18 19:55:09 +00:00
Dave Abrahams
0335832574 Sun workarounds
[SVN r35136]
2006-09-16 18:04:50 +00:00
Dave Abrahams
b9f287ea52 Parameter library Workarounds for Borland and MSVC
Parameter library explicit markup for expected failures

value_init.hpp:
  Borland workarounds
  Use angle-includes consistently


[SVN r35084]
2006-09-13 03:00:18 +00:00
Dave Abrahams
28f98ecbf0 Use new working mpl::set functionality.
[SVN r35082]
2006-09-13 00:26:55 +00:00
Dave Abrahams
4e8c8ced0f Attempted SunPro workaround
[SVN r35081]
2006-09-13 00:17:50 +00:00
Dave Abrahams
5baef32925 add missing license/copyright info
[SVN r35068]
2006-09-11 22:08:18 +00:00
Daniel Wallin
cc8ca29980 workarounds for vc6/vc7/borland
[SVN r35020]
2006-09-02 14:36:22 +00:00
Daniel Wallin
e2405e2d00 Added casting of arguments to BOOST_PARAMETER_FUNCTION().
[SVN r35019]
2006-09-02 13:37:23 +00:00
Daniel Wallin
1cba9bd634 updated docs
[SVN r35018]
2006-09-02 09:12:42 +00:00
Daniel Wallin
e58e928af4 Added name.hpp.
[SVN r34944]
2006-08-24 21:12:51 +00:00
Daniel Wallin
c3e842fc4c fixed first test
[SVN r34923]
2006-08-22 19:16:50 +00:00
Daniel Wallin
ab57984c04 Added missing include.
[SVN r34919]
2006-08-22 14:08:27 +00:00
Dave Abrahams
a8dc2bbd25 define some missing helpers for 1st example.
[SVN r34917]
2006-08-22 13:56:24 +00:00
Daniel Wallin
bb838edb2f Changes some things so that the documentation example works.
[SVN r34909]
2006-08-21 11:39:36 +00:00
Dave Abrahams
74b777612e Should work with catch-all header.
[SVN r34892]
2006-08-15 20:40:50 +00:00
Dave Abrahams
ea4457878c cplusplus.py, tool.py: bring back litre_config.py file.
cplusplus.py: unicode unhandled example dump workaround
index.rst: first example checked in


[SVN r34891]
2006-08-15 20:37:51 +00:00
Dave Abrahams
1f3fb08086 most of structure complete
[SVN r34846]
2006-08-07 19:23:43 +00:00
Dave Abrahams
702ca6af6e member functions and ctors
[SVN r34839]
2006-08-07 14:13:07 +00:00
Dave Abrahams
225a38b68a clean up a few ReST-os
[SVN r34833]
2006-08-07 02:03:21 +00:00
Dave Abrahams
de756246e7 deduced template parameters
[SVN r34832]
2006-08-07 01:46:13 +00:00
Dave Abrahams
de67d5fe6d class template progress
[SVN r34831]
2006-08-06 22:08:25 +00:00
Daniel Wallin
40332972ca Added predicate test to preprocessor.cpp
[SVN r34830]
2006-08-06 21:41:30 +00:00
Dave Abrahams
47292301e7 deduced function parameters
[SVN r34826]
2006-08-06 16:52:09 +00:00
Dave Abrahams
7a5a21dacc deduced function parameters
[SVN r34825]
2006-08-06 16:32:50 +00:00
Dave Abrahams
04aaeef41d naming convention
[SVN r34821]
2006-08-06 02:04:34 +00:00
Dave Abrahams
5a0bad4224 More doc progress
[SVN r34813]
2006-08-04 01:15:42 +00:00
Dave Abrahams
07f167eed3 More doc progress
[SVN r34809]
2006-08-03 04:44:35 +00:00
Dave Abrahams
b34aa49ceb progress on tutorial
[SVN r34787]
2006-07-30 21:33:22 +00:00
Daniel Wallin
f5dbd06b32 Fix for Borland.
[SVN r34746]
2006-07-26 22:55:25 +00:00
Dave Abrahams
9bcd7c2fec Borland workaround
[SVN r34695]
2006-07-24 14:37:20 +00:00
Daniel Wallin
7f2abce0d4 Fixed 0-arity init.
[SVN r34528]
2006-07-13 08:16:55 +00:00
Daniel Wallin
b7036ee04f First attempt at reference for new macros.
[SVN r34484]
2006-07-08 22:13:59 +00:00
Daniel Wallin
36d25230e6 Added CallPolicies tests.
[SVN r34476]
2006-07-07 17:40:01 +00:00
Daniel Wallin
d298a327b5 Added support for CallPolicies.
[SVN r34475]
2006-07-07 17:39:20 +00:00
Daniel Wallin
8162166037 updated pp syntax
[SVN r34309]
2006-06-15 11:07:30 +00:00
Dave Abrahams
dbcf8de808 Borland workaround
[SVN r34289]
2006-06-12 19:59:15 +00:00
Dave Abrahams
07893af4c5 Avoid reserved names
[SVN r34184]
2006-06-05 10:35:52 +00:00
Daniel Wallin
2070231553 litre tests
[SVN r34126]
2006-05-31 10:41:34 +00:00
Daniel Wallin
5b1971f1ef Added support for static member functions
[SVN r34124]
2006-05-31 09:44:57 +00:00
Daniel Wallin
988bb4b365 Added support for static member functions.
[SVN r34123]
2006-05-31 09:44:35 +00:00
Daniel Wallin
64bfddc3a7 new macro renames and bugfix for vc6
[SVN r34117]
2006-05-30 08:50:53 +00:00
Daniel Wallin
2a0397c1b2 new macros, macro renames and bugfix
[SVN r34116]
2006-05-30 08:50:33 +00:00
Daniel Wallin
decd9ac9fd new Parameter.Python syntax
[SVN r34094]
2006-05-26 10:53:10 +00:00
Daniel Wallin
a181afc699 new Parameter.Python syntax
[SVN r34093]
2006-05-26 10:52:56 +00:00
Daniel Wallin
a6db5788f6 fixed expansion problem with msvc
[SVN r34092]
2006-05-26 10:52:42 +00:00
Dave Abrahams
d37e7cd513 Checked in updated HTML
[SVN r34003]
2006-05-18 14:59:38 +00:00
Daniel Wallin
6dd64214c2 more editing
[SVN r33964]
2006-05-15 07:13:57 +00:00
Dave Abrahams
96d3e0fd07 More editorial comments.
[SVN r33959]
2006-05-07 19:29:46 +00:00
Daniel Wallin
ac398b0e50 *** empty log message ***
[SVN r33956]
2006-05-07 12:48:02 +00:00
Daniel Wallin
3f1f0657f6 tutorial section, not complete
[SVN r33955]
2006-05-07 12:28:33 +00:00
Daniel Wallin
abae0c8d21 html version of python.rst
[SVN r33954]
2006-05-07 10:59:07 +00:00
Daniel Wallin
892a599999 doc changes
[SVN r33953]
2006-05-07 10:58:37 +00:00
Daniel Wallin
acbf69fdb6 *** empty log message ***
[SVN r33950]
2006-05-06 22:35:42 +00:00
Daniel Wallin
566e886887 *** empty log message ***
[SVN r33949]
2006-05-06 22:03:19 +00:00
Daniel Wallin
ae05e30eac New PP syntax, initial checkin.
[SVN r33948]
2006-05-06 22:00:28 +00:00
Daniel Wallin
310998435c New macro syntax, initial checkin.
[SVN r33947]
2006-05-06 21:54:22 +00:00
Dave Abrahams
647265bfd3 Added editorial comments
[SVN r33946]
2006-05-06 17:13:05 +00:00
Daniel Wallin
76af708b1f fixed rst syntax error
[SVN r33926]
2006-05-04 19:57:20 +00:00
Daniel Wallin
deb606ef59 fixed rst syntax error
[SVN r33925]
2006-05-04 19:56:42 +00:00
Daniel Wallin
721b294842 *** empty log message ***
[SVN r33924]
2006-05-04 15:08:44 +00:00
Daniel Wallin
f40418cf9a *** empty log message ***
[SVN r33923]
2006-05-04 07:43:57 +00:00
Dave Abrahams
b12dbd9f6a Add missing void specialization
[SVN r33886]
2006-05-01 12:47:37 +00:00
Daniel Wallin
6087feef11 python binding docs
[SVN r33836]
2006-04-27 09:42:45 +00:00
Dave Abrahams
e7d652f208 Fix for vc-7
[SVN r33774]
2006-04-24 02:11:11 +00:00
Dave Abrahams
51c3dd4cb1 add missing include
[SVN r33773]
2006-04-24 02:05:02 +00:00
Dave Abrahams
8cf35658bd add missing include
[SVN r33772]
2006-04-24 01:54:41 +00:00
Dave Abrahams
ee2b252418 Portability fixes
[SVN r33752]
2006-04-20 15:18:09 +00:00
Dave Abrahams
45d320a434 Reorganized preprocessor stuff, made vc6 work.
[SVN r33703]
2006-04-15 01:39:17 +00:00
Rene Rivera
76067ad5d2 Remove now uneeded header dependency.
[SVN r33690]
2006-04-13 20:07:57 +00:00
Rene Rivera
15b0729181 Allow keywords to be copyable and default constructable, to facilitate use of keywords outside of Boost.Parameter.
[SVN r33689]
2006-04-13 20:01:51 +00:00
Daniel Wallin
23d30d9ea6 Doc update.
[SVN r33677]
2006-04-12 09:39:51 +00:00
Dave Abrahams
012e0abd22 partially updated docs
[SVN r33645]
2006-04-10 20:41:06 +00:00
Daniel Wallin
225ee5072e Boost.Parameter python binding docs, work in progress.
[SVN r33613]
2006-04-09 20:11:13 +00:00
Daniel Wallin
384add2571 Fixed problem with using joint_view<>.
[SVN r33485]
2006-03-27 13:21:58 +00:00
193 changed files with 46788 additions and 12374 deletions

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

@@ -0,0 +1,607 @@
# Copyright 2021-2025 Andrey Semashev
#
# 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)
name: CI
on:
pull_request:
push:
branches:
- master
- develop
- feature/**
concurrency:
group: ${{format('{0}:{1}', github.repository, github.ref)}}
cancel-in-progress: true
env:
GIT_FETCH_JOBS: 8
NET_RETRY_COUNT: 5
DEFAULT_BUILD_VARIANT: debug,release
jobs:
posix:
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
# Linux, gcc
- toolset: gcc-4.8
cxxstd: "11"
os: ubuntu-latest
container: ubuntu:18.04
install:
- g++-4.8
- toolset: gcc-4.9
cxxstd: "11"
os: ubuntu-latest
container: ubuntu:16.04
install:
- g++-4.9
- toolset: gcc-5
cxxstd: "11,14,1z"
os: ubuntu-latest
container: ubuntu:16.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"
os: ubuntu-latest
container: ubuntu:18.04
install:
- g++-7
- toolset: gcc-8
cxxstd: "11,14,17,2a"
os: ubuntu-latest
container: ubuntu:18.04
install:
- g++-8
- toolset: gcc-9
cxxstd: "11,14,17,2a"
os: ubuntu-latest
container: ubuntu:20.04
install:
- g++-9
- toolset: gcc-10
cxxstd: "11,14,17,20"
os: ubuntu-latest
container: ubuntu:20.04
install:
- g++-10
- toolset: gcc-11
cxxstd: "11,14,17,20,23"
os: ubuntu-22.04
install:
- g++-11
- toolset: gcc-12
cxxstd: "11,14,17,20,23"
os: ubuntu-22.04
install:
- g++-12
- toolset: gcc-13
cxxstd: "11,14,17,20,23"
os: ubuntu-24.04
install:
- g++-13
- toolset: gcc-14
cxxstd: "11,14,17,20,23,26"
os: ubuntu-24.04
install:
- g++-14
- toolset: gcc-15
cxxstd: "11,14,17,20,23,26"
os: ubuntu-latest
container: ubuntu:25.04
install:
- g++-15
- name: UBSAN
toolset: gcc-13
cxxstd: "11,14,17,20,23"
ubsan: 1
build_variant: debug
os: ubuntu-24.04
install:
- g++-13
# Linux, clang
- toolset: clang
compiler: clang++-3.5
cxxstd: "11"
os: ubuntu-latest
container: ubuntu:16.04
install:
- clang-3.5
- toolset: clang
compiler: clang++-3.6
cxxstd: "11,14"
os: ubuntu-latest
container: ubuntu:16.04
install:
- clang-3.6
- toolset: clang
compiler: clang++-3.7
cxxstd: "11,14"
os: ubuntu-latest
container: ubuntu:16.04
install:
- clang-3.7
- toolset: clang
compiler: clang++-3.8
cxxstd: "11,14"
os: ubuntu-latest
container: ubuntu:16.04
install:
- clang-3.8
- 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"
os: ubuntu-latest
container: ubuntu:18.04
install:
- clang-6.0
- toolset: clang
compiler: clang++-7
cxxstd: "11,14,17"
os: ubuntu-latest
container: ubuntu:18.04
install:
- clang-7
# Note: clang-8 does not fully support C++20, so it is not compatible with libstdc++-8 in this mode
- toolset: clang
compiler: clang++-8
cxxstd: "11,14,17,2a"
os: ubuntu-latest
container: ubuntu:18.04
install:
- clang-8
- g++-7
gcc_toolchain: 7
- toolset: clang
compiler: clang++-9
cxxstd: "11,14,17,2a"
os: ubuntu-latest
container: ubuntu:20.04
install:
- clang-9
- toolset: clang
compiler: clang++-10
cxxstd: "11,14,17,20"
os: ubuntu-latest
container: ubuntu:20.04
install:
- clang-10
- toolset: clang
compiler: clang++-11
cxxstd: "11,14,17,20"
os: ubuntu-22.04
install:
- clang-11
- toolset: clang
compiler: clang++-12
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
install:
- clang-12
- g++-11
gcc_toolchain: 11
- toolset: clang
compiler: clang++-13
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
install:
- clang-13
- g++-11
gcc_toolchain: 11
- toolset: clang
compiler: clang++-14
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
install:
- clang-14
- g++-11
gcc_toolchain: 11
- toolset: clang
compiler: clang++-15
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
install:
- clang-15
- g++-11
gcc_toolchain: 11
- toolset: clang
compiler: clang++-16
cxxstd: "11,14,17,20,2b"
os: ubuntu-24.04
install:
- clang-16
- g++-11
gcc_toolchain: 11
- toolset: clang
compiler: clang++-17
cxxstd: "11,14,17,20,23"
os: ubuntu-24.04
install:
- clang-17
- g++-11
gcc_toolchain: 11
- toolset: clang
compiler: clang++-18
cxxstd: "11,14,17,20,23,26"
os: ubuntu-24.04
install:
- clang-18
- g++-13
- toolset: clang
compiler: clang++-19
cxxstd: "11,14,17,20,23,26"
os: ubuntu-24.04
install:
- clang-19
- toolset: clang
compiler: clang++-20
cxxstd: "11,14,17,20,23,26"
os: ubuntu-latest
container: ubuntu:25.04
install:
- clang-20
- toolset: clang
compiler: clang++-20
cxxstd: "11,14,17,20,23,26"
cxxflags: -stdlib=libc++
linkflags: -stdlib=libc++
os: ubuntu-latest
container: ubuntu:25.04
install:
- clang-20
- libc++-20-dev
- libc++abi-20-dev
- name: UBSAN
toolset: clang
compiler: clang++-18
cxxstd: "11,14,17,20,23,26"
cxxflags: -stdlib=libc++
linkflags: -stdlib=libc++
ubsan: 1
build_variant: debug
os: ubuntu-24.04
install:
- clang-18
- libc++-18-dev
- libc++abi-18-dev
- toolset: clang
cxxstd: "11,14,17,20,2b"
os: macos-14
- toolset: clang
cxxstd: "11,14,17,20,23"
os: macos-15
timeout-minutes: 30
runs-on: ${{matrix.os}}
container: ${{matrix.container}}
steps:
- name: Setup environment
run: |
if [ -f "/etc/debian_version" ]
then
echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV
export DEBIAN_FRONTEND=noninteractive
fi
if [ -n "${{matrix.container}}" ]
then
echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV
if [ -f "/etc/debian_version" ]
then
# Use Azure APT mirrors in containers to avoid HTTP errors due to DDoS filters triggered by lots of CI jobs launching concurrently.
# Note that not all Ubuntu versions support "mirror+file:..." URIs in APT sources, so just use Azure mirrors exclusively.
# Note also that on recent Ubuntu versions DEB822 format is used for source files.
APT_SOURCES=()
if [ -d "/etc/apt/sources.list.d" ]
then
readarray -t APT_SOURCES < <(find "/etc/apt/sources.list.d" -type f -name '*.sources' -print)
fi
if [ -f "/etc/apt/sources.list" ]
then
APT_SOURCES+=("/etc/apt/sources.list")
fi
if [ "${#APT_SOURCES[@]}" -gt 0 ]
then
sed -i -E -e 's!([^ ]+) (http|https)://(archive|security)\.ubuntu\.com/ubuntu[^ ]*(.*)!\1 http://azure.archive.ubuntu.com/ubuntu/\4!' "${APT_SOURCES[@]}"
fi
apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
if [ "$(apt-cache search "^python-is-python3$" | wc -l)" -ne 0 ]
then
PYTHON_PACKAGE="python-is-python3"
else
PYTHON_PACKAGE="python"
fi
apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ $PYTHON_PACKAGE python3 perl git cmake
fi
fi
git config --global pack.threads 0
- name: Install packages
if: matrix.install
run: |
declare -a SOURCE_KEYS SOURCES
if [ -n "${{join(matrix.source_keys, ' ')}}" ]
then
SOURCE_KEYS=("${{join(matrix.source_keys, '" "')}}")
fi
if [ -n "${{join(matrix.sources, ' ')}}" ]
then
SOURCES=("${{join(matrix.sources, '" "')}}")
fi
for key in "${SOURCE_KEYS[@]}"
do
for i in {1..$NET_RETRY_COUNT}
do
echo "Adding key: $key"
wget -O - "$key" | sudo apt-key add - && break || sleep 2
done
done
if [ ${#SOURCES[@]} -gt 0 ]
then
APT_ADD_REPO_COMMON_ARGS=("-y")
APT_ADD_REPO_SUPPORTED_ARGS="$(apt-add-repository --help | perl -ne 'if (/^\s*-n/) { print "n"; } elsif (/^\s*-P/) { print "P"; } elsif (/^\s*-S/) { print "S"; } elsif (/^\s*-U/) { print "U"; }')"
if [ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*n*}" ]
then
APT_ADD_REPO_COMMON_ARGS+=("-n")
fi
APT_ADD_REPO_HAS_SOURCE_ARGS="$([ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*P*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*S*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*U*}" ] && echo 1 || echo 0)"
for source in "${SOURCES[@]}"
do
for i in {1..$NET_RETRY_COUNT}
do
APT_ADD_REPO_ARGS=("${APT_ADD_REPO_COMMON_ARGS[@]}")
if [ $APT_ADD_REPO_HAS_SOURCE_ARGS -ne 0 ]
then
case "$source" in
"ppa:"*)
APT_ADD_REPO_ARGS+=("-P")
;;
"deb "*)
APT_ADD_REPO_ARGS+=("-S")
;;
*)
APT_ADD_REPO_ARGS+=("-U")
;;
esac
fi
APT_ADD_REPO_ARGS+=("$source")
echo "apt-add-repository ${APT_ADD_REPO_ARGS[@]}"
sudo -E apt-add-repository "${APT_ADD_REPO_ARGS[@]}" && break || sleep 2
done
done
fi
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ${{join(matrix.install, ' ')}}
- name: Setup GCC Toolchain
if: matrix.gcc_toolchain
run: |
GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain"
echo "GCC_TOOLCHAIN_ROOT=\"$GCC_TOOLCHAIN_ROOT\"" >> $GITHUB_ENV
MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
mkdir -p "$GCC_TOOLCHAIN_ROOT"
ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include"
ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin"
mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET"
ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}"
- 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
BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null)
echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
DEPINST_ARGS=()
GIT_VERSION="$(git --version | sed -e 's/git version //')"
GIT_HAS_JOBS=1
if [ -f "/etc/debian_version" ]
then
if $(dpkg --compare-versions "$GIT_VERSION" lt 2.8.0)
then
GIT_HAS_JOBS=0
fi
else
declare -a GIT_VER=(${GIT_VERSION//./ })
declare -a GIT_MIN_VER=(2 8 0)
for ((i=0; i<${#GIT_VER[@]}; i++))
do
if [ -z "${GIT_MIN_VER[i]}" ]
then
GIT_MIN_VER[i]=0
fi
if [ "${GIT_VER[i]}" -lt "${GIT_MIN_VER[i]}" ]
then
GIT_HAS_JOBS=0
break
fi
done
fi
if [ "$GIT_HAS_JOBS" -ne 0 ]
then
DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS")
fi
mkdir -p snapshot
cd snapshot
echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
curl -L --retry "$NET_RETRY_COUNT" -o "${LIBRARY}-${GITHUB_SHA}.tar.gz" "https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
tar -xf "${LIBRARY}-${GITHUB_SHA}.tar.gz"
if [ ! -d "${LIBRARY}-${GITHUB_SHA}" ]
then
echo "Library snapshot does not contain the library directory ${LIBRARY}-${GITHUB_SHA}:"
ls -la
exit 1
fi
rm -f "${LIBRARY}-${GITHUB_SHA}.tar.gz"
cd ..
git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root"
cd boost-root
mkdir -p libs
rm -rf "libs/$LIBRARY"
mv -f "../snapshot/${LIBRARY}-${GITHUB_SHA}" "libs/$LIBRARY"
rm -rf "../snapshot"
git submodule update --init tools/boostdep
DEPINST_ARGS+=("$LIBRARY")
python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}"
if [ -z "${{matrix.cmake_tests}}" ]
then
./bootstrap.sh
./b2 headers
if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ]
then
echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam
if [ -n "$GCC_TOOLCHAIN_ROOT" ]
then
echo -n " : <compileflags>\"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" <linkflags>\"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam
fi
echo " ;" >> ~/user-config.jam
fi
fi
- name: Run tests
if: matrix.cmake_tests == ''
run: |
cd boost-root
B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}")
if [ -n "${{matrix.build_variant}}" ]
then
B2_ARGS+=("variant=${{matrix.build_variant}}")
else
B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT")
fi
if [ -n "${{matrix.threading}}" ]
then
B2_ARGS+=("threading=${{matrix.threading}}")
fi
if [ -n "${{matrix.ubsan}}" ]
then
export UBSAN_OPTIONS="print_stacktrace=1"
# python tests fail under UBSAN
export BOOST_PARAMETER_TEST_WITHOUT_PYTHON_TESTS=1
B2_ARGS+=("cxxflags=-fsanitize=undefined -fno-sanitize-recover=undefined" "linkflags=-fsanitize=undefined -fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global")
fi
if [ -n "${{matrix.cxxflags}}" ]
then
B2_ARGS+=("cxxflags=${{matrix.cxxflags}}")
fi
if [ -n "${{matrix.linkflags}}" ]
then
B2_ARGS+=("linkflags=${{matrix.linkflags}}")
fi
B2_ARGS+=("libs/$LIBRARY/test")
./b2 "${B2_ARGS[@]}"
windows:
strategy:
fail-fast: false
matrix:
include:
- 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,20,23"
addrmd: 64
os: windows-2022
timeout-minutes: 30
runs-on: ${{matrix.os}}
steps:
- 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%
mkdir snapshot
cd snapshot
echo Downloading library snapshot: https://github.com/%GITHUB_REPOSITORY%/archive/%GITHUB_SHA%.zip
curl -L --retry %NET_RETRY_COUNT% -o "%LIBRARY%-%GITHUB_SHA%.zip" "https://github.com/%GITHUB_REPOSITORY%/archive/%GITHUB_SHA%.zip"
tar -xf "%LIBRARY%-%GITHUB_SHA%.zip"
if not exist "%LIBRARY%-%GITHUB_SHA%\" (
echo Library snapshot does not contain the library directory %LIBRARY%-%GITHUB_SHA%:
dir
exit /b 1
)
del /f "%LIBRARY%-%GITHUB_SHA%.zip"
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
if not exist "libs\" mkdir libs
if exist "libs\%LIBRARY%\" rmdir /s /q "libs\%LIBRARY%"
move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%"
rmdir /s /q "..\snapshot"
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY%
cmd /c bootstrap
b2 -d0 headers
- name: Run tests
shell: cmd
run: |
cd boost-root
if not "${{matrix.cxxstd}}" == "" set CXXSTD=cxxstd=${{matrix.cxxstd}}
if not "${{matrix.addrmd}}" == "" set ADDRMD=address-model=${{matrix.addrmd}}
if not "${{matrix.build_variant}}" == "" (set BUILD_VARIANT=variant=${{matrix.build_variant}}) else (set BUILD_VARIANT=variant=%DEFAULT_BUILD_VARIANT%)
b2 -j %NUMBER_OF_PROCESSORS% libs/%LIBRARY%/test toolset=${{matrix.toolset}} %CXXSTD% %ADDRMD% %BUILD_VARIANT% embed-manifest-via=linker

View File

@@ -1,23 +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
parameter.hpp
parameter
# Generated by `boostdep --cmake parameter`
# 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_parameter VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_parameter INTERFACE)
add_library(Boost::parameter ALIAS boost_parameter)
target_include_directories(boost_parameter INTERFACE include)
target_link_libraries(boost_parameter
INTERFACE
Boost::config
Boost::core
Boost::function
Boost::fusion
Boost::mp11
Boost::mpl
Boost::optional
Boost::preprocessor
Boost::type_traits
Boost::utility
)
# Add a library target to the build system
boost_library_project(
parameter
# SRCDIRS
TESTDIRS test
HEADERS ${lib_headers}
# DOCDIRS
DESCRIPTION "Write functions that accept arguments by name."
MODULARIZED
AUTHORS "David Abrahams <dave -at- boostpro.com>"
"Daniel Wallin <dalwan01 -at- student.umu.se>"
# MAINTAINERS
)
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
add_subdirectory(test)
endif()

26
README.md Normal file
View File

@@ -0,0 +1,26 @@
# Boost.Parameter
Boost.Parameter, part of collection of the [Boost C++ Libraries](https://github.com/boostorg), is a header-only library that implements named parameters for functions and templates in C++.
### Directories
* **doc** - Documentation sources
* **include** - Interface headers of Boost.Parameter
* **test** - Boost.Parameter unit tests
### More information
* [Documentation](https://www.boost.org/libs/parameter)
* [Report bugs](https://github.com/boostorg/parameter/issues/new). Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well.
* Submit your patches as [pull requests](https://github.com/boostorg/parameter/compare) against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt).
### Build status
Branch | GitHub Actions | AppVeyor | Test Matrix | Dependencies |
:-------------: | -------------- | -------- | ----------- | ------------ |
[`master`](https://github.com/boostorg/parameter/tree/master) | [![GitHub Actions](https://github.com/boostorg/parameter/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/parameter/actions?query=branch%3Amaster) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/e9iptg55otiv040a/branch/master?svg=true)](https://ci.appveyor.com/project/Lastique/parameter/branch/master) | [![Tests](https://img.shields.io/badge/matrix-master-brightgreen.svg)](https://regression.boost.io/master/developer/parameter.html) | [![Dependencies](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/parameter.html)
[`develop`](https://github.com/boostorg/parameter/tree/develop) | [![GitHub Actions](https://github.com/boostorg/parameter/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/parameter/actions?query=branch%3Adevelop) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/e9iptg55otiv040a/branch/develop?svg=true)](https://ci.appveyor.com/project/Lastique/parameter/branch/develop) | [![Tests](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](https://regression.boost.io/develop/developer/parameter.html) | [![Dependencies](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/parameter.html)
### License
Distributed under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt).

75
appveyor.yml Normal file
View File

@@ -0,0 +1,75 @@
# Copyright 2017 Edward Diener
# Copyright 2017 Cromwell D. Enage
# Copyright 2021-2025 Andrey Semashev
# 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:
- ARGS: toolset=msvc-14.0 address-model=32,64 cxxstd=14,latest
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- ARGS: toolset=msvc-14.1 address-model=32,64 cxxstd=14,17,latest
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- ARGS: toolset=msvc-14.2 address-model=32,64 cxxstd=14,17,20,latest
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- ARGS: toolset=msvc-14.3 address-model=32,64 cxxstd=14,17,20,latest
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
- ARGS: toolset=clang-win address-model=64 cxxstd=14,17,latest
ENV_SCRIPT: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- ARGS: toolset=clang-win address-model=32 cxxstd=14,17,latest
ENV_SCRIPT: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- ARGS: toolset=gcc address-model=32 cxxstd=11,14,1z
PATH: C:\cygwin\bin;%PATH%
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- ARGS: toolset=gcc address-model=64 cxxstd=11,14,1z
PATH: C:\cygwin64\bin;%PATH%
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- ARGS: toolset=gcc address-model=32 cxxstd=11,14
PATH: C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin;%PATH%
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- ARGS: toolset=gcc address-model=64 cxxstd=11,14,1z
PATH: C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin;%PATH%
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- ARGS: toolset=gcc address-model=64 cxxstd=11,14,17,2a
PATH: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH%
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- ARGS: toolset=gcc address-model=32 cxxstd=11,14,17,2a
PATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH%
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
install:
- set GIT_FETCH_JOBS=8
- 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 init tools/build
- git submodule init tools/boostdep
- git submodule init tools/boost_install
- git submodule init libs/headers
- git submodule init libs/config
- git submodule update --jobs %GIT_FETCH_JOBS%
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\parameter
- python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" parameter
- cmd /c bootstrap
- b2 -d0 headers
build: off
test_script:
- if not "%ENV_SCRIPT%" == "" call "%ENV_SCRIPT%"
- b2 -j %NUMBER_OF_PROCESSORS% libs/parameter/test %ARGS%

32
build.jam Normal file
View File

@@ -0,0 +1,32 @@
# 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/config//boost_config
/boost/core//boost_core
/boost/function//boost_function
/boost/fusion//boost_fusion
/boost/mp11//boost_mp11
/boost/mpl//boost_mpl
/boost/optional//boost_optional
/boost/preprocessor//boost_preprocessor
/boost/type_traits//boost_type_traits
/boost/utility//boost_utility ;
project /boost/parameter
: common-requirements
<include>include
;
explicit
[ alias boost_parameter : : : : <library>$(boost_dependencies) ]
[ alias all : boost_parameter test ]
;
call-if : boost-library parameter
;

8
config/Jamfile.v2 Normal file
View File

@@ -0,0 +1,8 @@
# Copyright Andrey Semashev 2025.
#
# 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)
exe graph_supported : graph_supported.cpp : <library>/boost/graph//boost_graph ;
explicit graph_supported ;

View File

@@ -0,0 +1,18 @@
/*
* Copyright Andrey Semashev 2025.
* 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)
*/
// This test checks whether the portion of Boost.Graph that is used by Boost.Parameter tests
// is compatible with the current compiler. The headers listed below are used in Boost.Parameter tests.
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/properties.hpp>
#include <boost/graph/depth_first_search.hpp>
#include <boost/graph/adjacency_list.hpp>
int main()
{
}

12
doc/Jamfile.v2 Executable file → Normal file
View File

@@ -1,12 +1,12 @@
# Copyright David Abrahams 2006. 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)
import docutils ;
import path ;
sources = [ path.glob . : *.rst ] ;
sources = [ glob *.rst ] ;
bases = $(sources:S=) ;
# This is a path relative to the html/ subdirectory where the
# generated output will eventually be moved.
stylesheet = "--stylesheet=rst.css" ;
@@ -22,3 +22,9 @@ for local b in $(bases)
alias htmls : $(bases) ;
stage html : $(bases) ;
###############################################################################
alias boostdoc ;
explicit boostdoc ;
alias boostrelease : html ;
explicit boostrelease ;

File diff suppressed because it is too large Load Diff

View File

@@ -1,787 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>The Boost Parameter Library Python Binding Documentation</title>
<meta name="authors" content="Daniel Wallin" />
<meta name="organization" content="Boost Consulting" />
<meta name="date" content="2008-03-22" />
<meta name="copyright" content="Copyright David Abrahams, Daniel Wallin 2005. 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)" />
<link rel="stylesheet" href="rst.css" type="text/css" />
</head>
<body>
<div class="document" id="the-boost-parameter-library-python-binding-documentation">
<h1 class="title">The Boost Parameter Library Python Binding Documentation</h1>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Authors:</th>
<td>Daniel Wallin</td></tr>
<tr><th class="docinfo-name">Contact:</th>
<td><a class="first last reference external" href="mailto:dalwan01&#64;student.umu.se">dalwan01&#64;student.umu.se</a></td></tr>
<tr><th class="docinfo-name">Organization:</th>
<td><a class="first last reference external" href="http://www.boost-consulting.com">Boost Consulting</a></td></tr>
<tr><th class="docinfo-name">Date:</th>
<td>2008-03-22</td></tr>
<tr><th class="docinfo-name">Copyright:</th>
<td>Copyright David Abrahams, Daniel Wallin
2005. Distributed under the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt
or copy at <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</td></tr>
</tbody>
</table>
<div class="abstract topic">
<p class="topic-title first">Abstract</p>
<p>Makes it possible to bind Boost.Parameter-enabled
functions, operators and constructors to Python.</p>
</div>
<p><a class="reference external" href="../../../../index.htm"><img alt="Boost" src="../../../../boost.png" /></a></p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#introduction" id="id7">Introduction</a></li>
<li><a class="reference internal" href="#tutorial" id="id8">Tutorial</a></li>
<li><a class="reference internal" href="#concept-parameterspec" id="id9">concept <span class="concept">ParameterSpec</span></a></li>
<li><a class="reference internal" href="#special-keywords" id="id10"><em>special</em> keywords</a></li>
<li><a class="reference internal" href="#class-template-init" id="id11">class template <tt class="docutils literal"><span class="pre">init</span></tt></a></li>
<li><a class="reference internal" href="#class-template-call" id="id12">class template <tt class="docutils literal"><span class="pre">call</span></tt></a></li>
<li><a class="reference internal" href="#class-template-function" id="id13">class template <tt class="docutils literal"><span class="pre">function</span></tt></a></li>
<li><a class="reference internal" href="#function-template-def" id="id14">function template <tt class="docutils literal"><span class="pre">def</span></tt></a></li>
<li><a class="reference internal" href="#portability" id="id15">Portability</a></li>
</ul>
</div>
<div class="section" id="introduction">
<h1><a class="toc-backref" href="#id7">Introduction</a></h1>
<p><tt class="docutils literal"><span class="pre">boost/parameter/python.hpp</span></tt> introduces a group of <a class="reference external" href="../../../python/doc/v2/def_visitor.html"><tt class="docutils literal"><span class="pre">def_visitors</span></tt></a> that can
be used to easily expose Boost.Parameter-enabled member functions to Python with
Boost.Python. It also provides a function template <tt class="docutils literal"><span class="pre">def()</span></tt> that can be used
to expose Boost.Parameter-enabled free functions.</p>
<p>When binding a Boost.Parameter enabled function, the keyword tags
must be specified. Additionally, because Boost.Parameter enabled
functions are templates, the desired function signature must be
specified.</p>
<!-- The keyword tags are specified as an `MPL Sequence`_, using the
pointer qualifications described in |ParameterSpec|_ below. The
signature is also specifid as an `MPL sequence`_ of parameter
types. Additionally, ``boost::parameter::python::function`` and
``boost::parameter::python::def`` requires a class with forwarding
overloads. We will take a closer look at how this is done in the
tutorial section below. -->
<p>The keyword tags and associated argument types are specified as an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL
Sequence</a>, using the function type syntax described in <a class="reference internal" href="#concept-parameterspec"><span class="concept">ParameterSpec</span></a>
below. Additionally, <tt class="docutils literal"><span class="pre">boost::parameter::python::function</span></tt> and
<tt class="docutils literal"><span class="pre">boost::parameter::python::def</span></tt> requires a class with forwarding overloads.
We will take a closer look at how this is done in the tutorial section below.</p>
<!-- The last two sentences are terribly vague. Which namespace is -->
<!-- ``function`` in? Isn't the return type always needed? What -->
<!-- else are we going to do other than pass these sequences to -->
<!-- function? -->
</div>
<div class="section" id="tutorial">
<h1><a class="toc-backref" href="#id8">Tutorial</a></h1>
<p>In this section we will outline the steps needed to bind a simple
Boost.Parameter-enabled member function to Python. Knowledge of the
Boost.Parameter <a class="reference external" href="index.html">macros</a> are required to understand this section.</p>
<p>The class and member function we are interested in binding looks
like this:</p>
<pre class="literal-block">
#include &lt;boost/parameter/keyword.hpp&gt;
#include &lt;boost/parameter/preprocessor.hpp&gt;
#include &lt;boost/parameter/python.hpp&gt;
#include &lt;boost/python.hpp&gt;
// First the keywords
BOOST_PARAMETER_KEYWORD(tag, title)
BOOST_PARAMETER_KEYWORD(tag, width)
BOOST_PARAMETER_KEYWORD(tag, height)
class window
{
public:
BOOST_PARAMETER_MEMBER_FUNCTION(
(void), open, tag,
(required (title, (std::string)))
(optional (width, (unsigned), 400)
(height, (unsigned), 400))
)
{
<em>… function implementation …</em>
}
};
</pre>
<!-- @example.prepend('#include <cassert>') -->
<!-- @example.replace_emphasis('''
assert(title == "foo");
assert(height == 20);
assert(width == 400);
''') -->
<p>It defines a set of overloaded member functions called <tt class="docutils literal"><span class="pre">open</span></tt> with one
required parameter and two optional ones. To bind this member function to
Python we use the binding utility <tt class="docutils literal"><span class="pre">boost::parameter::python::function</span></tt>.
<tt class="docutils literal"><span class="pre">boost::parameter::python::function</span></tt> is a <a class="reference external" href="../../../python/doc/v2/def_visitor.html"><tt class="docutils literal"><span class="pre">def_visitor</span></tt></a> that we'll instantiate
and pass to <tt class="docutils literal"><span class="pre">boost::python::class_::def()</span></tt>.</p>
<p>To use <tt class="docutils literal"><span class="pre">boost::parameter::python::function</span></tt> we first need to define
a class with forwarding overloads. This is needed because <tt class="docutils literal"><span class="pre">window::open()</span></tt>
is a function template, so we can't refer to it in any other way.</p>
<pre class="literal-block">
struct open_fwd
{
template &lt;class A0, class A1, class A2&gt;
void operator()(
boost::type&lt;void&gt;, window&amp; self
, A0 const&amp; a0, A1 const&amp; a1, A2 const&amp; a2
)
{
self.open(a0, a1, a2);
}
};
</pre>
<p>The first parameter, <tt class="docutils literal"><span class="pre">boost::type&lt;void&gt;</span></tt>, tells the forwarding overload
what the return type should be. In this case we know that it's always void
but in some cases, when we are exporting several specializations of a
Boost.Parameter-enabled template, we need to use that parameter to
deduce the return type.</p>
<p><tt class="docutils literal"><span class="pre">window::open()</span></tt> takes a total of 3 parameters, so the forwarding function
needs to take three parameters as well.</p>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">We only need one overload in the forwarding class, despite the
fact that there are two optional parameters. There are special
circumstances when several overload are needed; see
<a class="reference internal" href="#special-keywords">special keywords</a>.</p>
</div>
<p>Next we'll define the module and export the class:</p>
<pre class="literal-block">
BOOST_PYTHON_MODULE(my_module)
{
using namespace boost::python;
namespace py = boost::parameter::python;
namespace mpl = boost::mpl;
class_&lt;window&gt;(&quot;window&quot;)
.def(
&quot;open&quot;, py::function&lt;
open_fwd
, mpl::vector&lt;
void
, tag::title(std::string)
, tag::width*(unsigned)
, tag::height*(unsigned)
&gt;
&gt;()
);
}
</pre>
<!-- @jam_prefix.append('import python ;') -->
<!-- @jam_prefix.append('stage . : my_module /boost/python//boost_python ;') -->
<!-- @my_module = build(
output = 'my_module'
, target_rule = 'python-extension'
, input = '/boost/python//boost_python'
, howmany = 'all'
) -->
<!-- @del jam_prefix[:] -->
<p><tt class="docutils literal"><span class="pre">py::function</span></tt> is passed two parameters. The first one is the class with
forwarding overloads that we defined earlier. The second one is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL
Sequence</a> with the keyword tag types and argument types for the function
specified as function types. The pointer syntax used in <tt class="docutils literal"><span class="pre">tag::width*</span></tt> and
<tt class="docutils literal"><span class="pre">tag::height*</span></tt> means that the parameter is optional. The first element of
the <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL Sequence</a> is the return type of the function, in this case <tt class="docutils literal"><span class="pre">void</span></tt>,
which is passed as the first argument to <tt class="docutils literal"><span class="pre">operator()</span></tt> in the forwarding
class.</p>
<!-- The
pointer syntax means that the parameter is optional, so in this case
``width`` and ``height`` are optional parameters. The third parameter
is an `MPL Sequence`_ with the desired function signature. The return type comes first, and
then the parameter types:
.. parsed-literal::
mpl::vector<void, std::string, unsigned, unsigned>
*return type* *title* *width* *height*
.. @ignore() -->
<p>That's it! This class can now be used in Python with the expected syntax:</p>
<pre class="literal-block">
&gt;&gt;&gt; w = my_module.window()
&gt;&gt;&gt; w.open(title = &quot;foo&quot;, height = 20)
</pre>
<!-- @example.prepend('import my_module') -->
<!-- @run_python(module_path = my_module) -->
<!-- Sorry to say this at such a late date, but this syntax really -->
<!-- strikes me as cumbersome. Couldn't we do something like:
class_<window>("window")
.def(
"open",
(void (*)(
tag::title(std::string),
tag::width*(unsigned),
tag::height*(unsigned))
)0
);
or at least:
class_<window>("window")
.def(
"open",
mpl::vector<
void,
tag::title(std::string),
tag::width*(unsigned),
tag::height*(unsigned)
>()
);
assuming, that is, that we will have to repeat the tags (yes,
users of broken compilers will have to give us function pointer
types instead). -->
</div>
<hr class="docutils" />
<div class="section" id="concept-parameterspec">
<h1><a class="toc-backref" href="#id9">concept <span class="concept">ParameterSpec</span></a></h1>
<p>A <span class="concept">ParameterSpec</span> is a function type <tt class="docutils literal"><span class="pre">K(T)</span></tt> that describes both the keyword tag,
<tt class="docutils literal"><span class="pre">K</span></tt>, and the argument type, <tt class="docutils literal"><span class="pre">T</span></tt>, for a parameter.</p>
<p><tt class="docutils literal"><span class="pre">K</span></tt> is either:</p>
<ul class="simple">
<li>A <em>required</em> keyword of the form <tt class="docutils literal"><span class="pre">Tag</span></tt></li>
<li><strong>or</strong>, an <em>optional</em> keyword of the form <tt class="docutils literal"><span class="pre">Tag*</span></tt></li>
<li><strong>or</strong>, a <em>special</em> keyword of the form <tt class="docutils literal"><span class="pre">Tag**</span></tt></li>
</ul>
<p>where <tt class="docutils literal"><span class="pre">Tag</span></tt> is a keyword tag type, as used in a specialization
of <a class="reference external" href="../../../parameter/doc/html/reference.html#keyword"><tt class="docutils literal"><span class="pre">boost::parameter::keyword</span></tt></a>.</p>
<p>The <strong>arity range</strong> for an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL Sequence</a> of <span class="concept">ParameterSpec</span>'s is
defined as the closed range:</p>
<pre class="literal-block">
[ mpl::size&lt;S&gt; - number of <em>special</em> keyword tags in <tt class="docutils literal"><span class="pre">S</span></tt>, mpl::size&lt;S&gt; ]
</pre>
<p>For example, the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2&lt;x(int),y(int)&gt;</span></tt> is <tt class="docutils literal"><span class="pre">[2,2]</span></tt>,
the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2&lt;x(int),y*(int)&gt;</span></tt> is <tt class="docutils literal"><span class="pre">[2,2]</span></tt> and the
<strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2&lt;x(int),y**(int)&gt;</span></tt> is <tt class="docutils literal"><span class="pre">[1,2]</span></tt>.</p>
</div>
<div class="section" id="special-keywords">
<h1><a class="toc-backref" href="#id10"><em>special</em> keywords</a></h1>
<p>Sometimes it is desirable to have a default value for a parameter that differ
in type from the parameter. This technique is useful for doing simple tag-dispatching
based on the presence of a parameter. For example:</p>
<!-- An example_ of this is given in the Boost.Parameter
docs. The example uses a different technique, but could also have been written like this: -->
<pre class="literal-block">
namespace core
{
template &lt;class ArgumentPack&gt;
void dfs_dispatch(ArgumentPack const&amp; args, mpl::false_)
{
<em>…compute and use default color map…</em>
}
template &lt;class ArgumentPack, class ColorMap&gt;
void dfs_dispatch(ArgumentPack const&amp; args, ColorMap colormap)
{
<em>…use colormap…</em>
}
}
template &lt;class ArgumentPack&gt;
void depth_first_search(ArgumentPack const&amp; args)
{
core::dfs_dispatch(args, args[color | mpl::false_()]);
}
</pre>
<!-- @example.prepend('''
#include <boost/parameter/keyword.hpp>
#include <boost/parameter/parameters.hpp>
#include <boost/mpl/bool.hpp>
#include <cassert>
BOOST_PARAMETER_KEYWORD(tag, color);
typedef boost::parameter::parameters<tag::color> params;
namespace mpl = boost::mpl;
''') -->
<!-- @example.replace_emphasis('''
assert(args[color | 1] == 1);
''') -->
<!-- @example.replace_emphasis('''
assert(args[color | 1] == 0);
''') -->
<!-- @example.append('''
int main()
{
depth_first_search(params()());
depth_first_search(params()(color = 0));
}''') -->
<!-- @build() -->
<!-- .. _example: index.html#dispatching-based-on-the-presence-of-a-default -->
<p>In the above example the type of the default for <tt class="docutils literal"><span class="pre">color</span></tt> is <tt class="docutils literal"><span class="pre">mpl::false_</span></tt>, a
type that is distinct from any color map that the user might supply.</p>
<p>When binding the case outlined above, the default type for <tt class="docutils literal"><span class="pre">color</span></tt> will not
be convertible to the parameter type. Therefore we need to tag the <tt class="docutils literal"><span class="pre">color</span></tt>
keyword as a <em>special</em> keyword. This is done by specifying the tag as
<tt class="docutils literal"><span class="pre">tag::color**</span></tt> when binding the function (see <a class="reference internal" href="#concept-parameterspec">concept ParameterSpec</a> for
more details on the tagging). By doing this we tell the binding functions that
it needs to generate two overloads, one with the <tt class="docutils literal"><span class="pre">color</span></tt> parameter present
and one without. Had there been two <em>special</em> keywords, four overloads would
need to be generated. The number of generated overloads is equal to 2<sup>N</sup>, where <tt class="docutils literal"><span class="pre">N</span></tt> is the number of <em>special</em> keywords.</p>
</div>
<hr class="docutils" />
<div class="section" id="class-template-init">
<h1><a class="toc-backref" href="#id11">class template <tt class="docutils literal"><span class="pre">init</span></tt></a></h1>
<p>Defines a named parameter enabled constructor.</p>
<pre class="literal-block">
template &lt;class ParameterSpecs&gt;
struct init : python::def_visitor&lt;init&lt;ParameterSpecs&gt; &gt;
{
template &lt;class Class&gt;
void def(Class&amp; class_);
template &lt;class CallPolicies&gt;
<em>def_visitor</em> operator[](CallPolicies const&amp; policies) const;
};
</pre>
<!-- @ignore() -->
<div class="section" id="init-requirements">
<h2><tt class="docutils literal"><span class="pre">init</span></tt> requirements</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element is a
model of <span class="concept">ParameterSpec</span>.</p>
</li>
<li><p class="first">For every <tt class="docutils literal"><span class="pre">N</span></tt> in <tt class="docutils literal"><span class="pre">[U,V]</span></tt>, where <tt class="docutils literal"><span class="pre">[U,V]</span></tt> is the <strong>arity
range</strong> of <tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt>, <tt class="docutils literal"><span class="pre">Class</span></tt> must support these
expressions:</p>
<table border="1" class="docutils">
<colgroup>
<col width="30%" />
<col width="17%" />
<col width="53%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head"><p class="first last">Expression</p>
</th>
<th class="head"><p class="first last">Return type</p>
</th>
<th class="head"><p class="first last">Requirements</p>
</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><p class="first last"><tt class="docutils literal"><span class="pre">Class(a0,</span> <span class="pre">…,</span> <span class="pre">aN)</span></tt></p>
</td>
<td><p class="first last">-</p>
</td>
<td><p class="first last"><tt class="docutils literal"><span class="pre">a0</span></tt><tt class="docutils literal"><span class="pre">aN</span></tt> are tagged arguments.</p>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</div>
<div class="section" id="template-class-callpolicies-operator-callpolicies-const">
<h2><tt class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">CallPolicies&gt;</span> <span class="pre">operator[](CallPolicies</span> <span class="pre">const&amp;)</span></tt></h2>
<p>Returns a <tt class="docutils literal"><span class="pre">def_visitor</span></tt> equivalent to <tt class="docutils literal"><span class="pre">*this</span></tt>, except that it
uses CallPolicies when creating the binding.</p>
</div>
<div class="section" id="example">
<h2>Example</h2>
<pre class="literal-block">
#include &lt;boost/parameter/keyword.hpp&gt;
#include &lt;boost/parameter/preprocessor.hpp&gt;
#include &lt;boost/parameter/python.hpp&gt;
#include &lt;boost/python.hpp&gt;
#include &lt;boost/mpl/vector.hpp&gt;
BOOST_PARAMETER_KEYWORD(tag, x)
BOOST_PARAMETER_KEYWORD(tag, y)
struct base
{
template &lt;class ArgumentPack&gt;
base(ArgumentPack const&amp; args)
{
<em>… use args …</em>
}
};
class X : base
{
public:
BOOST_PARAMETER_CONSTRUCTOR(X, (base), tag,
(required (x, *))
(optional (y, *))
)
};
BOOST_PYTHON_MODULE(<em>module name</em>)
{
using namespace boost::python;
namespace py = boost::parameter::python;
namespace mpl = boost::mpl;
class_&lt;X&gt;(&quot;X&quot;, no_init)
.def(
py::init&lt;
mpl::vector&lt;tag::x(int), tag::y*(int)&gt;
&gt;()
);
}
</pre>
<!-- @example.replace_emphasis('''
assert(args[x] == 0);
assert(args[y | 1] == 1);
''') -->
<!-- @example.replace_emphasis('my_module') -->
<!-- @jam_prefix.append('import python ;') -->
<!-- @jam_prefix.append('stage . : my_module /boost/python//boost_python ;') -->
<!-- @my_module = build(
output = 'my_module'
, target_rule = 'python-extension'
, input = '/boost/python//boost_python'
) -->
</div>
</div>
<hr class="docutils" />
<div class="section" id="class-template-call">
<h1><a class="toc-backref" href="#id12">class template <tt class="docutils literal"><span class="pre">call</span></tt></a></h1>
<p>Defines a <tt class="docutils literal"><span class="pre">__call__</span></tt> operator, mapped to <tt class="docutils literal"><span class="pre">operator()</span></tt> in C++.</p>
<pre class="literal-block">
template &lt;class ParameterSpecs&gt;
struct call : python::def_visitor&lt;call&lt;ParameterSpecs&gt; &gt;
{
template &lt;class Class&gt;
void def(Class&amp; class_);
template &lt;class CallPolicies&gt;
<em>def_visitor</em> operator[](CallPolicies const&amp; policies) const;
};
</pre>
<!-- @ignore() -->
<div class="section" id="call-requirements">
<h2><tt class="docutils literal"><span class="pre">call</span></tt> requirements</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element
except the first models <span class="concept">ParameterSpec</span>. The first element
is the result type of <tt class="docutils literal"><span class="pre">c(…)</span></tt>.</p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">Class</span></tt> must support these expressions, where <tt class="docutils literal"><span class="pre">c</span></tt> is an
instance of <tt class="docutils literal"><span class="pre">Class</span></tt>:</p>
<table border="1" class="docutils">
<colgroup>
<col width="24%" />
<col width="26%" />
<col width="50%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head"><p class="first last">Expression</p>
</th>
<th class="head"><p class="first last">Return type</p>
</th>
<th class="head"><p class="first last">Requirements</p>
</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><p class="first last"><tt class="docutils literal"><span class="pre">c(a0,</span> <span class="pre">…,</span> <span class="pre">aN)</span></tt></p>
</td>
<td><p class="first last">Convertible to <tt class="docutils literal"><span class="pre">R</span></tt></p>
</td>
<td><p class="first last"><tt class="docutils literal"><span class="pre">a0</span></tt><tt class="docutils literal"><span class="pre">aN</span></tt> are tagged arguments.</p>
</td>
</tr>
</tbody>
</table>
<p>For every <tt class="docutils literal"><span class="pre">N</span></tt> in <tt class="docutils literal"><span class="pre">[U,V]</span></tt>, where <tt class="docutils literal"><span class="pre">[U,V]</span></tt> is the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt>.</p>
</li>
</ul>
</div>
<div class="section" id="id3">
<h2><tt class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">CallPolicies&gt;</span> <span class="pre">operator[](CallPolicies</span> <span class="pre">const&amp;)</span></tt></h2>
<p>Returns a <tt class="docutils literal"><span class="pre">def_visitor</span></tt> equivalent to <tt class="docutils literal"><span class="pre">*this</span></tt>, except that it
uses CallPolicies when creating the binding.</p>
</div>
<div class="section" id="id4">
<h2>Example</h2>
<pre class="literal-block">
#include &lt;boost/parameter/keyword.hpp&gt;
#include &lt;boost/parameter/preprocessor.hpp&gt;
#include &lt;boost/parameter/python.hpp&gt;
#include &lt;boost/python.hpp&gt;
#include &lt;boost/mpl/vector.hpp&gt;
BOOST_PARAMETER_KEYWORD(tag, x)
BOOST_PARAMETER_KEYWORD(tag, y)
namespace parameter = boost::parameter;
typedef parameter::parameters&lt;
parameter::required&lt;tag::x&gt;
, parameter::optional&lt;tag::y&gt;
&gt; call_parameters;
class X
{
public:
template &lt;class ArgumentPack&gt;
int call_impl(ArgumentPack const&amp; args)
{
<em>… use args …</em>
}
template &lt;class A0&gt;
int operator()(A0 const&amp; a0)
{
return call_impl(call_parameters()(a0));
}
template &lt;class A0, class A1&gt;
int operator()(A0 const&amp; a0, A1 const&amp; a1)
{
return call_impl(call_parameters()(a0,a1));
}
};
BOOST_PYTHON_MODULE(<em>module name</em>)
{
using namespace boost::python;
namespace py = parameter::python;
namespace mpl = boost::mpl;
class_&lt;X&gt;(&quot;X&quot;)
.def(
py::call&lt;
mpl::vector&lt;int, tag::x(int), tag::y*(int)&gt;
&gt;()
);
}
</pre>
<!-- @example.replace_emphasis('''
assert(args[x] == 0);
assert(args[y | 1] == 1);
return 0;
''') -->
<!-- @example.replace_emphasis('my_module') -->
<!-- @my_module = build(
output = 'my_module'
, target_rule = 'python-extension'
, input = '/boost/python//boost_python'
) -->
</div>
</div>
<hr class="docutils" />
<div class="section" id="class-template-function">
<h1><a class="toc-backref" href="#id13">class template <tt class="docutils literal"><span class="pre">function</span></tt></a></h1>
<p>Defines a named parameter enabled member function.</p>
<pre class="literal-block">
template &lt;class Fwd, class ParameterSpecs&gt;
struct function : python::def_visitor&lt;function&lt;Fwd, ParameterSpecs&gt; &gt;
{
template &lt;class Class, class Options&gt;
void def(Class&amp; class_, char const* name, Options const&amp; options);
};
</pre>
<!-- @ignore() -->
<div class="section" id="function-requirements">
<h2><tt class="docutils literal"><span class="pre">function</span></tt> requirements</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element
except the first models <span class="concept">ParameterSpec</span>. The first element
is the result type of <tt class="docutils literal"><span class="pre">c.f(…)</span></tt>, where <tt class="docutils literal"><span class="pre">f</span></tt> is the member
function.</p>
</li>
<li><p class="first">An instance of <tt class="docutils literal"><span class="pre">Fwd</span></tt> must support this expression:</p>
<table border="1" class="docutils">
<colgroup>
<col width="39%" />
<col width="18%" />
<col width="43%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head"><p class="first last">Expression</p>
</th>
<th class="head"><p class="first last">Return type</p>
</th>
<th class="head"><p class="first last">Requirements</p>
</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><p class="first last"><tt class="docutils literal"><span class="pre">fwd(boost::type&lt;R&gt;(),</span> <span class="pre">self,</span> <span class="pre">a0,</span> <span class="pre">…,</span> <span class="pre">aN)</span></tt></p>
</td>
<td><p class="first last">Convertible to <tt class="docutils literal"><span class="pre">R</span></tt></p>
</td>
<td><p class="first last"><tt class="docutils literal"><span class="pre">self</span></tt> is a reference to the object on which
the function should be invoked. <tt class="docutils literal"><span class="pre">a0</span></tt><tt class="docutils literal"><span class="pre">aN</span></tt>
are tagged arguments.</p>
</td>
</tr>
</tbody>
</table>
<p>For every <tt class="docutils literal"><span class="pre">N</span></tt> in <tt class="docutils literal"><span class="pre">[U,V]</span></tt>, where <tt class="docutils literal"><span class="pre">[U,V]</span></tt> is the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt>.</p>
</li>
</ul>
</div>
<div class="section" id="id5">
<h2>Example</h2>
<p>This example exports a member function <tt class="docutils literal"><span class="pre">f(int</span> <span class="pre">x,</span> <span class="pre">int</span> <span class="pre">y</span> <span class="pre">=</span> <span class="pre">…)</span></tt> to Python. The
sequence of <span class="concept">ParameterSpec</span>'s <tt class="docutils literal"><span class="pre">mpl::vector2&lt;tag::x(int),</span> <span class="pre">tag::y*(int)&gt;</span></tt> has
an <strong>arity range</strong> of [2,2], so we only need one forwarding overload.</p>
<pre class="literal-block">
#include &lt;boost/parameter/keyword.hpp&gt;
#include &lt;boost/parameter/preprocessor.hpp&gt;
#include &lt;boost/parameter/python.hpp&gt;
#include &lt;boost/python.hpp&gt;
#include &lt;boost/mpl/vector.hpp&gt;
BOOST_PARAMETER_KEYWORD(tag, x)
BOOST_PARAMETER_KEYWORD(tag, y)
class X
{
public:
BOOST_PARAMETER_MEMBER_FUNCTION((void), f, tag,
(required (x, *))
(optional (y, *, 1))
)
{
<em></em>
}
};
struct f_fwd
{
template &lt;class A0, class A1&gt;
void operator()(boost::type&lt;void&gt;, X&amp; self, A0 const&amp; a0, A1 const&amp; a1)
{
self.f(a0, a1);
}
};
BOOST_PYTHON_MODULE(<em>module name</em>)
{
using namespace boost::python;
namespace py = boost::parameter::python;
namespace mpl = boost::mpl;
class_&lt;X&gt;(&quot;X&quot;)
.def(&quot;f&quot;,
py::function&lt;
f_fwd
, mpl::vector&lt;void, tag::x(int), tag::y*(int)&gt;
&gt;()
);
}
</pre>
<!-- @example.replace_emphasis('''
assert(x == 0);
assert(y == 1);
''') -->
<!-- @example.replace_emphasis('my_module') -->
<!-- @my_module = build(
output = 'my_module'
, target_rule = 'python-extension'
, input = '/boost/python//boost_python'
) -->
</div>
</div>
<hr class="docutils" />
<div class="section" id="function-template-def">
<h1><a class="toc-backref" href="#id14">function template <tt class="docutils literal"><span class="pre">def</span></tt></a></h1>
<p>Defines a named parameter enabled free function in the current Python scope.</p>
<pre class="literal-block">
template &lt;class Fwd, class ParameterSpecs&gt;
void def(char const* name);
</pre>
<!-- @ignore() -->
<div class="section" id="def-requirements">
<h2><tt class="docutils literal"><span class="pre">def</span></tt> requirements</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element
except the first models <span class="concept">ParameterSpec</span>. The first element
is the result type of <tt class="docutils literal"><span class="pre">f(…)</span></tt>, where <tt class="docutils literal"><span class="pre">f</span></tt> is the function.</p>
</li>
<li><p class="first">An instance of <tt class="docutils literal"><span class="pre">Fwd</span></tt> must support this expression:</p>
<table border="1" class="docutils">
<colgroup>
<col width="39%" />
<col width="21%" />
<col width="40%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head"><p class="first last">Expression</p>
</th>
<th class="head"><p class="first last">Return type</p>
</th>
<th class="head"><p class="first last">Requirements</p>
</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><p class="first last"><tt class="docutils literal"><span class="pre">fwd(boost::type&lt;R&gt;(),</span> <span class="pre">a0,</span> <span class="pre">…,</span> <span class="pre">aN)</span></tt></p>
</td>
<td><p class="first last">Convertible to <tt class="docutils literal"><span class="pre">R</span></tt></p>
</td>
<td><p class="first last"><tt class="docutils literal"><span class="pre">a0</span></tt><tt class="docutils literal"><span class="pre">aN</span></tt> are tagged arguments.</p>
</td>
</tr>
</tbody>
</table>
<p>For every <tt class="docutils literal"><span class="pre">N</span></tt> in <tt class="docutils literal"><span class="pre">[U,V]</span></tt>, where <tt class="docutils literal"><span class="pre">[U,V]</span></tt> is the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt>.</p>
</li>
</ul>
</div>
<div class="section" id="id6">
<h2>Example</h2>
<p>This example exports a function <tt class="docutils literal"><span class="pre">f(int</span> <span class="pre">x,</span> <span class="pre">int</span> <span class="pre">y</span> <span class="pre">=</span> <span class="pre">…)</span></tt> to Python. The
sequence of <span class="concept">ParameterSpec</span>'s <tt class="docutils literal"><span class="pre">mpl::vector2&lt;tag::x(int),</span> <span class="pre">tag::y*(int)&gt;</span></tt> has
an <strong>arity range</strong> of [2,2], so we only need one forwarding overload.</p>
<pre class="literal-block">
BOOST_PARAMETER_FUNCTION((void), f, tag,
(required (x, *))
(optional (y, *, 1))
)
{
<em></em>
}
struct f_fwd
{
template &lt;class A0, class A1&gt;
void operator()(boost::type&lt;void&gt;, A0 const&amp; a0, A1 const&amp; a1)
{
f(a0, a1);
}
};
BOOST_PYTHON_MODULE(…)
{
def&lt;
f_fwd
, mpl::vector&lt;
void, tag::x(int), tag::y*(int)
&gt;
&gt;(&quot;f&quot;);
}
</pre>
<!-- @ignore() -->
<!-- again, the undefined ``fwd`` identifier. -->
</div>
</div>
<div class="section" id="portability">
<h1><a class="toc-backref" href="#id15">Portability</a></h1>
<p>The Boost.Parameter Python binding library requires <em>partial template
specialization</em>.</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2008-06-26 21:51 UTC.
Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

0
doc/html/rst.css Executable file → Normal file
View File

0
doc/html/vellipsis.gif Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 62 B

After

Width:  |  Height:  |  Size: 62 B

File diff suppressed because it is too large Load Diff

View File

@@ -1,778 +0,0 @@
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The Boost Parameter Library Python Binding Documentation
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:Authors: Daniel Wallin
:Contact: dalwan01@student.umu.se
:organization: `Boost Consulting`_
:date: $Date$
:copyright: Copyright David Abrahams, Daniel Wallin
2005. 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)
:abstract: Makes it possible to bind Boost.Parameter-enabled
functions, operators and constructors to Python.
|(logo)|__
.. |(logo)| image:: ../../../../boost.png
:alt: Boost
__ ../../../../index.htm
.. _`Boost Consulting`: http://www.boost-consulting.com
.. role:: class
:class: class
.. role:: concept
:class: concept
.. role:: function
:class: function
.. |ParameterSpec| replace:: :concept:`ParameterSpec`
.. contents::
:depth: 1
Introduction
------------
``boost/parameter/python.hpp`` introduces a group of |def_visitors|_ that can
be used to easily expose Boost.Parameter-enabled member functions to Python with
Boost.Python. It also provides a function template ``def()`` that can be used
to expose Boost.Parameter-enabled free functions.
.. |def_visitor| replace:: ``def_visitor``
.. |def_visitors| replace:: ``def_visitors``
.. _def_visitor: def_visitors_
.. _def_visitors: ../../../python/doc/v2/def_visitor.html
When binding a Boost.Parameter enabled function, the keyword tags
must be specified. Additionally, because Boost.Parameter enabled
functions are templates, the desired function signature must be
specified.
.. The keyword tags are specified as an `MPL Sequence`_, using the
pointer qualifications described in |ParameterSpec|_ below. The
signature is also specifid as an `MPL sequence`_ of parameter
types. Additionally, ``boost::parameter::python::function`` and
``boost::parameter::python::def`` requires a class with forwarding
overloads. We will take a closer look at how this is done in the
tutorial section below.
The keyword tags and associated argument types are specified as an `MPL
Sequence`_, using the function type syntax described in |ParameterSpec|_
below. Additionally, ``boost::parameter::python::function`` and
``boost::parameter::python::def`` requires a class with forwarding overloads.
We will take a closer look at how this is done in the tutorial section below.
.. The last two sentences are terribly vague. Which namespace is
.. ``function`` in? Isn't the return type always needed? What
.. else are we going to do other than pass these sequences to
.. function?
.. _`MPL Sequence`: ../../../mpl/doc/refmanual/sequences.html
.. _parameterspec: `concept ParameterSpec`_
Tutorial
--------
In this section we will outline the steps needed to bind a simple
Boost.Parameter-enabled member function to Python. Knowledge of the
Boost.Parameter macros_ are required to understand this section.
.. _macros: index.html
The class and member function we are interested in binding looks
like this:
.. parsed-literal::
#include <boost/parameter/keyword.hpp>
#include <boost/parameter/preprocessor.hpp>
#include <boost/parameter/python.hpp>
#include <boost/python.hpp>
// First the keywords
BOOST_PARAMETER_KEYWORD(tag, title)
BOOST_PARAMETER_KEYWORD(tag, width)
BOOST_PARAMETER_KEYWORD(tag, height)
class window
{
public:
BOOST_PARAMETER_MEMBER_FUNCTION(
(void), open, tag,
(required (title, (std::string)))
(optional (width, (unsigned), 400)
(height, (unsigned), 400))
)
{
*… function implementation …*
}
};
.. @example.prepend('#include <cassert>')
.. @example.replace_emphasis('''
assert(title == "foo");
assert(height == 20);
assert(width == 400);
''')
It defines a set of overloaded member functions called ``open`` with one
required parameter and two optional ones. To bind this member function to
Python we use the binding utility ``boost::parameter::python::function``.
``boost::parameter::python::function`` is a |def_visitor|_ that we'll instantiate
and pass to ``boost::python::class_::def()``.
To use ``boost::parameter::python::function`` we first need to define
a class with forwarding overloads. This is needed because ``window::open()``
is a function template, so we can't refer to it in any other way.
::
struct open_fwd
{
template <class A0, class A1, class A2>
void operator()(
boost::type<void>, window& self
, A0 const& a0, A1 const& a1, A2 const& a2
)
{
self.open(a0, a1, a2);
}
};
The first parameter, ``boost::type<void>``, tells the forwarding overload
what the return type should be. In this case we know that it's always void
but in some cases, when we are exporting several specializations of a
Boost.Parameter-enabled template, we need to use that parameter to
deduce the return type.
``window::open()`` takes a total of 3 parameters, so the forwarding function
needs to take three parameters as well.
.. Note::
We only need one overload in the forwarding class, despite the
fact that there are two optional parameters. There are special
circumstances when several overload are needed; see
`special keywords`_.
Next we'll define the module and export the class:
::
BOOST_PYTHON_MODULE(my_module)
{
using namespace boost::python;
namespace py = boost::parameter::python;
namespace mpl = boost::mpl;
class_<window>("window")
.def(
"open", py::function<
open_fwd
, mpl::vector<
void
, tag::title(std::string)
, tag::width*(unsigned)
, tag::height*(unsigned)
>
>()
);
}
.. @jam_prefix.append('import python ;')
.. @jam_prefix.append('stage . : my_module /boost/python//boost_python ;')
.. @my_module = build(
output = 'my_module'
, target_rule = 'python-extension'
, input = '/boost/python//boost_python'
, howmany = 'all'
)
.. @del jam_prefix[:]
``py::function`` is passed two parameters. The first one is the class with
forwarding overloads that we defined earlier. The second one is an `MPL
Sequence`_ with the keyword tag types and argument types for the function
specified as function types. The pointer syntax used in ``tag::width*`` and
``tag::height*`` means that the parameter is optional. The first element of
the `MPL Sequence`_ is the return type of the function, in this case ``void``,
which is passed as the first argument to ``operator()`` in the forwarding
class.
.. The
pointer syntax means that the parameter is optional, so in this case
``width`` and ``height`` are optional parameters. The third parameter
is an `MPL Sequence`_ with the desired function signature. The return type comes first, and
then the parameter types:
.. parsed-literal::
mpl::vector<void, std::string, unsigned, unsigned>
*return type* *title* *width* *height*
.. @ignore()
That's it! This class can now be used in Python with the expected syntax::
>>> w = my_module.window()
>>> w.open(title = "foo", height = 20)
.. @example.prepend('import my_module')
.. @run_python(module_path = my_module)
.. Sorry to say this at such a late date, but this syntax really
.. strikes me as cumbersome. Couldn't we do something like:
class_<window>("window")
.def(
"open",
(void (*)(
tag::title(std::string),
tag::width*(unsigned),
tag::height*(unsigned))
)0
);
or at least:
class_<window>("window")
.def(
"open",
mpl::vector<
void,
tag::title(std::string),
tag::width*(unsigned),
tag::height*(unsigned)
>()
);
assuming, that is, that we will have to repeat the tags (yes,
users of broken compilers will have to give us function pointer
types instead).
------------------------------------------------------------------------------
concept |ParameterSpec|
-----------------------
A |ParameterSpec| is a function type ``K(T)`` that describes both the keyword tag,
``K``, and the argument type, ``T``, for a parameter.
``K`` is either:
* A *required* keyword of the form ``Tag``
* **or**, an *optional* keyword of the form ``Tag*``
* **or**, a *special* keyword of the form ``Tag**``
where ``Tag`` is a keyword tag type, as used in a specialization
of |keyword|__.
.. |keyword| replace:: ``boost::parameter::keyword``
__ ../../../parameter/doc/html/reference.html#keyword
The **arity range** for an `MPL Sequence`_ of |ParameterSpec|'s is
defined as the closed range:
.. parsed-literal::
[ mpl::size<S> - number of *special* keyword tags in ``S``, mpl::size<S> ]
For example, the **arity range** of ``mpl::vector2<x(int),y(int)>`` is ``[2,2]``,
the **arity range** of ``mpl::vector2<x(int),y*(int)>`` is ``[2,2]`` and the
**arity range** of ``mpl::vector2<x(int),y**(int)>`` is ``[1,2]``.
*special* keywords
---------------------------------
Sometimes it is desirable to have a default value for a parameter that differ
in type from the parameter. This technique is useful for doing simple tag-dispatching
based on the presence of a parameter. For example:
.. An example_ of this is given in the Boost.Parameter
docs. The example uses a different technique, but could also have been written like this:
.. parsed-literal::
namespace core
{
template <class ArgumentPack>
void dfs_dispatch(ArgumentPack const& args, mpl::false\_)
{
*…compute and use default color map…*
}
template <class ArgumentPack, class ColorMap>
void dfs_dispatch(ArgumentPack const& args, ColorMap colormap)
{
*…use colormap…*
}
}
template <class ArgumentPack>
void depth_first_search(ArgumentPack const& args)
{
core::dfs_dispatch(args, args[color | mpl::false_()]);
}
.. @example.prepend('''
#include <boost/parameter/keyword.hpp>
#include <boost/parameter/parameters.hpp>
#include <boost/mpl/bool.hpp>
#include <cassert>
BOOST_PARAMETER_KEYWORD(tag, color);
typedef boost::parameter::parameters<tag::color> params;
namespace mpl = boost::mpl;
''')
.. @example.replace_emphasis('''
assert(args[color | 1] == 1);
''')
.. @example.replace_emphasis('''
assert(args[color | 1] == 0);
''')
.. @example.append('''
int main()
{
depth_first_search(params()());
depth_first_search(params()(color = 0));
}''')
.. @build()
.. .. _example: index.html#dispatching-based-on-the-presence-of-a-default
In the above example the type of the default for ``color`` is ``mpl::false_``, a
type that is distinct from any color map that the user might supply.
When binding the case outlined above, the default type for ``color`` will not
be convertible to the parameter type. Therefore we need to tag the ``color``
keyword as a *special* keyword. This is done by specifying the tag as
``tag::color**`` when binding the function (see `concept ParameterSpec`_ for
more details on the tagging). By doing this we tell the binding functions that
it needs to generate two overloads, one with the ``color`` parameter present
and one without. Had there been two *special* keywords, four overloads would
need to be generated. The number of generated overloads is equal to 2\
:sup:`N`, where ``N`` is the number of *special* keywords.
------------------------------------------------------------------------------
class template ``init``
-----------------------
Defines a named parameter enabled constructor.
.. parsed-literal::
template <class ParameterSpecs>
struct init : python::def_visitor<init<ParameterSpecs> >
{
template <class Class>
void def(Class& class\_);
template <class CallPolicies>
*def\_visitor* operator[](CallPolicies const& policies) const;
};
.. @ignore()
``init`` requirements
~~~~~~~~~~~~~~~~~~~~~
* ``ParameterSpecs`` is an `MPL sequence`_ where each element is a
model of |ParameterSpec|.
* For every ``N`` in ``[U,V]``, where ``[U,V]`` is the **arity
range** of ``ParameterSpecs``, ``Class`` must support these
expressions:
======================= ============= =========================================
Expression Return type Requirements
======================= ============= =========================================
``Class(a0, …, aN)`` \- ``a0``\ …\ ``aN`` are tagged arguments.
======================= ============= =========================================
``template <class CallPolicies> operator[](CallPolicies const&)``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Returns a ``def_visitor`` equivalent to ``*this``, except that it
uses CallPolicies when creating the binding.
Example
~~~~~~~
.. parsed-literal::
#include <boost/parameter/keyword.hpp>
#include <boost/parameter/preprocessor.hpp>
#include <boost/parameter/python.hpp>
#include <boost/python.hpp>
#include <boost/mpl/vector.hpp>
BOOST_PARAMETER_KEYWORD(tag, x)
BOOST_PARAMETER_KEYWORD(tag, y)
struct base
{
template <class ArgumentPack>
base(ArgumentPack const& args)
{
*… use args …*
}
};
class X : base
{
public:
BOOST_PARAMETER_CONSTRUCTOR(X, (base), tag,
(required (x, \*))
(optional (y, \*))
)
};
BOOST_PYTHON_MODULE(*module name*)
{
using namespace boost::python;
namespace py = boost::parameter::python;
namespace mpl = boost::mpl;
class_<X>("X", no_init)
.def(
py::init<
mpl::vector<tag::x(int), tag::y\*(int)>
>()
);
}
.. @example.replace_emphasis('''
assert(args[x] == 0);
assert(args[y | 1] == 1);
''')
.. @example.replace_emphasis('my_module')
.. @jam_prefix.append('import python ;')
.. @jam_prefix.append('stage . : my_module /boost/python//boost_python ;')
.. @my_module = build(
output = 'my_module'
, target_rule = 'python-extension'
, input = '/boost/python//boost_python'
)
------------------------------------------------------------------------------
class template ``call``
-----------------------
Defines a ``__call__`` operator, mapped to ``operator()`` in C++.
.. parsed-literal::
template <class ParameterSpecs>
struct call : python::def_visitor<call<ParameterSpecs> >
{
template <class Class>
void def(Class& class\_);
template <class CallPolicies>
*def\_visitor* operator[](CallPolicies const& policies) const;
};
.. @ignore()
``call`` requirements
~~~~~~~~~~~~~~~~~~~~~
* ``ParameterSpecs`` is an `MPL sequence`_ where each element
except the first models |ParameterSpec|. The first element
is the result type of ``c(…)``.
* ``Class`` must support these expressions, where ``c`` is an
instance of ``Class``:
=================== ==================== =======================================
Expression Return type Requirements
=================== ==================== =======================================
``c(a0, …, aN)`` Convertible to ``R`` ``a0``\ …\ ``aN`` are tagged arguments.
=================== ==================== =======================================
For every ``N`` in ``[U,V]``, where ``[U,V]`` is the **arity range** of ``ParameterSpecs``.
``template <class CallPolicies> operator[](CallPolicies const&)``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Returns a ``def_visitor`` equivalent to ``*this``, except that it
uses CallPolicies when creating the binding.
Example
~~~~~~~
.. parsed-literal::
#include <boost/parameter/keyword.hpp>
#include <boost/parameter/preprocessor.hpp>
#include <boost/parameter/python.hpp>
#include <boost/python.hpp>
#include <boost/mpl/vector.hpp>
BOOST_PARAMETER_KEYWORD(tag, x)
BOOST_PARAMETER_KEYWORD(tag, y)
namespace parameter = boost::parameter;
typedef parameter::parameters<
parameter::required<tag::x>
, parameter::optional<tag::y>
> call_parameters;
class X
{
public:
template <class ArgumentPack>
int call_impl(ArgumentPack const& args)
{
*… use args …*
}
template <class A0>
int operator()(A0 const& a0)
{
return call_impl(call_parameters()(a0));
}
template <class A0, class A1>
int operator()(A0 const& a0, A1 const& a1)
{
return call_impl(call_parameters()(a0,a1));
}
};
BOOST_PYTHON_MODULE(*module name*)
{
using namespace boost::python;
namespace py = parameter::python;
namespace mpl = boost::mpl;
class_<X>("X")
.def(
py::call<
mpl::vector<int, tag::x(int), tag::y\*(int)>
>()
);
}
.. @example.replace_emphasis('''
assert(args[x] == 0);
assert(args[y | 1] == 1);
return 0;
''')
.. @example.replace_emphasis('my_module')
.. @my_module = build(
output = 'my_module'
, target_rule = 'python-extension'
, input = '/boost/python//boost_python'
)
------------------------------------------------------------------------------
class template ``function``
---------------------------
Defines a named parameter enabled member function.
.. parsed-literal::
template <class Fwd, class ParameterSpecs>
struct function : python::def_visitor<function<Fwd, ParameterSpecs> >
{
template <class Class, class Options>
void def(Class& class\_, char const* name, Options const& options);
};
.. @ignore()
``function`` requirements
~~~~~~~~~~~~~~~~~~~~~~~~~
* ``ParameterSpecs`` is an `MPL sequence`_ where each element
except the first models |ParameterSpec|. The first element
is the result type of ``c.f(…)``, where ``f`` is the member
function.
* An instance of ``Fwd`` must support this expression:
============================================ ==================== =================================================
Expression Return type Requirements
============================================ ==================== =================================================
``fwd(boost::type<R>(), self, a0, …, aN)`` Convertible to ``R`` ``self`` is a reference to the object on which
the function should be invoked. ``a0``\ …\ ``aN``
are tagged arguments.
============================================ ==================== =================================================
For every ``N`` in ``[U,V]``, where ``[U,V]`` is the **arity range** of ``ParameterSpecs``.
Example
~~~~~~~
This example exports a member function ``f(int x, int y = …)`` to Python. The
sequence of |ParameterSpec|'s ``mpl::vector2<tag::x(int), tag::y*(int)>`` has
an **arity range** of [2,2], so we only need one forwarding overload.
.. parsed-literal::
#include <boost/parameter/keyword.hpp>
#include <boost/parameter/preprocessor.hpp>
#include <boost/parameter/python.hpp>
#include <boost/python.hpp>
#include <boost/mpl/vector.hpp>
BOOST_PARAMETER_KEYWORD(tag, x)
BOOST_PARAMETER_KEYWORD(tag, y)
class X
{
public:
BOOST_PARAMETER_MEMBER_FUNCTION((void), f, tag,
(required (x, \*))
(optional (y, \*, 1))
)
{
*…*
}
};
struct f_fwd
{
template <class A0, class A1>
void operator()(boost::type<void>, X& self, A0 const& a0, A1 const& a1)
{
self.f(a0, a1);
}
};
BOOST_PYTHON_MODULE(*module name*)
{
using namespace boost::python;
namespace py = boost::parameter::python;
namespace mpl = boost::mpl;
class_<X>("X")
.def("f",
py::function<
f_fwd
, mpl::vector<void, tag::x(int), tag::y\*(int)>
>()
);
}
.. @example.replace_emphasis('''
assert(x == 0);
assert(y == 1);
''')
.. @example.replace_emphasis('my_module')
.. @my_module = build(
output = 'my_module'
, target_rule = 'python-extension'
, input = '/boost/python//boost_python'
)
------------------------------------------------------------------------------
function template ``def``
-------------------------
Defines a named parameter enabled free function in the current Python scope.
.. parsed-literal::
template <class Fwd, class ParameterSpecs>
void def(char const* name);
.. @ignore()
``def`` requirements
~~~~~~~~~~~~~~~~~~~~
* ``ParameterSpecs`` is an `MPL sequence`_ where each element
except the first models |ParameterSpec|. The first element
is the result type of ``f(…)``, where ``f`` is the function.
* An instance of ``Fwd`` must support this expression:
====================================== ==================== =======================================
Expression Return type Requirements
====================================== ==================== =======================================
``fwd(boost::type<R>(), a0, …, aN)`` Convertible to ``R`` ``a0``\ …\ ``aN`` are tagged arguments.
====================================== ==================== =======================================
For every ``N`` in ``[U,V]``, where ``[U,V]`` is the **arity range** of ``ParameterSpecs``.
Example
~~~~~~~
This example exports a function ``f(int x, int y = …)`` to Python. The
sequence of |ParameterSpec|'s ``mpl::vector2<tag::x(int), tag::y*(int)>`` has
an **arity range** of [2,2], so we only need one forwarding overload.
.. parsed-literal::
BOOST_PARAMETER_FUNCTION((void), f, tag,
(required (x, \*))
(optional (y, \*, 1))
)
{
*…*
}
struct f_fwd
{
template <class A0, class A1>
void operator()(boost::type<void>, A0 const& a0, A1 const& a1)
{
f(a0, a1);
}
};
BOOST_PYTHON_MODULE(…)
{
def<
f_fwd
, mpl::vector<
void, tag::\ x(int), tag::\ y\*(int)
>
>("f");
}
.. @ignore()
.. again, the undefined ``fwd`` identifier.
Portability
-----------
The Boost.Parameter Python binding library requires *partial template
specialization*.

File diff suppressed because it is too large Load Diff

17
include/boost/parameter.hpp Executable file → Normal file
View File

@@ -1,6 +1,6 @@
// Copyright David Abrahams, Daniel Wallin 2005. Use, modification and
// distribution is subject to the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// Copyright David Abrahams, Daniel Wallin 2005.
// 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)
// See www.boost.org/libs/parameter for documentation.
@@ -9,13 +9,22 @@
#define BOOST_PARAMETER_050401_HPP
#include <boost/parameter/parameters.hpp>
#include <boost/parameter/are_tagged_arguments.hpp>
#include <boost/parameter/is_argument_pack.hpp>
#include <boost/parameter/required.hpp>
#include <boost/parameter/optional.hpp>
#include <boost/parameter/deduced.hpp>
#include <boost/parameter/template_keyword.hpp>
#include <boost/parameter/keyword.hpp>
#include <boost/parameter/nested_keyword.hpp>
#include <boost/parameter/binding.hpp>
#include <boost/parameter/value_type.hpp>
#include <boost/parameter/macros.hpp>
#include <boost/parameter/match.hpp>
#include <boost/parameter/name.hpp>
#include <boost/parameter/compose.hpp>
#include <boost/parameter/preprocessor.hpp>
#include <boost/parameter/preprocessor_no_spec.hpp>
#endif // BOOST_PARAMETER_050401_HPP
#endif // include guard

View File

@@ -0,0 +1,125 @@
// Copyright Cromwell D. Enage 2018.
// 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)
#ifndef BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_HPP
#define BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_HPP
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
namespace boost { namespace parameter {
template <typename TaggedArg0, typename ...TaggedArgs>
struct are_tagged_arguments;
}} // namespace boost::parameter
#include <boost/parameter/aux_/is_tagged_argument.hpp>
namespace boost { namespace parameter {
template <typename TaggedArg0>
struct are_tagged_arguments<TaggedArg0>
: ::boost::parameter::aux::is_tagged_argument<TaggedArg0>
{
};
}} // namespace boost::parameter
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
namespace boost { namespace parameter {
template <typename TaggedArg0, typename ...TaggedArgs>
struct are_tagged_arguments
: ::boost::mpl::if_<
::boost::parameter::aux::is_tagged_argument<TaggedArg0>
, ::boost::parameter::are_tagged_arguments<TaggedArgs...>
, ::boost::mpl::false_
>::type
{
};
}} // namespace boost::parameter
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#define BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_END_Z(z, n, false_t) , false_t>
/**/
#include <boost/parameter/aux_/is_tagged_argument.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/preprocessor/cat.hpp>
#define BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_BEGIN_Z(z, n, prefix) \
::boost::mpl::eval_if< \
::boost::parameter::aux::is_tagged_argument<BOOST_PP_CAT(prefix, n)>,
/**/
#include <boost/parameter/aux_/void.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/preprocessor/arithmetic/sub.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
#define BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_OVERLOADS_Z(z, n, prefix) \
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename prefix)> \
struct are_tagged_arguments< \
BOOST_PP_ENUM_PARAMS_Z(z, n, prefix) \
BOOST_PP_ENUM_TRAILING_PARAMS_Z( \
z \
, BOOST_PP_SUB(BOOST_PARAMETER_COMPOSE_MAX_ARITY, n) \
, ::boost::parameter::void_ BOOST_PP_INTERCEPT \
) \
> : BOOST_PP_CAT(BOOST_PP_REPEAT_, z)( \
n \
, BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_BEGIN_Z \
, prefix \
) \
::boost::mpl::true_ \
BOOST_PP_CAT(BOOST_PP_REPEAT_, z)( \
n \
, BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_END_Z \
, ::boost::mpl::false_ \
)::type \
{ \
};
/**/
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
namespace boost { namespace parameter {
template <
BOOST_PP_ENUM_BINARY_PARAMS(
BOOST_PP_INC(BOOST_PARAMETER_COMPOSE_MAX_ARITY)
, typename TaggedArg
, = ::boost::parameter::void_ BOOST_PP_INTERCEPT
)
>
struct are_tagged_arguments;
}} // namespace boost::parameter
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
namespace boost { namespace parameter {
BOOST_PP_REPEAT_FROM_TO(
1
, BOOST_PP_INC(BOOST_PARAMETER_COMPOSE_MAX_ARITY)
, BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_OVERLOADS_Z
, TaggedArg
)
}} // namespace boost::parameter
#undef BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_OVERLOADS_Z
#undef BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_BEGIN_Z
#undef BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_END_Z
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
#endif // include guard

View File

@@ -0,0 +1,42 @@
// Copyright Cromwell D. Enage 2019.
// 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)
#ifndef BOOST_PARAMETER_AUX_ALWAYS_TRUE_PREDICATE_HPP
#define BOOST_PARAMETER_AUX_ALWAYS_TRUE_PREDICATE_HPP
#include <boost/parameter/config.hpp>
#include <boost/mpl/bool.hpp>
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#endif
#else
#include <boost/mpl/always.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
struct always_true_predicate
{
template <typename ...>
struct apply
{
typedef ::boost::mpl::true_ type;
};
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <typename ...>
using fn = ::boost::mp11::mp_true;
#endif
};
#else
typedef ::boost::mpl::always< ::boost::mpl::true_> always_true_predicate;
#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES
}}} // namespace boost::parameter::aux
#endif // include guard

1685
include/boost/parameter/aux_/arg_list.hpp Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
// Copyright Daniel Wallin 2006.
// 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)
#ifndef BOOST_PARAMETER_AUX_AS_LVALUE_HPP
#define BOOST_PARAMETER_AUX_AS_LVALUE_HPP
namespace boost { namespace parameter { namespace aux {
template <typename T>
T const& as_lvalue(T const& value)
{
return value;
}
template <typename T>
T& as_lvalue(T& value)
{
return value;
}
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,198 @@
// Copyright Cromwell D. Enage 2018.
// 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)
#ifndef BOOST_PARAMETER_AUGMENT_PREDICATE_HPP
#define BOOST_PARAMETER_AUGMENT_PREDICATE_HPP
#include <boost/parameter/keyword_fwd.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/type_traits/is_lvalue_reference.hpp>
#include <boost/type_traits/is_scalar.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename V, typename R, typename Tag>
struct augment_predicate_check_consume_ref
: ::boost::mpl::eval_if<
::boost::is_scalar<V>
, ::boost::mpl::true_
, ::boost::mpl::eval_if<
::boost::is_same<
typename Tag::qualifier
, ::boost::parameter::consume_reference
>
, ::boost::mpl::if_<
::boost::is_lvalue_reference<R>
, ::boost::mpl::false_
, ::boost::mpl::true_
>
, boost::mpl::true_
>
>::type
{
};
}}} // namespace boost::parameter::aux
#include <boost/type_traits/is_const.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename V, typename R, typename Tag>
struct augment_predicate_check_out_ref
: ::boost::mpl::eval_if<
::boost::is_same<
typename Tag::qualifier
, ::boost::parameter::out_reference
>
, ::boost::mpl::eval_if<
::boost::is_lvalue_reference<R>
, ::boost::mpl::if_<
::boost::is_const<V>
, ::boost::mpl::false_
, ::boost::mpl::true_
>
, ::boost::mpl::false_
>
, ::boost::mpl::true_
>::type
{
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/lambda_tag.hpp>
#include <boost/mpl/apply_wrap.hpp>
#include <boost/mpl/lambda.hpp>
namespace boost { namespace parameter { namespace aux {
template <
typename Predicate
, typename R
, typename Tag
, typename T
, typename Args
>
class augment_predicate
{
typedef typename ::boost::mpl::lambda<
Predicate
, ::boost::parameter::aux::lambda_tag
>::type _actual_predicate;
public:
typedef typename ::boost::mpl::eval_if<
typename ::boost::mpl::if_<
::boost::parameter::aux
::augment_predicate_check_consume_ref<T,R,Tag>
, ::boost::parameter::aux
::augment_predicate_check_out_ref<T,R,Tag>
, ::boost::mpl::false_
>::type
, ::boost::mpl::apply_wrap2<_actual_predicate,T,Args>
, ::boost::mpl::false_
>::type type;
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#include <boost/mp11/utility.hpp>
#include <type_traits>
namespace boost { namespace parameter { namespace aux {
template <typename V, typename R, typename Tag>
using augment_predicate_check_consume_ref_mp11 = ::boost::mp11::mp_if<
::std::is_scalar<V>
, ::boost::mp11::mp_true
, ::boost::mp11::mp_if<
::std::is_same<
typename Tag::qualifier
, ::boost::parameter::consume_reference
>
, ::boost::mp11::mp_if<
::std::is_lvalue_reference<R>
, ::boost::mp11::mp_false
, ::boost::mp11::mp_true
>
, boost::mp11::mp_true
>
>;
template <typename V, typename R, typename Tag>
using augment_predicate_check_out_ref_mp11 = ::boost::mp11::mp_if<
::std::is_same<
typename Tag::qualifier
, ::boost::parameter::out_reference
>
, ::boost::mp11::mp_if<
::std::is_lvalue_reference<R>
, ::boost::mp11::mp_if<
::std::is_const<V>
, ::boost::mp11::mp_false
, ::boost::mp11::mp_true
>
, ::boost::mp11::mp_false
>
, ::boost::mp11::mp_true
>;
}}} // namespace boost::parameter::aux
#include <boost/mp11/list.hpp>
namespace boost { namespace parameter { namespace aux {
template <
typename Predicate
, typename R
, typename Tag
, typename T
, typename Args
>
struct augment_predicate_mp11_impl
{
using type = ::boost::mp11::mp_if<
::boost::mp11::mp_if<
::boost::parameter::aux
::augment_predicate_check_consume_ref_mp11<T,R,Tag>
, ::boost::parameter::aux
::augment_predicate_check_out_ref_mp11<T,R,Tag>
, ::boost::mp11::mp_false
>
, ::boost::mp11
::mp_apply_q<Predicate,::boost::mp11::mp_list<T,Args> >
, ::boost::mp11::mp_false
>;
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/has_nested_template_fn.hpp>
namespace boost { namespace parameter { namespace aux {
template <
typename Predicate
, typename R
, typename Tag
, typename T
, typename Args
>
using augment_predicate_mp11 = ::boost::mp11::mp_if<
::boost::parameter::aux::has_nested_template_fn<Predicate>
, ::boost::parameter::aux
::augment_predicate_mp11_impl<Predicate,R,Tag,T,Args>
, ::boost::parameter::aux
::augment_predicate<Predicate,R,Tag,T,Args>
>;
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_CAN_USE_MP11
#endif // include guard

View File

@@ -1,131 +1,12 @@
// Copyright Daniel Wallin 2006. 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)
// Copyright Daniel Wallin 2006.
// 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)
#ifndef BOOST_PARAMETER_CAST_060902_HPP
# define BOOST_PARAMETER_CAST_060902_HPP
#define BOOST_PARAMETER_CAST_060902_HPP
# include <boost/detail/workaround.hpp>
#include <boost/parameter/aux_/preprocessor/impl/function_cast.hpp>
# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
&& !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# include <boost/type_traits/add_reference.hpp>
# include <boost/type_traits/remove_const.hpp>
# endif
namespace boost { namespace parameter { namespace aux {
struct use_default_tag {};
# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# define BOOST_PARAMETER_FUNCTION_CAST(value, predicate) value
# else
// Handles possible implicit casts. Used by preprocessor.hpp to
// normalize user input.
//
// cast<void*>::execute() is identity
// cast<void*(X)>::execute() is identity
// cast<void(X)>::execute() casts to X
//
// preprocessor.hpp uses this like this:
//
// #define X(value, predicate)
// cast<void predicate>::execute(value)
//
// X(something, *)
// X(something, *(predicate))
// X(something, (int))
template <class T>
struct cast;
template <>
struct cast<void*>
{
static use_default_tag execute(use_default_tag)
{
return use_default_tag();
}
static use_default_tag remove_const(use_default_tag)
{
return use_default_tag();
}
template <class U>
static U& execute(U& value)
{
return value;
}
template <class U>
static U& remove_const(U& x)
{
return x;
}
};
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
typedef void* voidstar;
template <class T>
struct cast<voidstar(T)>
: cast<void*>
{
};
#else
template <class T>
struct cast<void*(T)>
: cast<void*>
{
};
#endif
template <class T>
struct cast<void(T)>
{
typedef typename boost::add_reference<
typename boost::remove_const<T>::type
>::type reference;
static use_default_tag execute(use_default_tag)
{
return use_default_tag();
}
static use_default_tag remove_const(use_default_tag)
{
return use_default_tag();
}
static T execute(T value)
{
return value;
}
template <class U>
static reference remove_const(U const& x)
{
return const_cast<reference>(x);
}
};
# define BOOST_PARAMETER_FUNCTION_CAST(value, predicate) \
boost::parameter::aux::cast<void predicate>::remove_const( \
boost::parameter::aux::cast<void predicate>::execute(value) \
)
# endif
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_CAST_060902_HPP
#endif // include guard

View File

@@ -1,69 +1,111 @@
// Copyright Daniel Wallin, David Abrahams 2005. Use, modification and
// distribution is subject to the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// Copyright Daniel Wallin, David Abrahams 2005.
// Copyright Cromwell D. Enage 2017.
// 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)
#ifndef DEFAULT_050329_HPP
# define DEFAULT_050329_HPP
# include <boost/detail/workaround.hpp>
#ifndef BOOST_PARAMETER_AUX_DEFAULT_HPP
#define BOOST_PARAMETER_AUX_DEFAULT_HPP
namespace boost { namespace parameter { namespace aux {
// A wrapper for the default value passed by the user when resolving
// the value of the parameter with the given Keyword
template <class Keyword, class Value>
struct default_
{
default_(Value& x)
: value(x)
{}
Value& value;
};
//
// lazy_default --
//
// A wrapper for the default value computation function passed by
// the user when resolving the value of the parameter with the
// given keyword
//
# if BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
// These compilers need a little extra help with overload
// resolution; we have empty_arg_list's operator[] accept a base
// class to make that overload less preferable.
template <class KW, class DefaultComputer>
struct lazy_default_base
{
lazy_default_base(DefaultComputer const& x)
: compute_default(x)
{}
DefaultComputer const& compute_default;
};
template <class KW, class DefaultComputer>
struct lazy_default
: lazy_default_base<KW,DefaultComputer>
{
lazy_default(DefaultComputer const & x)
: lazy_default_base<KW,DefaultComputer>(x)
{}
};
# define BOOST_PARAMETER_lazy_default_fallback lazy_default_base
# else
template <class KW, class DefaultComputer>
struct lazy_default
{
lazy_default(const DefaultComputer& x)
: compute_default(x)
{}
DefaultComputer const& compute_default;
};
# define BOOST_PARAMETER_lazy_default_fallback lazy_default
# endif
// A wrapper for the default value passed by the user when resolving
// the value of the parameter with the given Keyword
template <typename Keyword, typename Value>
struct default_
{
inline BOOST_CONSTEXPR default_(Value& x) : value(x)
{
}
Value& value;
};
}}} // namespace boost::parameter::aux
#endif // DEFAULT_050329_HPP
#include <boost/parameter/config.hpp>
namespace boost { namespace parameter { namespace aux {
// lazy_default -- A wrapper for the default value computation function
// passed by the user when resolving the value of the parameter with the
// given keyword.
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
// These compilers need a little extra help with overload resolution;
// we have empty_arg_list's operator[] accept a base class
// to make that overload less preferable.
template <typename KW, typename DefaultComputer>
struct lazy_default_base
{
inline BOOST_CONSTEXPR lazy_default_base(DefaultComputer& x)
: compute_default(x)
{
}
DefaultComputer& compute_default;
};
template <typename KW, typename DefaultComputer>
struct lazy_default
: ::boost::parameter::aux::lazy_default_base<KW,DefaultComputer>
{
inline BOOST_CONSTEXPR lazy_default(DefaultComputer& x)
: ::boost::parameter::aux::lazy_default_base<KW,DefaultComputer>(x)
{
}
};
#else // !BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
template <typename KW, typename DefaultComputer>
struct lazy_default
{
inline BOOST_CONSTEXPR lazy_default(DefaultComputer& x)
: compute_default(x)
{
}
DefaultComputer& compute_default;
};
#endif // EDG workarounds needed.
}}} // namespace boost::parameter::aux
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
#define BOOST_PARAMETER_lazy_default_fallback \
::boost::parameter::aux::lazy_default_base
/**/
#else
#define BOOST_PARAMETER_lazy_default_fallback \
::boost::parameter::aux::lazy_default
/**/
#endif
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#include <utility>
namespace boost { namespace parameter { namespace aux {
template <typename Keyword, typename Value>
struct default_r_
{
inline BOOST_CONSTEXPR default_r_(Value&& x)
: value(::std::forward<Value>(x))
{
}
#if BOOST_WORKAROUND(BOOST_MSVC, < 1910)
// MSVC 2015 miscompiles moves for classes containing rvalue ref members
// using the default generated move constructor
// when moving into a function
// https://github.com/boostorg/parameter/pull/109
inline BOOST_CONSTEXPR default_r_(default_r_&& x)
: value(::std::forward<Value>(x.value))
{
}
#endif
Value&& value;
};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
#endif // include guard

View File

@@ -0,0 +1,111 @@
// Copyright Cromwell D. Enage 2019.
// 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)
#ifndef BOOST_PARAMETER_AUX_HAS_NESTED_TEMPLATE_FN_HPP
#define BOOST_PARAMETER_AUX_HAS_NESTED_TEMPLATE_FN_HPP
#include <boost/parameter/aux_/yesno.hpp>
#include <boost/parameter/aux_/preprocessor/nullptr.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#include <boost/mp11/utility.hpp>
#else
#include <boost/mpl/bool.hpp>
#include <boost/mpl/identity.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <template <typename ...> class F>
struct has_nested_template_fn_variadic
{
};
#else
template <template <typename P0, typename P1> class F>
struct has_nested_template_fn_arity_2
{
};
#endif
template <typename T>
class has_nested_template_fn_impl
{
template <typename U>
static ::boost::parameter::aux::no_tag _check(...);
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <typename U>
static ::boost::parameter::aux::yes_tag
_check(
::boost::mp11::mp_identity<U> const volatile*
, ::boost::parameter::aux::has_nested_template_fn_variadic<
U::template fn
>* = BOOST_PARAMETER_AUX_PP_NULLPTR
);
#else
template <typename U>
static BOOST_CONSTEXPR ::boost::parameter::aux::yes_tag
_check(
::boost::mpl::identity<U> const volatile*
, ::boost::parameter::aux::has_nested_template_fn_arity_2<
U::template fn
>* = BOOST_PARAMETER_AUX_PP_NULLPTR
);
#endif
public:
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using type = ::boost::mp11::mp_bool<
#else
typedef ::boost::mpl::bool_<
#endif
sizeof(
::boost::parameter::aux::has_nested_template_fn_impl<T>
::template _check<T>(
static_cast<
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
::boost::mp11::mp_identity<T> const volatile*
#else
::boost::mpl::identity<T> const volatile*
#endif
>(BOOST_PARAMETER_AUX_PP_NULLPTR)
)
) == sizeof(::boost::parameter::aux::yes_tag)
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
>;
#else
> type;
#endif
};
}}} // namespace boost::parameter::aux
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <type_traits>
#else
#include <boost/type_traits/remove_const.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename T>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using has_nested_template_fn = typename ::boost::parameter::aux
::has_nested_template_fn_impl<typename ::std::remove_const<T>::type>
::type;
#else
struct has_nested_template_fn
: ::boost::parameter::aux::has_nested_template_fn_impl<
typename ::boost::remove_const<T>::type
>::type
{
};
#endif
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,52 @@
// Copyright Daniel Wallin, David Abrahams 2010.
// 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)
#ifndef BOOST_PARAMETER_IS_MAYBE_050329_HPP
#define BOOST_PARAMETER_IS_MAYBE_050329_HPP
namespace boost { namespace parameter { namespace aux {
struct maybe_base
{
};
}}} // namespace boost::parameter::aux
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <type_traits>
namespace boost { namespace parameter { namespace aux {
template <typename T>
using is_maybe = ::std::is_base_of<
::boost::parameter::aux::maybe_base
, typename ::std::remove_const<T>::type
>;
}}} // namespace boost::parameter::aux
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct is_maybe
: ::boost::mpl::if_<
::boost::is_base_of<
::boost::parameter::aux::maybe_base
, typename ::boost::remove_const<T>::type
>
, ::boost::mpl::true_
, ::boost::mpl::false_
>::type
{
};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_CAN_USE_MP11
#endif // include guard

View File

@@ -0,0 +1,64 @@
// Copyright Cromwell D. Enage 2019.
// 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)
#ifndef BOOST_PARAMETER_AUX_IS_PLACEHOLDER_HPP
#define BOOST_PARAMETER_AUX_IS_PLACEHOLDER_HPP
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#else
#include <boost/mpl/bool.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct is_mpl_placeholder
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
: ::boost::mp11::mp_false
#else
: ::boost::mpl::false_
#endif
{
};
}}} // namespace boost::parameter::aux
#include <boost/mpl/arg_fwd.hpp>
namespace boost { namespace parameter { namespace aux {
template <int I>
struct is_mpl_placeholder< ::boost::mpl::arg<I> >
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
: ::boost::mp11::mp_true
#else
: ::boost::mpl::true_
#endif
{
};
}}} // namespace boost::parameter::aux
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/bind.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct is_mp11_placeholder : ::boost::mp11::mp_false
{
};
template < ::std::size_t I>
struct is_mp11_placeholder< ::boost::mp11::mp_arg<I> >
: ::boost::mp11::mp_true
{
};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_CAN_USE_MP11
#endif // include guard

View File

@@ -0,0 +1,95 @@
// Copyright Daniel Wallin, David Abrahams 2005.
// Copyright Cromwell D. Enage 2017.
// 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)
#ifndef BOOST_PARAMETER_IS_TAGGED_ARGUMENT_HPP
#define BOOST_PARAMETER_IS_TAGGED_ARGUMENT_HPP
namespace boost { namespace parameter { namespace aux {
struct tagged_argument_base
{
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/config.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) || \
(0 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
#include <boost/type_traits/is_base_of.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
namespace boost { namespace parameter { namespace aux {
// This metafunction identifies tagged_argument specializations
// and their derived classes.
template <typename T>
struct is_tagged_argument
: ::boost::mpl::if_<
// Cannot use is_convertible<> to check if T is derived from
// tagged_argument_base. -- Cromwell D. Enage
::boost::is_base_of<
::boost::parameter::aux::tagged_argument_base
, typename ::boost::remove_const<
typename ::boost::remove_reference<T>::type
>::type
>
, ::boost::mpl::true_
, ::boost::mpl::false_
>::type
{
};
}}} // namespace boost::parameter::aux
#else // no perfect forwarding support and no exponential overloads
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_lvalue_reference.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct is_tagged_argument_aux
: ::boost::is_convertible<
T*
, ::boost::parameter::aux::tagged_argument_base const*
>
{
};
// This metafunction identifies tagged_argument specializations
// and their derived classes.
template <typename T>
struct is_tagged_argument
: ::boost::mpl::if_<
::boost::is_lvalue_reference<T>
, ::boost::mpl::false_
, ::boost::parameter::aux::is_tagged_argument_aux<T>
>::type
{
};
}}} // namespace boost::parameter::aux
#endif // perfect forwarding support, or exponential overloads
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <type_traits>
namespace boost { namespace parameter { namespace aux {
template <typename T>
using is_tagged_argument_mp11 = ::std::is_base_of<
::boost::parameter::aux::tagged_argument_base
, typename ::std::remove_const<
typename ::std::remove_reference<T>::type
>::type
>;
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_CAN_USE_MP11
#endif // include guard

View File

@@ -0,0 +1,16 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_LAMBDA_TAG_HPP
#define BOOST_PARAMETER_AUX_LAMBDA_TAG_HPP
namespace boost { namespace parameter { namespace aux {
// Tag type passed to MPL lambda.
struct lambda_tag;
}}} // namespace boost::parameter::aux
#endif // include guard

235
include/boost/parameter/aux_/maybe.hpp Executable file → Normal file
View File

@@ -1,98 +1,151 @@
// Copyright Daniel Wallin 2006. 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)
// Copyright Daniel Wallin 2006.
// 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)
#ifndef BOOST_PARAMETER_MAYBE_060211_HPP
# define BOOST_PARAMETER_MAYBE_060211_HPP
# include <boost/mpl/if.hpp>
# include <boost/mpl/identity.hpp>
# include <boost/type_traits/is_reference.hpp>
# include <boost/type_traits/add_reference.hpp>
# include <boost/optional.hpp>
# include <boost/python/detail/referent_storage.hpp>
# include <boost/type_traits/remove_cv.hpp>
# include <boost/type_traits/add_const.hpp>
//
// 2009.10.21 TDS remove depenency on boost::python::detail::referent_storage
//
#ifndef BOOST_PARAMETER_MAYBE_091021_HPP
#define BOOST_PARAMETER_MAYBE_091021_HPP
namespace boost { namespace parameter { namespace aux {
struct maybe_base {};
template <class T>
struct maybe : maybe_base
{
typedef typename add_reference<
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
T const
# else
typename add_const<T>::type
# endif
>::type reference;
typedef typename remove_cv<
BOOST_DEDUCED_TYPENAME remove_reference<reference>::type
>::type non_cv_value;
explicit maybe(T value)
: value(value)
, constructed(false)
{}
maybe()
: constructed(false)
{}
~maybe()
{
if (constructed)
this->destroy();
}
reference construct(reference value) const
{
return value;
}
template <class U>
reference construct2(U const& value) const
{
new (m_storage.bytes) non_cv_value(value);
constructed = true;
return *(non_cv_value*)m_storage.bytes;
}
template <class U>
reference construct(U const& value) const
{
return this->construct2(value);
}
void destroy()
{
((non_cv_value*)m_storage.bytes)->~non_cv_value();
}
typedef reference(maybe<T>::*safe_bool)() const;
operator safe_bool() const
{
return value ? &maybe<T>::get : 0 ;
}
reference get() const
{
return value.get();
}
private:
boost::optional<T> value;
mutable bool constructed;
mutable typename boost::python::detail::referent_storage<
reference
>::type m_storage;
};
template <typename T>
struct referent_size;
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_MAYBE_060211_HPP
#include <boost/parameter/config.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct referent_size<T&>
{
BOOST_STATIC_CONSTANT(::std::size_t, value = sizeof(T));
};
}}} // namespace boost::parameter::aux
#include <boost/type_traits/aligned_storage.hpp>
namespace boost { namespace parameter { namespace aux {
// A metafunction returning a POD type which can store U, where T == U&.
// If T is not a reference type, returns a POD which can store T.
template <typename T>
struct referent_storage
: ::boost::aligned_storage<
::boost::parameter::aux::referent_size<T>::value
>
{
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/is_maybe.hpp>
#include <boost/optional/optional.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <type_traits>
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/type_traits/add_lvalue_reference.hpp>
#include <boost/type_traits/remove_cv.hpp>
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
#include <boost/type_traits/add_const.hpp>
#endif
#endif // BOOST_PARAMETER_CAN_USE_MP11
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct maybe : ::boost::parameter::aux::maybe_base
{
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
typedef typename ::std::add_lvalue_reference<
typename ::std::add_const<T>::type
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
typedef typename ::boost::add_lvalue_reference<
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
T const
#else
typename ::boost::add_const<T>::type
#endif
#endif // BOOST_PARAMETER_CAN_USE_MP11
>::type reference;
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
typedef typename ::std::remove_cv<
typename ::std::remove_reference<reference>::type
#else
typedef typename ::boost::remove_cv<
BOOST_DEDUCED_TYPENAME ::boost::remove_reference<reference>::type
#endif
>::type non_cv_value;
inline explicit maybe(T value_) : value(value_), constructed(false)
{
}
inline maybe() : value(), constructed(false)
{
}
~maybe()
{
if (this->constructed)
{
this->destroy();
}
}
inline reference construct(reference value_) const
{
return value_;
}
template <typename U>
reference construct2(U const& value_) const
{
new (this->m_storage.address()) non_cv_value(value_);
this->constructed = true;
return *reinterpret_cast<non_cv_value*>(
this->m_storage.address()
);
}
template <typename U>
inline reference construct(U const& value_) const
{
return this->construct2(value_);
}
void destroy()
{
reinterpret_cast<non_cv_value*>(
this->m_storage.address()
)->~non_cv_value();
}
typedef reference(
::boost::parameter::aux::maybe<T>::*safe_bool
)() const;
inline operator safe_bool() const
{
return this->value ? &::boost::parameter::aux::maybe<T>::get : 0;
}
inline reference get() const
{
return this->value.get();
}
private:
::boost::optional<T> value;
mutable bool constructed;
mutable typename ::boost::parameter::aux
::referent_storage<reference>::type m_storage;
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,93 @@
// Copyright Daniel Wallin 2006.
// 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)
#ifndef BOOST_PARAMETER_AUX_NAME_HPP
#define BOOST_PARAMETER_AUX_NAME_HPP
namespace boost { namespace parameter { namespace aux {
struct name_tag_base
{
};
template <typename Tag>
struct name_tag
{
};
}}} // namespace boost::parameter::aux
#include <boost/mpl/bool.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct is_name_tag : ::boost::mpl::false_
{
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/value_type.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#if !defined(BOOST_NO_SFINAE) && \
!BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x592))
#include <boost/parameter/aux_/lambda_tag.hpp>
#include <boost/mpl/lambda.hpp>
#include <boost/mpl/bind.hpp>
#include <boost/mpl/quote.hpp>
#include <boost/core/enable_if.hpp>
namespace boost { namespace mpl {
template <typename T>
struct lambda<
T
, typename ::boost::enable_if<
::boost::parameter::aux::is_name_tag<T>
, ::boost::parameter::aux::lambda_tag
>::type
>
{
typedef ::boost::mpl::true_ is_le;
typedef ::boost::mpl::bind3<
::boost::mpl::quote3< ::boost::parameter::value_type>
, ::boost::mpl::arg<2>
, T
, void
> result_;
typedef result_ type;
};
}} // namespace boost::mpl
#endif // SFINAE enabled, not Borland.
#include <boost/parameter/aux_/void.hpp>
#define BOOST_PARAMETER_TAG_PLACEHOLDER_TYPE(tag) \
::boost::parameter::value_type< \
::boost::mpl::_2,tag,::boost::parameter::void_ \
>
/**/
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#define BOOST_PARAMETER_TAG_MP11_PLACEHOLDER_VALUE(name, tag) \
template <typename ArgumentPack> \
using name = typename ::boost::parameter \
::value_type<ArgumentPack,tag,::boost::parameter::void_>::type
/**/
#include <boost/parameter/binding.hpp>
#define BOOST_PARAMETER_TAG_MP11_PLACEHOLDER_BINDING(name, tag) \
template <typename ArgumentPack> \
using name = typename ::boost::parameter \
::binding<ArgumentPack,tag,::boost::parameter::void_>::type
/**/
#endif // BOOST_PARAMETER_CAN_USE_MP11
#endif // include guard

View File

@@ -1,88 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003. 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)
// This file generates overloads in this format:
//
// template<class A0, class A1>
// typename mpl::apply_wrap1<
// aux::make_arg_list<
// PS0,A0
// , aux::make_arg_list<
// PS1,A1
// , mpl::identity<aux::empty_arg_list>
// >
// >
// , unnamed_list
// >::type
// operator()(A0 const& a0, A1 const& a1) const
// {
// typedef typename mpl::apply_wrap1<
// aux::make_arg_list<
// PS0,A0
// , aux::make_arg_list<
// PS1,A1
// , mpl::identity<aux::empty_arg_list>
// >
// >
// >::type arg_tuple;
//
// return arg_tuple(
// a0
// , a1
// , aux::void_()
// ...
// );
// }
//
#if !defined(BOOST_PP_IS_ITERATING)
# error Boost.Parameters - do not include this file!
#endif
#define N BOOST_PP_ITERATION()
#define BOOST_PARAMETER_open_list(z, n, text) \
aux::item< \
BOOST_PP_CAT(PS, n), BOOST_PP_CAT(A, n)
#define BOOST_PARAMETER_close_list(z, n, text) >
#define BOOST_PARAMETER_arg_list(n) \
aux::make_arg_list< \
BOOST_PP_ENUM(N, BOOST_PARAMETER_open_list, _) \
, void_ \
BOOST_PP_REPEAT(N, BOOST_PARAMETER_close_list, _) \
, deduced_list \
, aux::tag_keyword_arg \
>
#define BOOST_PARAMETER_arg_pack_init(z, n, limit) \
BOOST_PP_CAT(a, BOOST_PP_SUB(limit,n))
template<BOOST_PP_ENUM_PARAMS(N, class A)>
typename mpl::first<
typename BOOST_PARAMETER_arg_list(N)::type
>::type
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, & a)) const
{
typedef typename BOOST_PARAMETER_arg_list(N)::type result;
typedef typename mpl::first<result>::type result_type;
typedef typename mpl::second<result>::type error;
error();
return result_type(
BOOST_PP_ENUM(N, BOOST_PARAMETER_arg_pack_init, BOOST_PP_DEC(N))
BOOST_PP_ENUM_TRAILING_PARAMS(
BOOST_PP_SUB(BOOST_PARAMETER_MAX_ARITY, N)
, aux::void_reference() BOOST_PP_INTERCEPT
));
}
#undef BOOST_PARAMETER_arg_list
#undef BOOST_PARAMETER_open_list
#undef BOOST_PARAMETER_close_list
#undef N

View File

@@ -0,0 +1,32 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_AS_PARAMETER_REQUIREMENTS_HPP
#define BOOST_PARAMETER_AUX_PACK_AS_PARAMETER_REQUIREMENTS_HPP
#include <boost/parameter/aux_/pack/parameter_requirements.hpp>
#include <boost/parameter/aux_/pack/tag_type.hpp>
#include <boost/parameter/aux_/pack/predicate.hpp>
#include <boost/parameter/deduced.hpp>
namespace boost { namespace parameter { namespace aux {
// Converts a ParameterSpec into a specialization of
// parameter_requirements. We need to do this in order to get the
// tag_type into the type in a way that can be conveniently matched
// by a satisfies(...) member function in arg_list.
template <typename ParameterSpec>
struct as_parameter_requirements
{
typedef ::boost::parameter::aux::parameter_requirements<
typename ::boost::parameter::aux::tag_type<ParameterSpec>::type
, typename ::boost::parameter::aux::predicate<ParameterSpec>::type
, ::boost::parameter::aux::has_default<ParameterSpec>
> type;
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,217 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_DEDUCE_TAG_HPP
#define BOOST_PARAMETER_AUX_PACK_DEDUCE_TAG_HPP
namespace boost { namespace parameter { namespace aux {
template <
typename Argument
, typename ArgumentPack
, typename DeducedArgs
, typename UsedArgs
, typename TagFn
, typename EmitsErrors
>
struct deduce_tag;
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/lambda_tag.hpp>
#include <boost/parameter/config.hpp>
#include <boost/mpl/apply_wrap.hpp>
#include <boost/mpl/lambda.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
namespace boost { namespace parameter { namespace aux {
template <typename Predicate, typename Argument, typename ArgumentPack>
struct deduce_tag_condition_mpl
: ::boost::mpl::apply_wrap2<
typename ::boost::mpl::lambda<
Predicate
, ::boost::parameter::aux::lambda_tag
>::type
, Argument
, ArgumentPack
>
{
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/has_nested_template_fn.hpp>
#include <boost/mp11/list.hpp>
#include <boost/mp11/utility.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Predicate, typename Argument, typename ArgumentPack>
struct deduce_tag_condition_mp11
{
using type = ::boost::mp11::mp_apply_q<
Predicate
, ::boost::mp11::mp_list<Argument,ArgumentPack>
>;
};
template <typename Predicate, typename Argument, typename ArgumentPack>
using deduce_tag_condition = ::boost::mp11::mp_if<
::boost::parameter::aux::has_nested_template_fn<Predicate>
, ::boost::parameter::aux
::deduce_tag_condition_mp11<Predicate,Argument,ArgumentPack>
, ::boost::parameter::aux
::deduce_tag_condition_mpl<Predicate,Argument,ArgumentPack>
>;
}}} // namespace boost::parameter::aux
#else
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/assert.hpp>
#endif // BOOST_PARAMETER_CAN_USE_MP11
#include <boost/parameter/aux_/set.hpp>
#include <boost/parameter/aux_/pack/tag_type.hpp>
#include <boost/parameter/aux_/pack/tag_deduced.hpp>
namespace boost { namespace parameter { namespace aux {
// Helper for deduce_tag<...>, below.
template <
typename Argument
, typename ArgumentPack
, typename DeducedArgs
, typename UsedArgs
, typename TagFn
, typename EmitsErrors
>
class deduce_tag0
{
typedef typename DeducedArgs::spec _spec;
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
typedef typename ::boost::parameter::aux::deduce_tag_condition<
typename _spec::predicate
#else
typedef typename ::boost::mpl::apply_wrap2<
typename ::boost::mpl::lambda<
typename _spec::predicate
, ::boost::parameter::aux::lambda_tag
>::type
#endif
, Argument
, ArgumentPack
>::type _condition;
#if !defined(BOOST_PARAMETER_CAN_USE_MP11)
// Deduced parameter matches several arguments.
BOOST_MPL_ASSERT((
typename ::boost::mpl::eval_if<
typename ::boost::parameter::aux::has_key_<
UsedArgs
, typename ::boost::parameter::aux::tag_type<_spec>::type
>::type
, ::boost::mpl::eval_if<
_condition
, ::boost::mpl::if_<
EmitsErrors
, ::boost::mpl::false_
, ::boost::mpl::true_
>
, ::boost::mpl::true_
>
, ::boost::mpl::true_
>::type
));
#endif // BOOST_PARAMETER_CAN_USE_MP11
public:
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using type = typename ::boost::mp11::mp_if<
#else
typedef typename ::boost::mpl::eval_if<
#endif
_condition
, ::boost::parameter::aux
::tag_deduced<UsedArgs,_spec,Argument,TagFn>
, ::boost::parameter::aux::deduce_tag<
Argument
, ArgumentPack
, typename DeducedArgs::tail
, UsedArgs
, TagFn
, EmitsErrors
>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
>::type;
#else
>::type type;
#endif
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/void.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <type_traits>
#else
#include <boost/mpl/pair.hpp>
#include <boost/type_traits/is_same.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
// Tries to deduced a keyword tag for a given Argument.
// Returns an mpl::pair<> consisting of the tagged_argument<>,
// and an mpl::set<> where the new tag has been inserted.
//
// Argument: The argument type to be tagged.
//
// ArgumentPack: The ArgumentPack built so far.
//
// DeducedArgs: A specialization of deduced_item<> (see below).
// A list containing only the deduced ParameterSpecs.
//
// UsedArgs: An mpl::set<> containing the keyword tags used so far.
//
// TagFn: A metafunction class used to tag positional or deduced
// arguments with a keyword tag.
template <
typename Argument
, typename ArgumentPack
, typename DeducedArgs
, typename UsedArgs
, typename TagFn
, typename EmitsErrors
>
struct deduce_tag
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
: ::boost::mp11::mp_if<
::std::is_same<DeducedArgs,::boost::parameter::void_>
, ::boost::mp11::mp_identity<
::boost::mp11::mp_list< ::boost::parameter::void_,UsedArgs>
>
#else
: ::boost::mpl::eval_if<
::boost::is_same<DeducedArgs,::boost::parameter::void_>
, ::boost::mpl::pair< ::boost::parameter::void_,UsedArgs>
#endif
, ::boost::parameter::aux::deduce_tag0<
Argument
, ArgumentPack
, DeducedArgs
, UsedArgs
, TagFn
, EmitsErrors
>
>
{
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,34 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_DEDUCED_ITEM_HPP
#define BOOST_PARAMETER_AUX_PACK_DEDUCED_ITEM_HPP
#include <boost/parameter/aux_/void.hpp>
namespace boost { namespace parameter { namespace aux {
// A typelist that stored deduced parameter specs.
template <
typename ParameterSpec
, typename Tail = ::boost::parameter::void_
>
struct deduced_item
{
typedef ParameterSpec spec;
typedef Tail tail;
};
// Evaluate Tail and construct deduced_item list.
template <typename Spec, typename Tail>
struct make_deduced_item
{
typedef ::boost::parameter::aux
::deduced_item<Spec,typename Tail::type> type;
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,23 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_INSERT_TAGGED_HPP
#define BOOST_PARAMETER_AUX_PACK_INSERT_TAGGED_HPP
#include <boost/parameter/aux_/set.hpp>
namespace boost { namespace parameter { namespace aux {
// Inserts Tagged::key_type into the UserArgs set.
// Extra indirection to lazily evaluate Tagged::key_type.
template <typename UsedArgs, typename Tagged>
struct insert_tagged
: ::boost::parameter::aux::insert_<UsedArgs,typename Tagged::key_type>
{
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,43 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_IS_NAMED_ARGUMENT_HPP
#define BOOST_PARAMETER_AUX_PACK_IS_NAMED_ARGUMENT_HPP
#include <boost/parameter/aux_/template_keyword.hpp>
#include <boost/parameter/aux_/is_tagged_argument.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#include <boost/mp11/utility.hpp>
#else
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename T>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using is_named_argument = ::boost::mp11::mp_if<
::boost::parameter::aux::is_template_keyword<T>
, ::boost::mp11::mp_true
, ::boost::parameter::aux::is_tagged_argument_mp11<T>
>;
#else
struct is_named_argument
: ::boost::mpl::if_<
::boost::parameter::aux::is_template_keyword<T>
, ::boost::mpl::true_
, ::boost::parameter::aux::is_tagged_argument<T>
>::type
{
};
#endif
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,47 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_ITEM_HPP
#define BOOST_PARAMETER_AUX_PACK_ITEM_HPP
#include <boost/parameter/aux_/void.hpp>
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
// A parameter spec item typelist.
template <
typename Spec
, typename Arg
, typename Tail = ::boost::parameter::void_
>
struct item
{
typedef Spec spec;
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
typedef ::boost::is_const<
typename ::boost::remove_reference<Arg>::type
> is_arg_const;
#endif
typedef Arg arg;
typedef Tail tail;
};
template <typename Spec, typename Arg, typename Tail>
struct make_item
{
typedef boost::parameter::aux
::item<Spec,Arg,typename Tail::type> type;
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,438 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Copyright Cromwell D. Enage 2018.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_MAKE_ARG_LIST_HPP
#define BOOST_PARAMETER_AUX_PACK_MAKE_ARG_LIST_HPP
namespace boost { namespace parameter { namespace aux {
template <
typename List
, typename DeducedArgs
, typename TagFn
, typename IsPositional
, typename UsedArgs
, typename ArgumentPack
, typename Error
, typename EmitsErrors
>
struct make_arg_list_aux;
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/arg_list.hpp>
#include <boost/parameter/aux_/void.hpp>
#include <boost/parameter/aux_/pack/unmatched_argument.hpp>
#include <boost/parameter/aux_/pack/tag_type.hpp>
#include <boost/parameter/aux_/pack/is_named_argument.hpp>
#include <boost/parameter/aux_/pack/insert_tagged.hpp>
#include <boost/parameter/aux_/pack/deduce_tag.hpp>
#include <boost/parameter/deduced.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#include <boost/mp11/list.hpp>
#include <boost/mp11/utility.hpp>
#include <type_traits>
#else
#include <boost/mpl/bool.hpp>
#include <boost/mpl/pair.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/apply_wrap.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <typename ArgumentPack, typename TaggedArg, typename EmitsErrors>
struct append_to_make_arg_list
{
using type = ::boost::mp11::mp_push_front<
ArgumentPack
, ::boost::parameter::aux::flat_like_arg_tuple<
typename TaggedArg::key_type
, TaggedArg
, EmitsErrors
>
>;
};
#endif
// Borland needs the insane extra-indirection workaround below so that
// it doesn't magically drop the const qualifier from the argument type.
template <
typename List
, typename DeducedArgs
, typename TagFn
, typename IsPositional
, typename UsedArgs
, typename ArgumentPack
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
, typename _argument
#endif
, typename Error
, typename EmitsErrors
>
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
class make_arg_list00
#else
class make_arg_list0
#endif
{
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
typedef typename List::arg _argument;
#endif
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using _arg_type = typename ::std::remove_const<
typename ::std::remove_reference<_argument>::type
>::type;
using _is_tagged = ::boost::parameter::aux
::is_named_argument<_argument>;
#else
typedef typename ::boost::remove_const<
typename ::boost::remove_reference<_argument>::type
>::type _arg_type;
typedef ::boost::parameter::aux
::is_named_argument<_argument> _is_tagged;
#endif
typedef typename List::spec _parameter_spec;
typedef typename ::boost::parameter::aux
::tag_type<_parameter_spec>::type _tag;
// If this argument is either explicitly tagged or a deduced
// parameter, then turn off positional matching.
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using _is_positional = ::boost::mp11::mp_if<
IsPositional
, ::boost::mp11::mp_if<
::boost::parameter::aux::is_deduced<_parameter_spec>
, ::boost::mp11::mp_false
, ::boost::mp11::mp_if<
_is_tagged
, ::boost::mp11::mp_false
, ::boost::mp11::mp_true
>
>
, ::boost::mp11::mp_false
>;
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
typedef typename ::boost::mpl::eval_if<
IsPositional
, ::boost::mpl::eval_if<
::boost::parameter::aux::is_deduced<_parameter_spec>
, ::boost::mpl::false_
, ::boost::mpl::if_<
_is_tagged
, ::boost::mpl::false_
, ::boost::mpl::true_
>
>
, ::boost::mpl::false_
>::type _is_positional;
#endif // BOOST_PARAMETER_CAN_USE_MP11
// If this parameter is explicitly tagged, then add it to the
// used-parmeters set. We only really need to add parameters
// that are deduced, but we would need a way to check if
// a given tag corresponds to a deduced parameter spec.
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using _used_args = typename ::boost::mp11::mp_if<
_is_tagged
, ::boost::parameter::aux::insert_tagged<UsedArgs,_arg_type>
, ::boost::mp11::mp_identity<UsedArgs>
>::type;
#else
typedef typename ::boost::mpl::eval_if<
_is_tagged
, ::boost::parameter::aux::insert_tagged<UsedArgs,_arg_type>
, ::boost::mpl::identity<UsedArgs>
>::type _used_args;
#endif
// If this parameter is neither explicitly tagged nor positionally
// matched, then deduce the tag from the deduced parameter specs.
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using _deduced_data = typename ::boost::mp11::mp_if<
::boost::mp11::mp_if<
_is_tagged
, ::boost::mp11::mp_true
, _is_positional
>
, ::boost::mp11::mp_identity<
::boost::mp11::mp_list< ::boost::parameter::void_,_used_args>
>
#else
typedef typename ::boost::mpl::eval_if<
typename ::boost::mpl::if_<
_is_tagged
, ::boost::mpl::true_
, _is_positional
>::type
, ::boost::mpl::pair< ::boost::parameter::void_,_used_args>
#endif
, ::boost::parameter::aux::deduce_tag<
_argument
, ArgumentPack
, DeducedArgs
, _used_args
, TagFn
, EmitsErrors
>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
>::type;
#else
>::type _deduced_data;
#endif
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
// If this parameter is explicitly tagged ...
using _tagged = ::boost::mp11::mp_if<
_is_tagged
// ... just use it
, _arg_type
// ... else ...
, ::boost::mp11::mp_if<
// if positional matching is turned on ...
_is_positional
// ... tag it positionally
, ::boost::mp11::mp_apply_q<
TagFn
, ::boost::mp11::mp_list<_tag,_argument>
>
// ... else, use the deduced tag
, ::boost::mp11::mp_at_c<_deduced_data,0>
>
>;
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
// If this parameter is explicitly tagged ...
typedef typename ::boost::mpl::eval_if<
_is_tagged
// ... just use it
, ::boost::mpl::identity<_arg_type>
// ... else ...
, ::boost::mpl::eval_if<
// if positional matching is turned on ...
_is_positional
// ... tag it positionally
, ::boost::mpl::apply_wrap2<TagFn,_tag,_argument>
// ... else, use the deduced tag
, ::boost::mpl::first<_deduced_data>
>
>::type _tagged;
#endif // BOOST_PARAMETER_CAN_USE_MP11
// Build the arg_list incrementally, prepending new nodes.
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using _error = ::boost::mp11::mp_if<
::boost::mp11::mp_if<
::std::is_same<Error,::boost::parameter::void_>
, ::std::is_same<_tagged,::boost::parameter::void_>
, ::boost::mp11::mp_false
>
#else
typedef typename ::boost::mpl::if_<
typename ::boost::mpl::if_<
::boost::is_same<Error,::boost::parameter::void_>
, ::boost::is_same<_tagged,::boost::parameter::void_>
, ::boost::mpl::false_
>::type
#endif
, ::boost::parameter::aux::unmatched_argument<_argument>
, ::boost::parameter::void_
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
>;
#else
>::type _error;
#endif
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using _argument_pack = typename ::boost::mp11::mp_if<
::std::is_same<_tagged,::boost::parameter::void_>
, ::boost::mp11::mp_identity<ArgumentPack>
, ::boost::parameter::aux
::append_to_make_arg_list<ArgumentPack,_tagged,EmitsErrors>
>::type;
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
typedef typename ::boost::mpl::if_<
::boost::is_same<_tagged,::boost::parameter::void_>
, ArgumentPack
#if defined(BOOST_NO_SFINAE) || BOOST_WORKAROUND(BOOST_MSVC, < 1800)
, ::boost::parameter::aux::arg_list<_tagged,ArgumentPack>
#else
, ::boost::parameter::aux
::arg_list<_tagged,ArgumentPack,EmitsErrors>
#endif
>::type _argument_pack;
#endif // BOOST_PARAMETER_CAN_USE_MP11
public:
typedef typename ::boost::parameter::aux::make_arg_list_aux<
typename List::tail
, DeducedArgs
, TagFn
, _is_positional
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
, ::boost::mp11::mp_at_c<_deduced_data,1>
#else
, typename _deduced_data::second
#endif
, _argument_pack
, _error
, EmitsErrors
>::type type;
};
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
template <
typename List
, typename DeducedArgs
, typename TagFn
, typename IsPositional
, typename UsedArgs
, typename ArgumentPack
, typename Error
, typename EmitsErrors
>
struct make_arg_list0
{
typedef typename ::boost::mpl::eval_if<
typename List::is_arg_const
, ::boost::parameter::aux::make_arg_list00<
List
, DeducedArgs
, TagFn
, IsPositional
, UsedArgs
, ArgumentPack
, typename List::arg const
, Error
, EmitsErrors
>
, ::boost::parameter::aux::make_arg_list00<
List
, DeducedArgs
, TagFn
, IsPositional
, UsedArgs
, ArgumentPack
, typename List::arg
, Error
, EmitsErrors
>
>::type type;
};
#endif // Borland workarounds needed.
// Returns an ArgumentPack where the list of arguments has been tagged
// with keyword tags.
//
// List: A specialization of item<> (see below). Contains both
// the ordered ParameterSpecs, and the given arguments.
//
// DeducedArgs: A specialization of deduced_item<> (see below).
// A list containing only the deduced ParameterSpecs.
//
// TagFn: A metafunction class used to tag positional or deduced
// arguments with a keyword tag.
//
// IsPositional: An mpl::bool_<> specialization indicating if positional
// matching is to be performed.
//
// DeducedSet: An mpl::set<> containing the keyword tags used so far.
//
// ArgumentPack: The ArgumentPack built so far. This is initially an
// empty_arg_list and is built incrementally.
template <
typename List
, typename DeducedArgs
, typename TagFn
, typename IsPositional
, typename DeducedSet
, typename ArgumentPack
, typename Error
, typename EmitsErrors
>
struct make_arg_list_aux
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
: ::boost::mp11::mp_if<
::std::is_same<List,::boost::parameter::void_>
, ::boost::mp11::mp_identity<
::boost::mp11::mp_list<ArgumentPack,Error>
>
#else
: ::boost::mpl::eval_if<
::boost::is_same<List,::boost::parameter::void_>
, ::boost::mpl::identity< ::boost::mpl::pair<ArgumentPack,Error> >
#endif
, ::boost::parameter::aux::make_arg_list0<
List
, DeducedArgs
, TagFn
, IsPositional
, DeducedSet
, ArgumentPack
, Error
, EmitsErrors
>
>
{
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/set.hpp>
namespace boost { namespace parameter { namespace aux {
// VC6.5 was choking on the default parameters for make_arg_list_aux,
// so this just forwards to that adding in the defaults.
template <
typename List
, typename DeducedArgs
, typename TagFn
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
, typename EmitsErrors = ::boost::mp11::mp_true
#else
, typename EmitsErrors = ::boost::mpl::true_
#endif
>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using make_arg_list = ::boost::parameter::aux::make_arg_list_aux<
#else
struct make_arg_list
: ::boost::parameter::aux::make_arg_list_aux<
#endif
List
, DeducedArgs
, TagFn
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
, ::boost::mp11::mp_true
#else
, ::boost::mpl::true_
#endif
, ::boost::parameter::aux::set0
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
, ::boost::parameter::aux::flat_like_arg_list<>
#else
, ::boost::parameter::aux::empty_arg_list
#endif
, ::boost::parameter::void_
, EmitsErrors
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
>;
#else
>
{
};
#endif
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,53 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_MAKE_DEDUCED_ITEMS_HPP
#define BOOST_PARAMETER_AUX_PACK_MAKE_DEDUCED_ITEMS_HPP
#include <boost/parameter/aux_/void.hpp>
#include <boost/parameter/aux_/pack/deduced_item.hpp>
#include <boost/parameter/deduced.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/utility.hpp>
#include <type_traits>
#else
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename Spec, typename Tail>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using make_deduced_items = ::boost::mp11::mp_if<
::std::is_same<Spec,::boost::parameter::void_>
, ::boost::mp11::mp_identity< ::boost::parameter::void_>
, ::boost::mp11::mp_if<
::boost::parameter::aux::is_deduced<Spec>
, ::boost::parameter::aux::make_deduced_item<Spec,Tail>
, Tail
>
>;
#else
struct make_deduced_items
: ::boost::mpl::eval_if<
::boost::is_same<Spec,::boost::parameter::void_>
, ::boost::mpl::identity< ::boost::parameter::void_>
, ::boost::mpl::eval_if<
::boost::parameter::aux::is_deduced<Spec>
, ::boost::parameter::aux::make_deduced_item<Spec,Tail>
, Tail
>
>
{
};
#endif // BOOST_PARAMETER_CAN_USE_MP11
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,45 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_MAKE_ITEMS_HPP
#define BOOST_PARAMETER_AUX_PACK_MAKE_ITEMS_HPP
#include <boost/parameter/aux_/void.hpp>
#include <boost/parameter/aux_/pack/item.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/utility.hpp>
#include <type_traits>
#else
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
// Creates a item typelist.
template <typename Spec, typename Arg, typename Tail>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using make_items = ::boost::mp11::mp_if<
::std::is_same<Arg,::boost::parameter::void_>
, ::boost::mp11::mp_identity< ::boost::parameter::void_>
, ::boost::parameter::aux::make_item<Spec,Arg,Tail>
>;
#else
struct make_items
: ::boost::mpl::eval_if<
::boost::is_same<Arg,::boost::parameter::void_>
, ::boost::mpl::identity< ::boost::parameter::void_>
, ::boost::parameter::aux::make_item<Spec,Arg,Tail>
>
{
};
#endif
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,244 @@
// Copyright Cromwell D. Enage 2017.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_MAKE_PARAMETER_SPEC_ITEMS_HPP
#define BOOST_PARAMETER_AUX_PACK_MAKE_PARAMETER_SPEC_ITEMS_HPP
namespace boost { namespace parameter { namespace aux {
// This recursive metafunction forwards successive elements of
// parameters::parameter_spec to make_deduced_items<>.
// -- Cromwell D. Enage
template <typename SpecSeq>
struct make_deduced_list;
// Helper for match_parameters_base_cond<...>, below.
template <typename ArgumentPackAndError, typename SpecSeq>
struct match_parameters_base_cond_helper;
// Helper metafunction for make_parameter_spec_items<...>, below.
template <typename SpecSeq, typename ...Args>
struct make_parameter_spec_items_helper;
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/void.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename SpecSeq>
struct make_parameter_spec_items_helper<SpecSeq>
{
typedef ::boost::parameter::void_ type;
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/pack/make_deduced_items.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/list.hpp>
#else
#include <boost/mpl/front.hpp>
#include <boost/mpl/pop_front.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename SpecSeq>
struct make_deduced_list_not_empty
: ::boost::parameter::aux::make_deduced_items<
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
::boost::mp11::mp_front<SpecSeq>
#else
typename ::boost::mpl::front<SpecSeq>::type
#endif
, ::boost::parameter::aux::make_deduced_list<
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
::boost::mp11::mp_pop_front<SpecSeq>
#else
typename ::boost::mpl::pop_front<SpecSeq>::type
#endif
>
>
{
};
}}} // namespace boost::parameter::aux
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/utility.hpp>
#else
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/empty.hpp>
#include <boost/mpl/identity.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename SpecSeq>
struct make_deduced_list
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
: ::boost::mp11::mp_if<
::boost::mp11::mp_empty<SpecSeq>
, ::boost::mp11::mp_identity< ::boost::parameter::void_>
#else
: ::boost::mpl::eval_if<
::boost::mpl::empty<SpecSeq>
, ::boost::mpl::identity< ::boost::parameter::void_>
#endif
, ::boost::parameter::aux::make_deduced_list_not_empty<SpecSeq>
>
{
};
}}} // namespace boost::parameter::aux
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <type_traits>
#else
#include <boost/mpl/bool.hpp>
#include <boost/mpl/pair.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename ArgumentPackAndError>
struct is_arg_pack_error_void
: ::boost::mpl::if_<
::boost::is_same<
typename ::boost::mpl::second<ArgumentPackAndError>::type
, ::boost::parameter::void_
>
, ::boost::mpl::true_
, ::boost::mpl::false_
>::type
{
};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_CAN_USE_MP11
namespace boost { namespace parameter { namespace aux {
// Checks if the arguments match the criteria of overload resolution.
// If NamedList satisfies the PS0, PS1, ..., this is a metafunction
// returning parameters. Otherwise it has no nested ::type.
template <typename ArgumentPackAndError, typename SpecSeq>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using match_parameters_base_cond = ::boost::mp11::mp_if<
::boost::mp11::mp_empty<SpecSeq>
, ::std::is_same<
::boost::mp11::mp_at_c<ArgumentPackAndError,1>
, ::boost::parameter::void_
>
, ::boost::parameter::aux::match_parameters_base_cond_helper<
ArgumentPackAndError
, SpecSeq
>
>;
#else
struct match_parameters_base_cond
: ::boost::mpl::eval_if<
::boost::mpl::empty<SpecSeq>
, ::boost::parameter::aux
::is_arg_pack_error_void<ArgumentPackAndError>
, ::boost::parameter::aux::match_parameters_base_cond_helper<
ArgumentPackAndError
, SpecSeq
>
>
{
};
#endif // BOOST_PARAMETER_CAN_USE_MP11
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/pack/satisfies.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename ArgumentPackAndError, typename SpecSeq>
struct match_parameters_base_cond_helper
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
: ::boost::mp11::mp_if<
#else
: ::boost::mpl::eval_if<
#endif
::boost::parameter::aux::satisfies_requirements_of<
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
::boost::mp11::mp_at_c<ArgumentPackAndError,0>
, ::boost::mp11::mp_front<SpecSeq>
#else
typename ::boost::mpl::first<ArgumentPackAndError>::type
, typename ::boost::mpl::front<SpecSeq>::type
#endif
>
, ::boost::parameter::aux::match_parameters_base_cond<
ArgumentPackAndError
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
, ::boost::mp11::mp_pop_front<SpecSeq>
#else
, typename ::boost::mpl::pop_front<SpecSeq>::type
#endif
>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
, ::boost::mp11::mp_false
#else
, ::boost::mpl::false_
#endif
>
{
};
// This parameters item chaining metafunction class does not require
// the lengths of the SpecSeq and of Args parameter pack to match.
// Used by argument_pack to build the items in the resulting arg_list.
// -- Cromwell D. Enage
template <typename SpecSeq, typename ...Args>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using make_parameter_spec_items = ::boost::mp11::mp_if<
::boost::mp11::mp_empty<SpecSeq>
, ::boost::mp11::mp_identity< ::boost::parameter::void_>
, ::boost::parameter::aux
::make_parameter_spec_items_helper<SpecSeq,Args...>
>;
#else
struct make_parameter_spec_items
: ::boost::mpl::eval_if<
::boost::mpl::empty<SpecSeq>
, ::boost::mpl::identity< ::boost::parameter::void_>
, ::boost::parameter::aux
::make_parameter_spec_items_helper<SpecSeq,Args...>
>
{
};
#endif
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/pack/make_items.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename SpecSeq, typename A0, typename ...Args>
struct make_parameter_spec_items_helper<SpecSeq,A0,Args...>
: ::boost::parameter::aux::make_items<
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
::boost::mp11::mp_front<SpecSeq>
#else
typename ::boost::mpl::front<SpecSeq>::type
#endif
, A0
, ::boost::parameter::aux::make_parameter_spec_items<
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
::boost::mp11::mp_pop_front<SpecSeq>
#else
typename ::boost::mpl::pop_front<SpecSeq>::type
#endif
, Args...
>
>
{
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,25 @@
// Copyright Daniel Wallin, David Abrahams 2005.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_PARAMETER_REQUIREMENTS_HPP
#define BOOST_PARAMETER_AUX_PACK_PARAMETER_REQUIREMENTS_HPP
namespace boost { namespace parameter { namespace aux {
// Used to pass static information about parameter requirements through
// the satisfies() overload set (below). The matched function is never
// invoked, but its type indicates whether a parameter matches at
// compile-time.
template <typename Keyword, typename Predicate, typename HasDefault>
struct parameter_requirements
{
typedef Keyword keyword;
typedef Predicate predicate;
typedef HasDefault has_default;
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,87 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_PREDICATE_HPP
#define BOOST_PARAMETER_AUX_PACK_PREDICATE_HPP
namespace boost { namespace parameter { namespace aux {
// helper for get_predicate<...>, below
template <typename T>
struct get_predicate_or_default
{
typedef T type;
};
// helper for predicate<...>, below
template <typename T>
struct get_predicate
: ::boost::parameter::aux
::get_predicate_or_default<typename T::predicate>
{
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/use_default.hpp>
#include <boost/parameter/aux_/always_true_predicate.hpp>
namespace boost { namespace parameter { namespace aux {
template <>
struct get_predicate_or_default< ::boost::parameter::aux::use_default>
{
typedef ::boost::parameter::aux::always_true_predicate type;
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/required.hpp>
#include <boost/parameter/optional.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#include <boost/mp11/utility.hpp>
#else
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename T>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using predicate = ::boost::mp11::mp_if<
::boost::mp11::mp_if<
::boost::parameter::aux::is_optional<T>
, ::boost::mp11::mp_true
, ::boost::parameter::aux::is_required<T>
>
, ::boost::parameter::aux::get_predicate<T>
, ::boost::mp11::mp_identity<
::boost::parameter::aux::always_true_predicate
>
>;
#else
struct predicate
: ::boost::mpl::eval_if<
typename ::boost::mpl::if_<
::boost::parameter::aux::is_optional<T>
, ::boost::mpl::true_
, ::boost::parameter::aux::is_required<T>
>::type
, ::boost::parameter::aux::get_predicate<T>
, ::boost::mpl::identity<
::boost::parameter::aux::always_true_predicate
>
>
{
};
#endif // BOOST_PARAMETER_CAN_USE_MP11
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,142 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_SATISFIES_HPP
#define BOOST_PARAMETER_AUX_PACK_SATISFIES_HPP
#include <boost/parameter/config.hpp>
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
#include <boost/parameter/aux_/arg_list.hpp>
#include <boost/parameter/aux_/augment_predicate.hpp>
#include <boost/parameter/aux_/void.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/apply_wrap.hpp>
#include <boost/type_traits/is_same.hpp>
#else // !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#else
#include <boost/mpl/bool.hpp>
#endif
#include <boost/parameter/aux_/yesno.hpp>
#include <boost/parameter/aux_/preprocessor/nullptr.hpp>
#endif // MSVC-7.1 workarounds needed
namespace boost { namespace parameter { namespace aux {
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
template <typename ArgList, typename ParameterRequirements, typename Bound>
struct satisfies_impl
: ::boost::parameter::aux::augment_predicate<
typename ParameterRequirements::predicate
, typename ArgList::reference
, typename ArgList::key_type
, Bound
, ArgList
>
{
};
#endif
// Returns mpl::true_ iff the given ParameterRequirements are satisfied by
// ArgList.
template <typename ArgList, typename ParameterRequirements>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using satisfies = ::boost::mp11::mp_bool<
sizeof(
::boost::parameter::aux::to_yesno(
ArgList::satisfies(
static_cast<ParameterRequirements*>(
BOOST_PARAMETER_AUX_PP_NULLPTR
)
, static_cast<ArgList*>(BOOST_PARAMETER_AUX_PP_NULLPTR)
)
)
) == sizeof(::boost::parameter::aux::yes_tag)
>;
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
class satisfies
{
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
// VC7.1 can't handle the sizeof() implementation below,
// so we use this instead.
typedef typename ::boost::mpl::apply_wrap3<
typename ArgList::binding
, typename ParameterRequirements::keyword
, ::boost::parameter::void_
, ::boost::mpl::false_
>::type _bound;
public:
typedef typename ::boost::mpl::eval_if<
::boost::is_same<_bound,::boost::parameter::void_>
, typename ParameterRequirements::has_default
, ::boost::mpl::eval_if<
::boost::is_same<
ArgList
, ::boost::parameter::aux::empty_arg_list
>
, ::boost::mpl::false_
, ::boost::parameter::aux::satisfies_impl<
ArgList
, ParameterRequirements
, _bound
>
>
>::type type;
#else // !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
BOOST_STATIC_CONSTANT(
bool, _value = (
sizeof(
::boost::parameter::aux::to_yesno(
ArgList::satisfies(
static_cast<ParameterRequirements*>(
BOOST_PARAMETER_AUX_PP_NULLPTR
)
, static_cast<ArgList*>(BOOST_PARAMETER_AUX_PP_NULLPTR)
)
)
) == sizeof(::boost::parameter::aux::yes_tag)
)
);
public:
typedef ::boost::mpl::bool_<
::boost::parameter::aux
::satisfies<ArgList,ParameterRequirements>::_value
> type;
#endif // MSVC-7.1 workarounds needed
};
#endif // BOOST_PARAMETER_CAN_USE_MP11
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/pack/as_parameter_requirements.hpp>
namespace boost { namespace parameter { namespace aux {
// Returns mpl::true_ if the requirements of the given ParameterSpec
// are satisfied by ArgList.
template <typename ArgList, typename ParameterSpec>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using satisfies_requirements_of = ::boost::parameter::aux::satisfies<
ArgList
, typename ::boost::parameter::aux
::as_parameter_requirements<ParameterSpec>::type
>;
#else
struct satisfies_requirements_of
: ::boost::parameter::aux::satisfies<
ArgList
, typename ::boost::parameter::aux
::as_parameter_requirements<ParameterSpec>::type
>::type
{
};
#endif // BOOST_PARAMETER_CAN_USE_MP11
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,59 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_TAG_DEDUCED_HPP
#define BOOST_PARAMETER_AUX_PACK_TAG_DEDUCED_HPP
#include <boost/parameter/aux_/set.hpp>
#include <boost/parameter/aux_/pack/tag_type.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/list.hpp>
#include <boost/mp11/utility.hpp>
#else
#include <boost/mpl/pair.hpp>
#include <boost/mpl/apply_wrap.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
// Tags a deduced argument Arg with the keyword tag of Spec using TagFn.
// Returns the tagged argument and the mpl::set<> UsedArgs with the
// tag of Spec inserted.
template <typename UsedArgs, typename Spec, typename Arg, typename TagFn>
struct tag_deduced
{
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using type = ::boost::mp11::mp_list<
::boost::mp11::mp_apply_q<
TagFn
, ::boost::mp11::mp_list<
typename ::boost::parameter::aux::tag_type<Spec>::type
, Arg
>
>
#else
typedef ::boost::mpl::pair<
typename ::boost::mpl::apply_wrap2<
TagFn
, typename ::boost::parameter::aux::tag_type<Spec>::type
, Arg
>::type
#endif // BOOST_PARAMETER_CAN_USE_MP11
, typename ::boost::parameter::aux::insert_<
UsedArgs
, typename ::boost::parameter::aux::tag_type<Spec>::type
>::type
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
>;
#else
> type;
#endif
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,30 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_TAG_KEYWORD_ARG_HPP
#define BOOST_PARAMETER_AUX_PACK_TAG_KEYWORD_ARG_HPP
#include <boost/parameter/aux_/tag.hpp>
#include <boost/parameter/config.hpp>
namespace boost { namespace parameter { namespace aux {
struct tag_keyword_arg
{
template <typename K, typename T>
struct apply
{
typedef typename ::boost::parameter::aux::tag<K,T>::type type;
};
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <typename K, typename T>
using fn = typename ::boost::parameter::aux::tag<K,T>::type;
#endif
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,67 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_TAG_KEYWORD_ARG_REF_HPP
#define BOOST_PARAMETER_AUX_PACK_TAG_KEYWORD_ARG_REF_HPP
#include <boost/parameter/aux_/unwrap_cv_reference.hpp>
#include <boost/parameter/aux_/tagged_argument.hpp>
#include <boost/parameter/config.hpp>
namespace boost { namespace parameter { namespace aux {
template <
typename Keyword
, typename ActualArg
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
, typename = typename ::boost::parameter::aux
::is_cv_reference_wrapper<ActualArg>::type
#endif
>
struct tag_ref
{
typedef ::boost::parameter::aux::tagged_argument<
Keyword
, typename ::boost::parameter::aux
::unwrap_cv_reference<ActualArg>::type
> type;
};
}}} // namespace boost::parameter::aux_
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
#include <boost/mpl/bool.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Keyword, typename ActualArg>
struct tag_ref<Keyword,ActualArg,::boost::mpl::false_>
{
typedef ::boost::parameter::aux
::tagged_argument<Keyword,ActualArg> type;
};
}}} // namespace boost::parameter::aux_
#endif // Borland workarounds needed.
namespace boost { namespace parameter { namespace aux {
struct tag_keyword_arg_ref
{
template <typename K, typename T>
struct apply
{
typedef typename ::boost::parameter::aux::tag_ref<K,T>::type type;
};
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <typename K, typename T>
using fn = typename ::boost::parameter::aux::tag_ref<K,T>::type;
#endif
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,30 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_TAG_TEMPLATE_KEYWORD_ARG_HPP
#define BOOST_PARAMETER_AUX_PACK_TAG_TEMPLATE_KEYWORD_ARG_HPP
#include <boost/parameter/template_keyword.hpp>
#include <boost/parameter/config.hpp>
namespace boost { namespace parameter { namespace aux {
struct tag_template_keyword_arg
{
template <typename K, typename T>
struct apply
{
typedef ::boost::parameter::template_keyword<K,T> type;
};
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <typename K, typename T>
using fn = ::boost::parameter::template_keyword<K,T>;
#endif
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,89 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_TAG_TYPE_HPP
#define BOOST_PARAMETER_AUX_PACK_TAG_TYPE_HPP
namespace boost { namespace parameter { namespace aux {
// helper for tag_type<...>, below.
template <typename T>
struct get_tag_type0
{
typedef typename T::key_type type;
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/deduced.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/utility.hpp>
#else
#include <boost/mpl/eval_if.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct get_tag_type
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
: ::boost::mp11::mp_if<
#else
: ::boost::mpl::eval_if<
#endif
::boost::parameter::aux::is_deduced0<T>
, ::boost::parameter::aux::get_tag_type0<typename T::key_type>
, ::boost::parameter::aux::get_tag_type0<T>
>
{
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/required.hpp>
#include <boost/parameter/optional.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename T>
using tag_type = ::boost::mp11::mp_if<
::boost::mp11::mp_if<
::boost::parameter::aux::is_optional<T>
, ::boost::mp11::mp_true
, ::boost::parameter::aux::is_required<T>
>
, ::boost::parameter::aux::get_tag_type<T>
, ::boost::mp11::mp_identity<T>
>;
}}} // namespace boost::parameter::aux
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/identity.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct tag_type
: ::boost::mpl::eval_if<
typename ::boost::mpl::if_<
::boost::parameter::aux::is_optional<T>
, ::boost::mpl::true_
, ::boost::parameter::aux::is_required<T>
>::type
, ::boost::parameter::aux::get_tag_type<T>
, ::boost::mpl::identity<T>
>
{
};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_CAN_USE_MP11
#endif // include guard

View File

@@ -0,0 +1,41 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_PACK_UNMATCHED_ARGUMENT_HPP
#define BOOST_PARAMETER_AUX_PACK_UNMATCHED_ARGUMENT_HPP
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <type_traits>
#else
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct unmatched_argument
{
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
static_assert(::std::is_same<T,void>::value, "T == void");
#else
BOOST_MPL_ASSERT((
typename ::boost::mpl::if_<
::boost::is_same<T,void>
, ::boost::mpl::true_
, ::boost::mpl::false_
>::type
));
#endif
typedef int type;
};
}}} // namespace boost::parameter::aux
#endif // include guard

27
include/boost/parameter/aux_/parameter_requirements.hpp Executable file → Normal file
View File

@@ -1,25 +1,12 @@
// Copyright Daniel Wallin, David Abrahams 2005. Use, modification and
// distribution is subject to the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// Copyright Daniel Wallin, David Abrahams 2005.
// 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)
#ifndef PARAMETER_REQUIREMENTS_050331_HPP
#define PARAMETER_REQUIREMENTS_050331_HPP
#ifndef BOOST_PARAMETER_AUX_PARAMETER_REQUIREMENTS_HPP
#define BOOST_PARAMETER_AUX_PARAMETER_REQUIREMENTS_HPP
namespace boost { namespace parameter { namespace aux {
#include <boost/parameter/aux_/pack/parameter_requirements.hpp>
// Used to pass static information about parameter requirements
// through the satisfies() overload set (below). The
// matched function is never invoked, but its type indicates whether
// a parameter matches at compile-time
template <class Keyword, class Predicate, class HasDefault>
struct parameter_requirements
{
typedef Keyword keyword;
typedef Predicate predicate;
typedef HasDefault has_default;
};
#endif // include guard
}}} // namespace boost::parameter::aux
#endif // PARAMETER_REQUIREMENTS_050331_HPP

123
include/boost/parameter/aux_/parenthesized_type.hpp Executable file → Normal file
View File

@@ -1,119 +1,12 @@
// Copyright David Abrahams 2006. 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)
// Copyright David Abrahams 2006.
// 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)
#ifndef BOOST_PARAMETER_AUX_PARENTHESIZED_TYPE_DWA2006414_HPP
# define BOOST_PARAMETER_AUX_PARENTHESIZED_TYPE_DWA2006414_HPP
#define BOOST_PARAMETER_AUX_PARENTHESIZED_TYPE_DWA2006414_HPP
# include <boost/config.hpp>
# include <boost/detail/workaround.hpp>
#include <boost/parameter/aux_/preprocessor/impl/parenthesized_type.hpp>
namespace boost { namespace parameter { namespace aux {
#endif // include guard
// A macro that takes a parenthesized C++ type name (T) and transforms
// it into an un-parenthesized type expression equivalent to T.
# define BOOST_PARAMETER_PARENTHESIZED_TYPE(x) \
boost::parameter::aux::unaryfunptr_arg_type< void(*)x >::type
// A metafunction that transforms void(*)(T) -> T
template <class UnaryFunctionPointer>
struct unaryfunptr_arg_type;
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
template <class Arg>
struct unaryfunptr_arg_type<void(*)(Arg)>
{
typedef Arg type;
};
# else
// Use the "native typeof" bugfeatures of older versions of MSVC to
// accomplish what we'd normally do with partial specialization. This
// capability was discovered by Igor Chesnokov.
# if BOOST_WORKAROUND(BOOST_MSVC, != 1300)
// This version applies to VC6.5 and VC7.1 (except that we can just
// use partial specialization for the latter in this case).
// This gets used as a base class.
template<typename Address>
struct msvc_type_memory
{
// A nullary metafunction that will yield the Value type "stored"
// at this Address.
struct storage;
};
template<typename Value, typename Address>
struct msvc_store_type : msvc_type_memory<Address>
{
// VC++ somehow lets us define the base's nested storage
// metafunction here, where we have the Value type we'd like to
// "store" in it. Later we can come back to the base class and
// extract the "stored type."
typedef msvc_type_memory<Address> location;
struct location::storage
{
typedef Value type;
};
};
# else
// This slightly more complicated version of the same thing is
// required for msvc-7.0
template<typename Address>
struct msvc_type_memory
{
template<bool>
struct storage_impl;
typedef storage_impl<true> storage;
};
template<typename Value, typename Address>
struct msvc_store_type : msvc_type_memory<Address>
{
// Rather than supplying a definition for the base class' nested
// class, we specialize the base class' nested template
template<>
struct storage_impl<true>
{
typedef Value type;
};
};
# endif
// Function template argument deduction does many of the same things
// as type matching during partial specialization, so we call a
// function template to "store" T into the type memory addressed by
// void(*)(T).
template <class T>
msvc_store_type<T,void(*)(T)>
msvc_store_argument_type(void(*)(T));
template <class FunctionPointer>
struct unaryfunptr_arg_type
{
// We don't want the function to be evaluated, just instantiated,
// so protect it inside of sizeof.
enum { dummy = sizeof(msvc_store_argument_type((FunctionPointer)0)) };
// Now pull the type out of the instantiated base class
typedef typename msvc_type_memory<FunctionPointer>::storage::type type;
};
# endif
template <>
struct unaryfunptr_arg_type<void(*)(void)>
{
typedef void type;
};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_AUX_PARENTHESIZED_TYPE_DWA2006414_HPP

View File

@@ -0,0 +1,91 @@
// Copyright Daniel Wallin 2006.
// Copyright Cromwell D. Enage 2017.
// 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)
#ifndef BOOST_PARAMETER_AUX_PP_IMPL_ARGUMENT_PACK_HPP
#define BOOST_PARAMETER_AUX_PP_IMPL_ARGUMENT_PACK_HPP
#include <boost/parameter/aux_/pack/tag_keyword_arg.hpp>
#include <boost/parameter/aux_/pack/make_arg_list.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#include <boost/parameter/aux_/pack/make_parameter_spec_items.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#include <boost/mp11/list.hpp>
#else
#include <boost/mpl/bool.hpp>
#include <boost/mpl/pair.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename Parameters, typename ...Args>
struct argument_pack
{
typedef typename ::boost::parameter::aux::make_arg_list<
typename ::boost::parameter::aux::make_parameter_spec_items<
typename Parameters::parameter_spec
, Args...
>::type
, typename Parameters::deduced_list
, ::boost::parameter::aux::tag_keyword_arg
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
, ::boost::mp11::mp_false
#else
, ::boost::mpl::false_
#endif
>::type result;
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using type = ::boost::mp11::mp_at_c<result,0>;
#else
typedef typename ::boost::mpl::first<result>::type type;
#endif
};
}}} // namespace boost::parameter::aux
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#include <boost/parameter/aux_/void.hpp>
#include <boost/parameter/aux_/pack/make_items.hpp>
#include <boost/parameter/aux_/preprocessor/no_perfect_forwarding_begin.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/pair.hpp>
namespace boost { namespace parameter { namespace aux {
template <
typename Parameters
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(
BOOST_PARAMETER_MAX_ARITY
, typename A
, = ::boost::parameter::void_ BOOST_PP_INTERCEPT
)
>
struct argument_pack
{
typedef typename ::boost::parameter::aux::make_arg_list<
typename BOOST_PARAMETER_build_arg_list(
BOOST_PARAMETER_MAX_ARITY
, ::boost::parameter::aux::make_items
, typename Parameters::parameter_spec
, A
)::type
, typename Parameters::deduced_list
, ::boost::parameter::aux::tag_keyword_arg
, ::boost::mpl::false_
>::type result;
typedef typename ::boost::mpl::first<result>::type type;
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/preprocessor/no_perfect_forwarding_end.hpp>
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
#endif // include guard

View File

@@ -0,0 +1,55 @@
// Copyright Daniel Wallin 2006.
// Copyright Cromwell D. Enage 2017.
// 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)
#ifndef BOOST_PARAMETER_AUX_PP_IMPL_MATCH_HPP
#define BOOST_PARAMETER_AUX_PP_IMPL_MATCH_HPP
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
namespace boost { namespace parameter { namespace aux {
// Recast the ParameterSpec's nested match metafunction
// as a free metafunction.
//
// No more limits set by BOOST_PARAMETER_MAX_ARITY. -- Cromwell D. Enage
template <typename Parameters, typename ...Args>
struct match : Parameters::BOOST_NESTED_TEMPLATE match<Args...>
{
};
}}} // namespace boost::parameter::aux
#else
#include <boost/parameter/aux_/void.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
namespace boost { namespace parameter { namespace aux {
// Recast the ParameterSpec's nested match metafunction
// as a free metafunction.
template <
typename Parameters
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(
BOOST_PARAMETER_MAX_ARITY
, typename A
, = ::boost::parameter::void_ BOOST_PP_INTERCEPT
)
>
struct match
: Parameters::BOOST_NESTED_TEMPLATE match<
BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, A)
>
{
};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
#endif // include guard

View File

@@ -0,0 +1,97 @@
// Copyright Daniel Wallin 2006.
// 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)
#ifndef BOOST_PARAMETER_AUX_PP_IMPL_UNWRAP_PREDICATE_HPP
#define BOOST_PARAMETER_AUX_PP_IMPL_UNWRAP_PREDICATE_HPP
namespace boost { namespace parameter { namespace aux {
// Given Match, which is "void x" where x is an argument matching
// criterion, extract a corresponding MPL predicate.
template <typename Match>
struct unwrap_predicate;
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/always_true_predicate.hpp>
namespace boost { namespace parameter { namespace aux {
// Match anything
template <>
struct unwrap_predicate<void*>
{
typedef ::boost::parameter::aux::always_true_predicate type;
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/config.hpp>
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
#include <boost/parameter/aux_/void.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
// A matching predicate is explicitly specified.
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
template <typename Predicate>
struct unwrap_predicate< ::boost::parameter::aux::voidstar(Predicate)>
{
typedef Predicate type;
};
#else
template <typename Predicate>
struct unwrap_predicate<void *(Predicate)>
{
typedef Predicate type;
};
#endif // SunProCC workarounds needed.
}}} // namespace boost::parameter::aux
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <type_traits>
#else
#include <boost/mpl/placeholders.hpp>
#include <boost/type_traits/is_convertible.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
// A type to which the argument is supposed to be convertible is
// specified.
template <typename Target>
struct unwrap_predicate<void (Target)>
{
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
struct type
{
template <typename Argument, typename ArgumentPack>
struct apply
: ::boost::mpl::if_<
::std::is_convertible<Argument,Target>
, ::boost::mpl::true_
, ::boost::mpl::false_
>
{
};
template <typename Argument, typename ArgumentPack>
using fn = ::std::is_convertible<Argument,Target>;
};
#else
typedef ::boost::mpl::if_<
::boost::is_convertible< ::boost::mpl::_,Target>
, ::boost::mpl::true_
, ::boost::mpl::false_
> type;
#endif // BOOST_PARAMETER_CAN_USE_MP11
};
}}} // namespace boost::parameter::aux
#endif // include guard

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,65 @@
// Copyright Cromwell D. Enage 2017.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_BINARY_SEQ_TO_ARGS_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_BINARY_SEQ_TO_ARGS_HPP
#include <boost/preprocessor/seq/elem.hpp>
#include <boost/preprocessor/cat.hpp>
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0_1(n, prefix_seq) \
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, prefix_seq), n) const&
/**/
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1_1(n, prefix_seq) \
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, prefix_seq), n)&
/**/
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0_2(n, prefix_seq) \
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0_1(n, prefix_seq) \
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, prefix_seq), n)
/**/
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1_2(n, prefix_seq) \
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1_1(n, prefix_seq) \
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, prefix_seq), n)
/**/
#include <boost/preprocessor/seq/size.hpp>
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0(prefix_seq) \
BOOST_PP_CAT( \
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0_ \
, BOOST_PP_SEQ_SIZE(prefix_seq) \
)
/**/
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1(prefix_seq) \
BOOST_PP_CAT( \
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1_ \
, BOOST_PP_SEQ_SIZE(prefix_seq) \
)
/**/
#include <boost/parameter/aux_/preprocessor/convert_binary_seq.hpp>
// This macro converts the specified Boost.Preprocessor sequence of 1s and 0s
// into a formal function parameter list.
//
// Example:
// BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS((1)(0)(1)(0), (P)(p))
// expands to
// P0 & p0, P1 const& p1, P2 & p2, P3 const& p3
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS(binary_seq, prefix_seq) \
BOOST_PARAMETER_AUX_PP_CONVERT_BINARY_SEQ( \
binary_seq \
, BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0(prefix_seq) \
, BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1(prefix_seq) \
, prefix_seq \
)
/**/
#endif // include guard

View File

@@ -0,0 +1,57 @@
// Copyright Cromwell D. Enage 2013.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_CONVERT_BINARY_SEQ_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_CONVERT_BINARY_SEQ_HPP
#include <boost/preprocessor/seq/size.hpp>
#include <boost/preprocessor/seq/push_back.hpp>
#define BOOST_PARAMETER_AUX_PP_AUGMENT_BINARY_SEQ_INDEX_FOLD_OP(s, seq, idx) \
BOOST_PP_SEQ_PUSH_BACK(seq, (idx, BOOST_PP_SEQ_SIZE(seq)))
/**/
#include <boost/preprocessor/control/iif.hpp>
#include <boost/preprocessor/seq/elem.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#define BOOST_PARAMETER_AUX_PP_CONVERT_BINARY_SEQ_FOLD_OP(s, seq, elem) \
( \
BOOST_PP_SEQ_PUSH_BACK( \
BOOST_PP_SEQ_ELEM(0, seq) \
, BOOST_PP_IIF( \
BOOST_PP_TUPLE_ELEM(2, 0, elem) \
, BOOST_PP_SEQ_ELEM(2, seq) \
, BOOST_PP_SEQ_ELEM(1, seq) \
)(BOOST_PP_TUPLE_ELEM(2, 1, elem), BOOST_PP_SEQ_ELEM(3, seq)) \
) \
)(BOOST_PP_SEQ_ELEM(1, seq))(BOOST_PP_SEQ_ELEM(2, seq)) \
(BOOST_PP_SEQ_ELEM(3, seq))
/**/
#include <boost/parameter/aux_/preprocessor/seq_enum.hpp>
#include <boost/preprocessor/facilities/empty.hpp>
#include <boost/preprocessor/seq/seq.hpp>
#include <boost/preprocessor/seq/fold_left.hpp>
#define BOOST_PARAMETER_AUX_PP_CONVERT_BINARY_SEQ(seq, macro0, macro1, data) \
BOOST_PARAMETER_SEQ_ENUM( \
BOOST_PP_SEQ_ELEM( \
0 \
, BOOST_PP_SEQ_FOLD_LEFT( \
BOOST_PARAMETER_AUX_PP_CONVERT_BINARY_SEQ_FOLD_OP \
, (BOOST_PP_SEQ_NIL)(macro0)(macro1)(data) \
, BOOST_PP_SEQ_FOLD_LEFT( \
BOOST_PARAMETER_AUX_PP_AUGMENT_BINARY_SEQ_INDEX_FOLD_OP \
, BOOST_PP_EMPTY() \
, seq \
) \
) \
) \
)
/**/
#endif // include guard

117
include/boost/parameter/aux_/preprocessor/flatten.hpp Executable file → Normal file
View File

@@ -1,115 +1,12 @@
// Copyright Daniel Wallin 2005. 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)
// Copyright Daniel Wallin 2005.
// 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)
#ifndef BOOST_PARAMETER_FLATTEN_051217_HPP
# define BOOST_PARAMETER_FLATTEN_051217_HPP
#define BOOST_PARAMETER_FLATTEN_051217_HPP
# include <boost/preprocessor/tuple/elem.hpp>
# include <boost/preprocessor/tuple/rem.hpp>
# include <boost/preprocessor/cat.hpp>
# include <boost/preprocessor/seq/for_each.hpp>
# include <boost/preprocessor/seq/for_each_i.hpp>
# include <boost/preprocessor/identity.hpp>
# include <boost/preprocessor/selection/max.hpp>
# include <boost/preprocessor/arithmetic/sub.hpp>
# include <boost/preprocessor/repetition/enum_trailing.hpp>
# include <boost/parameter/aux_/preprocessor/for_each.hpp>
#include <boost/parameter/aux_/preprocessor/impl/flatten.hpp>
# define BOOST_PARAMETER_FLATTEN_SPLIT_required required,
# define BOOST_PARAMETER_FLATTEN_SPLIT_optional optional,
# define BOOST_PARAMETER_FLATTEN_SPLIT_deduced deduced,
# define BOOST_PARAMETER_FLATTEN_SPLIT(sub) \
BOOST_PP_CAT(BOOST_PARAMETER_FLATTEN_SPLIT_, sub)
# define BOOST_PARAMETER_FLATTEN_QUALIFIER(sub) \
BOOST_PP_SPLIT(0, BOOST_PARAMETER_FLATTEN_SPLIT(sub))
# define BOOST_PARAMETER_FLATTEN_ARGS(sub) \
BOOST_PP_SPLIT(1, BOOST_PARAMETER_FLATTEN_SPLIT(sub))
# define BOOST_PARAMETER_FLATTEN_ARITY_optional(arities) \
BOOST_PP_TUPLE_ELEM(3,0,arities)
# define BOOST_PARAMETER_FLATTEN_ARITY_required(arities) \
BOOST_PP_TUPLE_ELEM(3,1,arities)
# define BOOST_PARAMETER_FLATTEN_SPEC0_DUMMY_ELEM(z, n, data) ~
# define BOOST_PARAMETER_FLATTEN_SPEC0(r, n, elem, data) \
(( \
BOOST_PP_TUPLE_ELEM(3,2,data) \
, BOOST_PP_TUPLE_REM(BOOST_PP_TUPLE_ELEM(3,0,data)) elem \
BOOST_PP_ENUM_TRAILING( \
BOOST_PP_SUB( \
BOOST_PP_TUPLE_ELEM(3,1,data) \
, BOOST_PP_TUPLE_ELEM(3,0,data) \
) \
, BOOST_PARAMETER_FLATTEN_SPEC0_DUMMY_ELEM \
, ~ \
) \
))
# define BOOST_PARAMETER_FLATTEN_SPEC_AUX(r, arity, max_arity, spec, transform) \
BOOST_PARAMETER_FOR_EACH_R( \
r \
, arity \
, BOOST_PARAMETER_FLATTEN_ARGS(spec) \
, (arity, max_arity, transform(BOOST_PARAMETER_FLATTEN_QUALIFIER(spec))) \
, BOOST_PARAMETER_FLATTEN_SPEC0 \
)
# define BOOST_PARAMETER_FLATTEN_IDENTITY(x) x
# define BOOST_PARAMETER_FLATTEN_SPEC_optional(r, arities, spec) \
BOOST_PARAMETER_FLATTEN_SPEC_AUX( \
r \
, BOOST_PP_CAT( \
BOOST_PARAMETER_FLATTEN_ARITY_, BOOST_PARAMETER_FLATTEN_QUALIFIER(spec) \
)(arities) \
, BOOST_PP_TUPLE_ELEM(3,2,arities) \
, spec \
, BOOST_PARAMETER_FLATTEN_IDENTITY \
)
# define BOOST_PARAMETER_FLATTEN_SPEC_required(r, arities, spec) \
BOOST_PARAMETER_FLATTEN_SPEC_optional(r, arities, spec)
# define BOOST_PARAMETER_FLATTEN_SPEC_AS_DEDUCED(x) BOOST_PP_CAT(deduced_,x)
# define BOOST_PARAMETER_FLATTEN_SPEC_deduced_M(r, arities, n, spec) \
BOOST_PARAMETER_FLATTEN_SPEC_AUX( \
r \
, BOOST_PP_CAT( \
BOOST_PARAMETER_FLATTEN_ARITY_, BOOST_PARAMETER_FLATTEN_QUALIFIER(spec) \
)(arities) \
, BOOST_PP_TUPLE_ELEM(3,2,arities) \
, spec \
, BOOST_PARAMETER_FLATTEN_SPEC_AS_DEDUCED \
)
# define BOOST_PARAMETER_FLATTEN_SPEC_deduced(r, arities, spec) \
BOOST_PP_SEQ_FOR_EACH_I_R( \
r \
, BOOST_PARAMETER_FLATTEN_SPEC_deduced_M \
, arities \
, BOOST_PARAMETER_FLATTEN_ARGS(spec) \
)
# define BOOST_PARAMETER_FLATTEN_SPEC(r, arities, spec) \
BOOST_PP_CAT( \
BOOST_PARAMETER_FLATTEN_SPEC_, BOOST_PARAMETER_FLATTEN_QUALIFIER(spec) \
)(r, arities, spec)
# define BOOST_PARAMETER_FLATTEN(optional_arity, required_arity, wanted_arity, specs) \
BOOST_PP_SEQ_FOR_EACH( \
BOOST_PARAMETER_FLATTEN_SPEC \
, ( \
optional_arity, required_arity \
, wanted_arity \
) \
, specs \
)
#endif // BOOST_PARAMETER_FLATTEN_051217_HPP
#endif // include guard

105
include/boost/parameter/aux_/preprocessor/for_each.hpp Executable file → Normal file
View File

@@ -1,103 +1,12 @@
// Copyright Daniel Wallin 2005. 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)
// Copyright Daniel Wallin 2005.
// 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)
#ifndef BOOST_PARAMETER_FOR_EACH_051217_HPP
# define BOOST_PARAMETER_FOR_EACH_051217_HPP
#define BOOST_PARAMETER_FOR_EACH_051217_HPP
# include <boost/preprocessor/cat.hpp>
# include <boost/preprocessor/detail/split.hpp>
# include <boost/preprocessor/logical/not.hpp>
# include <boost/preprocessor/facilities/is_empty.hpp>
# include <boost/preprocessor/tuple/eat.hpp>
# include <boost/preprocessor/arithmetic/inc.hpp>
# include <boost/preprocessor/repeat.hpp>
# include <boost/preprocessor/punctuation/comma_if.hpp>
# include <boost/preprocessor/for.hpp>
# include <boost/preprocessor/repetition/deduce_r.hpp>
#include <boost/parameter/aux_/preprocessor/impl/for_each.hpp>
# define BOOST_PARAMETER_FOR_EACH_head_aux2(x,y) (x,y), ~
# define BOOST_PARAMETER_FOR_EACH_head_aux3(x,y,z) (x,y,z), ~
# define BOOST_PARAMETER_FOR_EACH_head_aux4(x,y,z,u) (x,y,z,u), ~
# define BOOST_PARAMETER_FOR_EACH_head(n,x) \
BOOST_PP_SPLIT(0, BOOST_PP_CAT(BOOST_PARAMETER_FOR_EACH_head_aux,n) x)
# define BOOST_PARAMETER_FOR_EACH_pred_aux_BOOST_PARAMETER_FOR_EACH_END_SENTINEL
# define BOOST_PARAMETER_FOR_EACH_pred_aux_check(x) \
BOOST_PP_NOT(BOOST_PP_IS_EMPTY( \
BOOST_PP_CAT(BOOST_PARAMETER_FOR_EACH_pred_aux_, x) \
)), ~
# define BOOST_PARAMETER_FOR_EACH_pred_aux2(x,y) \
BOOST_PARAMETER_FOR_EACH_pred_aux_check(x)
# define BOOST_PARAMETER_FOR_EACH_pred_aux3(x,y,z) \
BOOST_PARAMETER_FOR_EACH_pred_aux_check(x)
# define BOOST_PARAMETER_FOR_EACH_pred_aux4(x,y,z,u) \
BOOST_PARAMETER_FOR_EACH_pred_aux_check(x)
# define BOOST_PARAMETER_FOR_EACH_pred_aux0(n,x) \
BOOST_PP_CAT(BOOST_PARAMETER_FOR_EACH_pred_aux,n) x
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
# define BOOST_PARAMETER_FOR_EACH_pred_SPLIT_FIRST(x) \
BOOST_PP_SPLIT(0, x)
# define BOOST_PARAMETER_FOR_EACH_pred(r, state) \
BOOST_PARAMETER_FOR_EACH_pred_SPLIT_FIRST( \
BOOST_PARAMETER_FOR_EACH_pred_aux0( \
BOOST_PP_TUPLE_ELEM(5,3,state) \
, BOOST_PP_TUPLE_ELEM(5,0,state) \
) \
)
# else
# define BOOST_PARAMETER_FOR_EACH_pred(r, state) \
BOOST_PP_SPLIT( \
0 \
, BOOST_PARAMETER_FOR_EACH_pred_aux0( \
BOOST_PP_TUPLE_ELEM(5,3,state) \
, BOOST_PP_TUPLE_ELEM(5,0,state) \
) \
)
# endif
# define BOOST_PARAMETER_FOR_EACH_op(r, state) \
( \
BOOST_PP_TUPLE_EAT(BOOST_PP_TUPLE_ELEM(5,3,state)) \
BOOST_PP_TUPLE_ELEM(5,0,state) \
, BOOST_PP_TUPLE_ELEM(5,1,state) \
, BOOST_PP_TUPLE_ELEM(5,2,state) \
, BOOST_PP_TUPLE_ELEM(5,3,state) \
, BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(5,4,state)) \
)
# define BOOST_PARAMETER_FOR_EACH_macro(r, state) \
BOOST_PP_TUPLE_ELEM(5,2,state)( \
r \
, BOOST_PP_TUPLE_ELEM(5,4,state) \
, BOOST_PARAMETER_FOR_EACH_head( \
BOOST_PP_TUPLE_ELEM(5,3,state) \
, BOOST_PP_TUPLE_ELEM(5,0,state) \
) \
, BOOST_PP_TUPLE_ELEM(5,1,state) \
)
# define BOOST_PARAMETER_FOR_EACH_build_end_sentinel(z,n,text) \
BOOST_PP_COMMA_IF(n) BOOST_PARAMETER_FOR_EACH_END_SENTINEL
# define BOOST_PARAMETER_FOR_EACH_build_end_sentinel_tuple(arity) \
( \
BOOST_PP_REPEAT(arity, BOOST_PARAMETER_FOR_EACH_build_end_sentinel, _) \
)
# define BOOST_PARAMETER_FOR_EACH_R(r, arity, list, data, macro) \
BOOST_PP_CAT(BOOST_PP_FOR_, r)( \
(list BOOST_PARAMETER_FOR_EACH_build_end_sentinel_tuple(arity), data, macro, arity, 0) \
, BOOST_PARAMETER_FOR_EACH_pred \
, BOOST_PARAMETER_FOR_EACH_op \
, BOOST_PARAMETER_FOR_EACH_macro \
)
# define BOOST_PARAMETER_FOR_EACH(arity, list, data, macro) \
BOOST_PARAMETER_FOR_EACH_R(BOOST_PP_DEDUCE_R(), arity, list, data, macro)
#endif // BOOST_PARAMETER_FOR_EACH_051217_HPP
#endif // include guard

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
// Copyright Daniel Wallin 2006.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_ARGUMENT_SPECS_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_ARGUMENT_SPECS_HPP
#include <boost/preprocessor/tuple/elem.hpp>
// Accessor macros for the argument specs tuple.
#define BOOST_PARAMETER_FN_ARG_QUALIFIER(x) BOOST_PP_TUPLE_ELEM(4, 0, x)
#define BOOST_PARAMETER_FN_ARG_KEYWORD(x) BOOST_PP_TUPLE_ELEM(4, 1, x)
#define BOOST_PARAMETER_FN_ARG_PRED(x) BOOST_PP_TUPLE_ELEM(4, 2, x)
#define BOOST_PARAMETER_FN_ARG_DEFAULT(x) BOOST_PP_TUPLE_ELEM(4, 3, x)
#include <boost/parameter/aux_/preprocessor/qualifier.hpp>
#define BOOST_PARAMETER_FN_ARG_NAME(x) \
BOOST_PARAMETER_UNQUALIFIED(BOOST_PARAMETER_FN_ARG_KEYWORD(x))
/**/
#endif // include guard

View File

@@ -0,0 +1,42 @@
// Copyright Daniel Wallin 2006.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_ARITY_RANGE_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_ARITY_RANGE_HPP
// Helper macros for BOOST_PARAMETER_ARITY_RANGE.
#define BOOST_PARAMETER_ARITY_RANGE_M_optional(state) state
#define BOOST_PARAMETER_ARITY_RANGE_M_deduced_optional(state) state
#include <boost/preprocessor/arithmetic/inc.hpp>
#define BOOST_PARAMETER_ARITY_RANGE_M_required(state) BOOST_PP_INC(state)
#define BOOST_PARAMETER_ARITY_RANGE_M_deduced_required(state) \
BOOST_PP_INC(state)
/**/
#include <boost/parameter/aux_/preprocessor/impl/argument_specs.hpp>
#include <boost/preprocessor/cat.hpp>
#define BOOST_PARAMETER_ARITY_RANGE_M(s, state, x) \
BOOST_PP_CAT( \
BOOST_PARAMETER_ARITY_RANGE_M_ \
, BOOST_PARAMETER_FN_ARG_QUALIFIER(x) \
)(state)
/**/
#include <boost/preprocessor/seq/fold_left.hpp>
#include <boost/preprocessor/seq/size.hpp>
// Calculates [begin, end) arity range.
#define BOOST_PARAMETER_ARITY_RANGE(args) \
( \
BOOST_PP_SEQ_FOLD_LEFT(BOOST_PARAMETER_ARITY_RANGE_M, 0, args) \
, BOOST_PP_INC(BOOST_PP_SEQ_SIZE(args)) \
)
/**/
#endif // include guard

View File

@@ -0,0 +1,143 @@
// Copyright Daniel Wallin 2005.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FLATTEN_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FLATTEN_HPP
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT_required required,
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT_optional optional,
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT_deduced deduced,
#define BOOST_PARAMETER_AUX_PP_FLATTEN_IDENTITY(x) x
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC0_DUMMY_ELEM(z, n, data) ~
#include <boost/preprocessor/cat.hpp>
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT(sub) \
BOOST_PP_CAT(BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT_, sub)
/**/
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_AS_DEDUCED(x) \
BOOST_PP_CAT(deduced_, x)
/**/
#include <boost/preprocessor/detail/split.hpp>
#define BOOST_PARAMETER_AUX_PP_FLATTEN_QUALIFIER(sub) \
BOOST_PP_SPLIT(0, BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT(sub))
/**/
#define BOOST_PARAMETER_AUX_PP_FLATTEN_ARGS(sub) \
BOOST_PP_SPLIT(1, BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT(sub))
/**/
#include <boost/preprocessor/tuple/elem.hpp>
#define BOOST_PARAMETER_AUX_PP_FLATTEN_ARITY_optional(arities) \
BOOST_PP_TUPLE_ELEM(3, 0, arities)
/**/
#define BOOST_PARAMETER_AUX_PP_FLATTEN_ARITY_required(arities) \
BOOST_PP_TUPLE_ELEM(3, 1, arities)
/**/
#include <boost/preprocessor/arithmetic/sub.hpp>
#include <boost/preprocessor/repetition/enum_trailing.hpp>
#include <boost/preprocessor/tuple/rem.hpp>
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC0(r, n, elem, data) \
(( \
BOOST_PP_TUPLE_ELEM(3, 2, data) \
, BOOST_PP_TUPLE_REM(BOOST_PP_TUPLE_ELEM(3, 0, data)) elem \
BOOST_PP_ENUM_TRAILING( \
BOOST_PP_SUB( \
BOOST_PP_TUPLE_ELEM(3, 1, data) \
, BOOST_PP_TUPLE_ELEM(3, 0, data) \
) \
, BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC0_DUMMY_ELEM \
, ~ \
) \
))
/**/
#include <boost/parameter/aux_/preprocessor/impl/for_each.hpp>
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_AUX( \
r, arity, max_arity, spec, xform \
) \
BOOST_PARAMETER_AUX_PP_FOR_EACH_R( \
r \
, arity \
, BOOST_PARAMETER_AUX_PP_FLATTEN_ARGS(spec) \
, ( \
arity \
, max_arity \
, xform(BOOST_PARAMETER_AUX_PP_FLATTEN_QUALIFIER(spec)) \
) \
, BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC0 \
)
/**/
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_optional(r, arities, spec) \
BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_AUX( \
r \
, BOOST_PP_CAT( \
BOOST_PARAMETER_AUX_PP_FLATTEN_ARITY_ \
, BOOST_PARAMETER_AUX_PP_FLATTEN_QUALIFIER(spec) \
)(arities) \
, BOOST_PP_TUPLE_ELEM(3, 2, arities) \
, spec \
, BOOST_PARAMETER_AUX_PP_FLATTEN_IDENTITY \
)
/**/
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_required(r, arities, spec) \
BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_optional(r, arities, spec)
/**/
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_deduced_M(r, arities, n, spec) \
BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_AUX( \
r \
, BOOST_PP_CAT( \
BOOST_PARAMETER_AUX_PP_FLATTEN_ARITY_ \
, BOOST_PARAMETER_AUX_PP_FLATTEN_QUALIFIER(spec) \
)(arities) \
, BOOST_PP_TUPLE_ELEM(3, 2, arities) \
, spec \
, BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_AS_DEDUCED \
)
/**/
#include <boost/preprocessor/seq/for_each_i.hpp>
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_deduced(r, arities, spec) \
BOOST_PP_SEQ_FOR_EACH_I_R( \
r \
, BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_deduced_M \
, arities \
, BOOST_PARAMETER_AUX_PP_FLATTEN_ARGS(spec) \
)
/**/
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC(r, arities, spec) \
BOOST_PP_CAT( \
BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_ \
, BOOST_PARAMETER_AUX_PP_FLATTEN_QUALIFIER(spec) \
)(r, arities, spec)
/**/
#include <boost/preprocessor/seq/for_each.hpp>
#define BOOST_PARAMETER_AUX_PP_FLATTEN( \
opt_arity, req_arity, wanted_arity, specs \
) \
BOOST_PP_SEQ_FOR_EACH( \
BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC \
, (opt_arity, req_arity, wanted_arity) \
, specs \
)
/**/
#endif // include guard

View File

@@ -0,0 +1,152 @@
// Copyright Daniel Wallin 2005.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FOR_EACH_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FOR_EACH_HPP
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_head_aux2(x, y) (x, y), ~
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_head_aux3(x, y, z) (x, y, z), ~
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_head_aux4(x, y, z, u) (x, y, z, u), ~
#define \
BOOST_PARAMETER_AUX_PP_FOR_EACH_pred_aux_BOOST_PARAMETER_AUX_PP_FOR_EACH_END_S
/**/
#include <boost/preprocessor/detail/split.hpp>
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_pred_SPLIT_FIRST(x) \
BOOST_PP_SPLIT(0, x)
/**/
#include <boost/preprocessor/cat.hpp>
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_head(n, x) \
BOOST_PP_SPLIT( \
0 \
, BOOST_PP_CAT(BOOST_PARAMETER_AUX_PP_FOR_EACH_head_aux, n) x \
)
/**/
#include <boost/preprocessor/facilities/is_empty.hpp>
#include <boost/preprocessor/logical/not.hpp>
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_pred_aux_check(x) \
BOOST_PP_NOT(BOOST_PP_IS_EMPTY( \
BOOST_PP_CAT(BOOST_PARAMETER_AUX_PP_FOR_EACH_pred_aux_, x) \
)), ~
/**/
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_pred_aux2(x, y) \
BOOST_PARAMETER_AUX_PP_FOR_EACH_pred_aux_check(x)
/**/
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_pred_aux3(x, y, z) \
BOOST_PARAMETER_AUX_PP_FOR_EACH_pred_aux_check(x)
/**/
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_pred_aux4(x, y, z, u) \
BOOST_PARAMETER_AUX_PP_FOR_EACH_pred_aux_check(x)
/**/
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_pred_aux0(n, x) \
BOOST_PP_CAT(BOOST_PARAMETER_AUX_PP_FOR_EACH_pred_aux, n) x
/**/
#include <boost/preprocessor/tuple/elem.hpp>
#if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_pred(r, state) \
BOOST_PARAMETER_AUX_PP_FOR_EACH_pred_SPLIT_FIRST( \
BOOST_PARAMETER_AUX_PP_FOR_EACH_pred_aux0( \
BOOST_PP_TUPLE_ELEM(5, 3, state) \
, BOOST_PP_TUPLE_ELEM(5, 0, state) \
) \
)
/**/
#else // !(BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC())
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_pred(r, state) \
BOOST_PP_SPLIT( \
0 \
, BOOST_PARAMETER_AUX_PP_FOR_EACH_pred_aux0( \
BOOST_PP_TUPLE_ELEM(5, 3, state) \
, BOOST_PP_TUPLE_ELEM(5, 0, state) \
) \
)
/**/
#endif // BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/tuple/eat.hpp>
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_op(r, state) \
( \
BOOST_PP_TUPLE_EAT(BOOST_PP_TUPLE_ELEM(5, 3, state)) \
BOOST_PP_TUPLE_ELEM(5, 0, state) \
, BOOST_PP_TUPLE_ELEM(5, 1, state) \
, BOOST_PP_TUPLE_ELEM(5, 2, state) \
, BOOST_PP_TUPLE_ELEM(5, 3, state) \
, BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(5, 4, state)) \
)
/**/
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_macro(r, state) \
BOOST_PP_TUPLE_ELEM(5, 2, state)( \
r \
, BOOST_PP_TUPLE_ELEM(5, 4, state) \
, BOOST_PARAMETER_AUX_PP_FOR_EACH_head( \
BOOST_PP_TUPLE_ELEM(5, 3, state) \
, BOOST_PP_TUPLE_ELEM(5, 0, state) \
) \
, BOOST_PP_TUPLE_ELEM(5, 1, state) \
)
/**/
#include <boost/preprocessor/punctuation/comma_if.hpp>
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_build_end_sentinel(z, n, text) \
BOOST_PP_COMMA_IF(n) BOOST_PARAMETER_AUX_PP_FOR_EACH_END_S
/**/
#include <boost/preprocessor/repetition/repeat.hpp>
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_build_end_sentinel_tuple(arity) \
( \
BOOST_PP_REPEAT( \
arity, BOOST_PARAMETER_AUX_PP_FOR_EACH_build_end_sentinel, _ \
) \
)
/**/
#include <boost/preprocessor/repetition/for.hpp>
#define BOOST_PARAMETER_AUX_PP_FOR_EACH_R(r, arity, list, data, macro) \
BOOST_PP_CAT(BOOST_PP_FOR_, r)( \
(list \
BOOST_PARAMETER_AUX_PP_FOR_EACH_build_end_sentinel_tuple(arity) \
, data \
, macro \
, arity \
, 0 \
) \
, BOOST_PARAMETER_AUX_PP_FOR_EACH_pred \
, BOOST_PARAMETER_AUX_PP_FOR_EACH_op \
, BOOST_PARAMETER_AUX_PP_FOR_EACH_macro \
)
/**/
#include <boost/preprocessor/repetition/deduce_r.hpp>
#define BOOST_PARAMETER_AUX_PP_FOR_EACH(arity, list, data, macro) \
BOOST_PARAMETER_AUX_PP_FOR_EACH_R( \
BOOST_PP_DEDUCE_R(), arity, list, data, macro \
)
/**/
#endif // include guard

View File

@@ -0,0 +1,509 @@
// Copyright Daniel Wallin 2006.
// Copyright Cromwell D. Enage 2017.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FORWARDING_OVERLOADS_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FORWARDING_OVERLOADS_HPP
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#include <boost/preprocessor/cat.hpp>
// Expands to a forwarding parameter for a constructor or forwarding function.
#define BOOST_PARAMETER_FUNCTION_ARG_TYPE_Z(z, n, type_prefix) \
BOOST_PP_CAT(type_prefix, n)&&
/**/
#include <utility>
// Expands to an argument passed from a forwarding function to the front-end
// implementation function, or from a constructor to its delegate.
#define BOOST_PARAMETER_FUNCTION_FORWARD_PARAM_Z(z, n, type_prefix) \
::std::forward<BOOST_PP_CAT(type_prefix, n)>(BOOST_PP_CAT(a, n))
/**/
#include <boost/parameter/aux_/preprocessor/impl/parenthesized_type.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
// Expands to the default constructor, whose job is to pass an empty back to
// the delegate constructor of the base class.
#define BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_0_Z(z, n, data) \
inline BOOST_PP_TUPLE_ELEM(2, 0, data)() \
: BOOST_PARAMETER_PARENTHESIZED_TYPE(BOOST_PP_TUPLE_ELEM(2, 1, data))( \
BOOST_PP_CAT(constructor_parameters, __LINE__)()() \
) \
{ \
}
/**/
#include <boost/parameter/aux_/pp_impl/argument_pack.hpp>
#include <boost/parameter/aux_/preprocessor/impl/function_name.hpp>
#include <boost/preprocessor/control/expr_if.hpp>
// Expands to a 0-arity forwarding function, whose job is to pass an empty
// pack to the front-end implementation function.
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_0_Z(z, n, data) \
BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(BOOST_PP_TUPLE_ELEM(4, 1, data)) \
inline BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, data) \
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
)< \
::boost::parameter::aux::argument_pack< \
BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, data) \
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
) \
>::type \
>::type \
BOOST_PARAMETER_MEMBER_FUNCTION_NAME(BOOST_PP_TUPLE_ELEM(3, 0, data))() \
BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(4, 3, data), const) \
{ \
return BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(4, 2, data), this->) \
BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, data) \
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
)( \
BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, data) \
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
)()() \
); \
}
/**/
#include <boost/parameter/aux_/preprocessor/impl/function_forward_match.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
// Expands to a forwarding function, whose job is to consolidate its arguments
// into a pack for the front-end implementation function to take in.
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_1_Z(z, n, data) \
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename ParameterArgumentType)> \
BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(BOOST_PP_TUPLE_ELEM(4, 1, data)) \
inline typename BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, data) \
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
)< \
typename ::boost::parameter::aux::argument_pack< \
BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, data) \
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
) \
, BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
n \
, BOOST_PARAMETER_FUNCTION_ARG_TYPE_Z \
, ParameterArgumentType \
) \
>::type \
>::type \
BOOST_PARAMETER_MEMBER_FUNCTION_NAME(BOOST_PP_TUPLE_ELEM(4, 0, data))( \
BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, ParameterArgumentType, && a) \
BOOST_PARAMETER_FUNCTION_FORWARD_MATCH_Z( \
z \
, BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, data) \
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
) \
, n \
, ParameterArgumentType \
) \
) BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(4, 3, data), const) \
{ \
return BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(4, 2, data), this->) \
BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, data) \
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
)( \
BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, data) \
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
)()( \
BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
n \
, BOOST_PARAMETER_FUNCTION_FORWARD_PARAM_Z \
, ParameterArgumentType \
) \
) \
); \
}
/**/
#include <boost/preprocessor/comparison/equal.hpp>
// Expands to a constructor whose job is to consolidate its arguments into a
// pack for the delegate constructor of the base class to take in.
#define BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_1_Z(z, n, data) \
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename ParameterArgumentType)> \
BOOST_PP_EXPR_IF(BOOST_PP_EQUAL(n, 1), explicit) \
inline BOOST_PP_TUPLE_ELEM(2, 0, data)( \
BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, ParameterArgumentType, && a) \
BOOST_PARAMETER_FUNCTION_FORWARD_MATCH_Z( \
z \
, BOOST_PP_CAT(constructor_parameters, __LINE__) \
, n \
, ParameterArgumentType \
) \
) : BOOST_PARAMETER_PARENTHESIZED_TYPE(BOOST_PP_TUPLE_ELEM(2, 1, data))( \
BOOST_PP_CAT(constructor_parameters, __LINE__)()( \
BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
n \
, BOOST_PARAMETER_FUNCTION_FORWARD_PARAM_Z \
, ParameterArgumentType \
) \
) \
) \
{ \
}
/**/
#include <boost/preprocessor/control/if.hpp>
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_Z(z, n, data) \
BOOST_PP_IF( \
n \
, BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_1_Z \
, BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_0_Z \
)(z, n, data)
/**/
#define BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_Z(z, n, data) \
BOOST_PP_IF( \
n \
, BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_1_Z \
, BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_0_Z \
)(z, n, data)
/**/
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
// Helper macro for BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS.
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX(nm, impl, r, is_m, c) \
BOOST_PP_REPEAT_FROM_TO( \
BOOST_PP_TUPLE_ELEM(2, 0, r) \
, BOOST_PP_TUPLE_ELEM(2, 1, r) \
, BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_Z \
, ( \
nm \
, impl \
, BOOST_PP_IF( \
BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(nm) \
, 0 \
, is_m \
) \
, c \
) \
)
/**/
// Helper macro for BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS.
#define BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS_AUX(class_, base, range) \
BOOST_PP_REPEAT_FROM_TO( \
BOOST_PP_TUPLE_ELEM(2, 0, range) \
, BOOST_PP_TUPLE_ELEM(2, 1, range) \
, BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_Z \
, (class_, base) \
)
/**/
#include <boost/parameter/aux_/preprocessor/impl/arity_range.hpp>
// Expands to the layer of forwarding functions for the function with the
// specified name, whose arguments determine the range of arities.
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, impl, a, is_m, c) \
BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX( \
name, impl, BOOST_PARAMETER_ARITY_RANGE(a), is_m, c \
)
/**/
// Expands to the layer of forwarding functions for the constructor in the
// specified class, whose arguments determine the range of arities.
#define BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS(class_, base, args) \
BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS_AUX( \
class_, base, BOOST_PARAMETER_ARITY_RANGE(args) \
)
/**/
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#include <boost/parameter/aux_/preprocessor/impl/parenthesized_type.hpp>
#include <boost/preprocessor/seq/seq.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#include <boost/preprocessor/cat.hpp>
// Expands to the default constructor, whose job is to pass an empty argument
// pack back to the delegate constructor of the base class.
#define BOOST_PARAMETER_DEFAULT_CONSTRUCTOR(z, n, seq) \
inline \
BOOST_PP_TUPLE_ELEM(2, 0, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)))() \
: BOOST_PARAMETER_PARENTHESIZED_TYPE( \
BOOST_PP_TUPLE_ELEM( \
2, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
) \
)(BOOST_PP_CAT(constructor_parameters, __LINE__)()()) \
{ \
}
/**/
#include <boost/parameter/aux_/pp_impl/argument_pack.hpp>
#include <boost/parameter/aux_/preprocessor/impl/function_name.hpp>
#include <boost/preprocessor/control/expr_if.hpp>
// Expands to a 0-arity forwarding function, whose job is to pass an empty
// argument pack to the front-end implementation function.
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_0_ARITY(z, n, seq) \
BOOST_PARAMETER_MEMBER_FUNCTION_STATIC( \
BOOST_PP_TUPLE_ELEM( \
4, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
) \
) \
inline BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
BOOST_PP_TUPLE_ELEM( \
4, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
) \
, BOOST_PP_TUPLE_ELEM( \
4, 3, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
) \
)< \
::boost::parameter::aux::argument_pack< \
BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
BOOST_PP_TUPLE_ELEM( \
4, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
) \
, BOOST_PP_TUPLE_ELEM( \
4, 3, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
) \
) \
>::type \
>::type \
BOOST_PARAMETER_MEMBER_FUNCTION_NAME( \
BOOST_PP_TUPLE_ELEM( \
4, 0, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
) \
)() BOOST_PP_EXPR_IF( \
BOOST_PP_TUPLE_ELEM( \
4, 3, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
) \
, const \
) \
{ \
return BOOST_PP_EXPR_IF( \
BOOST_PP_TUPLE_ELEM( \
4, 2, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
) \
, this-> \
) BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
BOOST_PP_TUPLE_ELEM( \
4, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
) \
, BOOST_PP_TUPLE_ELEM( \
4, 3, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
) \
)( \
BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
BOOST_PP_TUPLE_ELEM( \
4, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
) \
, BOOST_PP_TUPLE_ELEM( \
4, 3, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
) \
)()() \
); \
}
/**/
#include <boost/parameter/aux_/preprocessor/binary_seq_to_args.hpp>
#include <boost/parameter/aux_/preprocessor/impl/function_forward_match.hpp>
#include <boost/preprocessor/comparison/equal.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/seq/size.hpp>
// Expands to a constructor whose job is to consolidate its arguments into a
// pack for the delegate constructor of the base class to take in. Each
// element in BOOST_PP_SEQ_TAIL(seq) determines the const-ness of the
// corresponding argument.
#define BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_R(r, seq) \
template < \
BOOST_PP_ENUM_PARAMS( \
BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)) \
, typename ParameterArgumentType \
) \
> \
BOOST_PP_EXPR_IF( \
BOOST_PP_EQUAL(BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)), 1) \
, explicit \
) \
inline BOOST_PP_TUPLE_ELEM(2, 0, BOOST_PP_SEQ_HEAD(seq))( \
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS( \
BOOST_PP_SEQ_TAIL(seq), (ParameterArgumentType)(a) \
) \
BOOST_PARAMETER_FUNCTION_FORWARD_MATCH( \
BOOST_PP_CAT(constructor_parameters, __LINE__) \
, BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)) \
, ParameterArgumentType \
) \
) : BOOST_PARAMETER_PARENTHESIZED_TYPE( \
BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PP_SEQ_HEAD(seq)) \
)( \
BOOST_PP_CAT(constructor_parameters, __LINE__)()( \
BOOST_PP_ENUM_PARAMS( \
BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)), a \
) \
) \
) \
{ \
}
/**/
// Expands to a forwarding function, whose job is to consolidate its arguments
// into a pack for the front-end implementation function to take in. Each
// element in BOOST_PP_SEQ_TAIL(seq) determines the const-ness of the
// corresponding argument.
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_R(r, seq) \
template < \
BOOST_PP_ENUM_PARAMS( \
BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)) \
, typename ParameterArgumentType \
) \
> \
BOOST_PARAMETER_MEMBER_FUNCTION_STATIC( \
BOOST_PP_TUPLE_ELEM(4, 1, BOOST_PP_SEQ_HEAD(seq)) \
) \
inline typename BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, BOOST_PP_SEQ_HEAD(seq)) \
, BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_HEAD(seq)) \
)< \
typename ::boost::parameter::aux::argument_pack< \
BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, BOOST_PP_SEQ_HEAD(seq)) \
, BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_HEAD(seq)) \
) \
, BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS( \
BOOST_PP_SEQ_TAIL(seq), (ParameterArgumentType) \
) \
>::type \
>::type \
BOOST_PARAMETER_MEMBER_FUNCTION_NAME( \
BOOST_PP_TUPLE_ELEM(4, 0, BOOST_PP_SEQ_HEAD(seq)) \
)( \
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS( \
BOOST_PP_SEQ_TAIL(seq), (ParameterArgumentType)(a) \
) \
BOOST_PARAMETER_FUNCTION_FORWARD_MATCH( \
BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, BOOST_PP_SEQ_HEAD(seq)) \
, BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_HEAD(seq)) \
) \
, BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)) \
, ParameterArgumentType \
) \
) BOOST_PP_EXPR_IF( \
BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_HEAD(seq)), const \
) \
{ \
return BOOST_PP_EXPR_IF( \
BOOST_PP_TUPLE_ELEM(4, 2, BOOST_PP_SEQ_HEAD(seq)) \
, this-> \
) BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, BOOST_PP_SEQ_HEAD(seq)) \
, BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_HEAD(seq)) \
)( \
BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, BOOST_PP_SEQ_HEAD(seq)) \
, BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_HEAD(seq)) \
)()( \
BOOST_PP_ENUM_PARAMS( \
BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)), a \
) \
) \
); \
}
/**/
#include <boost/parameter/aux_/preprocessor/binary_seq_for_each.hpp>
#include <boost/preprocessor/control/if.hpp>
// Expands to all constructors that take in n arguments. Enables
// BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS_AUX to use
// BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_Z within BOOST_PP_REPEAT_FROM_TO.
#define BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_Z(z, n, data) \
BOOST_PP_IF( \
n \
, BOOST_PARAMETER_AUX_PP_BINARY_SEQ_FOR_EACH_Z \
, BOOST_PARAMETER_DEFAULT_CONSTRUCTOR \
)(z, n, (BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_R)(data))
/**/
// Expands to all forwarding functions that take in n arguments. Enables
// BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX to use
// BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_Z within BOOST_PP_REPEAT_FROM_TO.
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_Z(z, n, data) \
BOOST_PP_IF( \
n \
, BOOST_PARAMETER_AUX_PP_BINARY_SEQ_FOR_EACH_Z \
, BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_0_ARITY \
)(z, n, (BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_R)(data))
/**/
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
// Helper macro for BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS.
#define BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS_AUX(class_, base, range) \
BOOST_PP_REPEAT_FROM_TO( \
BOOST_PP_TUPLE_ELEM(2, 0, range) \
, BOOST_PP_TUPLE_ELEM(2, 1, range) \
, BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_Z \
, (class_, base) \
)
/**/
// Helper macro for BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS.
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX(nm, impl, r, is_m, c) \
BOOST_PP_REPEAT_FROM_TO( \
BOOST_PP_TUPLE_ELEM(2, 0, r) \
, BOOST_PP_TUPLE_ELEM(2, 1, r) \
, BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_Z \
, ( \
nm \
, impl \
, BOOST_PP_IF( \
BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(impl) \
, 0 \
, is_m \
) \
, c \
) \
)
/**/
#include <boost/parameter/aux_/preprocessor/impl/arity_range.hpp>
// Expands to the layer of forwarding functions for the constructor in the
// specified class, whose arguments determine the range of arities.
#define BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS(class_, base, args) \
BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS_AUX( \
class_ \
, base \
, BOOST_PARAMETER_ARITY_RANGE(args) \
)
/**/
// Expands to the layer of forwarding functions for the function with the
// specified name, whose arguments determine the range of arities.
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, impl, a, is_m, c) \
BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX( \
name \
, impl \
, BOOST_PARAMETER_ARITY_RANGE(a) \
, is_m \
, c \
)
/**/
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
#endif // include guard

View File

@@ -0,0 +1,730 @@
// Copyright Daniel Wallin 2006.
// Copyright Cromwell D. Enage 2017.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_CAST_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_CAST_HPP
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
namespace boost { namespace parameter { namespace aux {
// Handles possible implicit casts. Used by preprocessor.hpp
// to normalize user input.
//
// cast<void*>::execute() is identity
// cast<void*(X)>::execute() is identity
// cast<void(X)>::execute() casts to X
//
// preprocessor.hpp uses this like this:
//
// #define X(value, predicate)
// cast<void predicate>::execute(value)
//
// X(something, *)
// X(something, *(predicate))
// X(something, (int))
template <typename VoidExpr, typename Args>
struct cast;
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/use_default_tag.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename T, typename B>
inline ::boost::parameter::aux::use_default_tag
forward(::boost::parameter::aux::use_default_tag)
{
return ::boost::parameter::aux::use_default_tag();
}
}}} // namespace boost::parameter::aux
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#include <boost/mp11/utility.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename Args>
struct cast<void*,Args>
{
template <typename T, typename B>
struct apply
{
typedef typename ::boost::mpl
::if_<B,T,::boost::mpl::true_>::type type;
};
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <typename T, typename B>
using fn = ::boost::mp11::mp_if<B,T,::boost::mp11::mp_true>;
#endif
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/void.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Predicate, typename Args>
struct cast<void*(Predicate),Args>
: ::boost::parameter::aux::cast<void*,Args>
{
};
}}} // namespace boost::parameter::aux
#include <boost/mpl/placeholders.hpp>
namespace boost { namespace parameter { namespace aux {
// This is a hack used in cast<> to turn the user supplied type,
// which may or may not be a placeholder expression, into one,
// so that it will be properly evaluated by mpl::apply.
template <typename T, typename Dummy = ::boost::mpl::_1>
struct as_placeholder_expr
{
typedef T type;
};
}}} // namespace boost::parameter::aux
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/list.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Target, typename Source, typename Args>
struct apply_target_fn
{
using type = ::boost::mp11
::mp_apply_q<Target,::boost::mp11::mp_list<Source,Args> >;
};
}}} // namespace boost::parameter::aux
#endif
#include <boost/mpl/apply.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/parameter/aux_/has_nested_template_fn.hpp>
#include <type_traits>
#else
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename Target, typename Source, typename Args>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using is_target_same_as_source = ::std::is_same<
typename ::std::remove_const<
typename ::std::remove_reference<
typename ::boost::mp11::mp_if<
::boost::parameter::aux::has_nested_template_fn<Target>
, ::boost::parameter::aux
::apply_target_fn<Target,Source,Args>
, ::boost::mpl::apply2<
::boost::parameter::aux::as_placeholder_expr<Target>
, Source
, Args
>
>::type
>::type
>::type
, typename ::std::remove_const<Source>::type
>;
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
struct is_target_same_as_source
: ::boost::mpl::if_<
::boost::is_same<
typename ::boost::remove_const<
typename ::boost::remove_reference<
typename ::boost::mpl::apply2<
::boost::parameter::aux
::as_placeholder_expr<Target>
, Source
, Args
>::type
>::type
>::type
, typename ::boost::remove_const<Source>::type
>
, ::boost::mpl::true_
, ::boost::mpl::false_
>::type
{
};
#endif // BOOST_PARAMETER_CAN_USE_MP11
}}} // namespace boost::parameter::aux
#if !defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/is_const.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
// Covers the case where is_convertible<Source,Target> but not
// is_same<Source,Target>. Use cases are covered
// by test/normalize_argument_types.cpp
template <typename Source, typename Target>
class cast_convert
{
typedef ::boost::parameter::aux::cast_convert<Source,Target> _self;
public:
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using type = typename ::boost::mp11::mp_if<
::std::is_const<Source>
, ::std::add_const<Target>
, ::std::remove_const<Target>
>::type;
#else
typedef typename boost::mpl::eval_if<
::boost::is_const<Source>
, ::boost::add_const<Target>
, ::boost::remove_const<Target>
>::type type;
#endif
private:
inline static typename _self::type
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
_copy(typename ::std::remove_const<Target>::type value)
#else
_copy(typename ::boost::remove_const<Target>::type value)
#endif
{
return value;
}
public:
inline static typename _self::type evaluate(Source&& source)
{
return _self::_copy(source);
}
};
template <typename Target, typename Source, typename Args>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using cast_impl = ::std::remove_reference<
typename ::boost::mp11::mp_if<
::boost::parameter::aux::has_nested_template_fn<Target>
, ::boost::parameter::aux
::is_target_same_as_source<Target,Source,Args>
, ::boost::mpl::apply2<
::boost::parameter::aux::as_placeholder_expr<Target>
, Source
, Args
>
>::type
>;
#else
struct cast_impl
: ::boost::remove_reference<
typename ::boost::mpl::apply2<
::boost::parameter::aux::as_placeholder_expr<Target>
, Source
, Args
>::type
>
{
};
#endif // BOOST_PARAMETER_CAN_USE_MP11
}}} // namespace boost::parameter::aux
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Target, typename Args>
struct cast<void(Target),Args>
{
template <typename T, typename B>
struct apply
{
typedef typename ::boost::mpl::eval_if<
B
, ::boost::mpl::eval_if<
::boost::parameter::aux
::is_target_same_as_source<Target,T,Args>
, ::boost::mpl::identity<T>
, ::boost::parameter::aux::cast_impl<Target,T,Args>
>
, ::boost::parameter::aux
::is_target_same_as_source<Target,T,Args>
>::type type;
};
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <typename T, typename B>
using fn = typename ::boost::mp11::mp_if<
B
, ::boost::mp11::mp_if<
::boost::parameter::aux
::is_target_same_as_source<Target,T,Args>
, ::boost::mp11::mp_identity<T>
, ::boost::parameter::aux::cast_impl<Target,T,Args>
>
, ::boost::parameter::aux
::is_target_same_as_source<Target,T,Args>
>::type;
#endif
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/value_type.hpp>
#if !defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mpl/apply_wrap.hpp>
#endif
// Expands to the target type of the argument as indicated by the predicate.
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#define BOOST_PARAMETER_FUNCTION_CAST_T(tag, predicate, args) \
::boost::mp11::mp_apply_q< \
::boost::parameter::aux::cast<void predicate, args> \
, ::boost::mp11::mp_list< \
typename ::boost::parameter::value_type< \
args \
, tag \
, ::boost::parameter::aux::use_default_tag \
>::type \
, ::boost::mp11::mp_true \
> \
>
/**/
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
#define BOOST_PARAMETER_FUNCTION_CAST_T(tag, predicate, args) \
typename ::boost::mpl::apply_wrap2< \
::boost::parameter::aux::cast<void predicate, args> \
, typename ::boost::parameter::value_type< \
args \
, tag \
, ::boost::parameter::aux::use_default_tag \
>::type \
, ::boost::mpl::true_ \
>::type
/**/
#endif // BOOST_PARAMETER_CAN_USE_MP11
// Expands to boost::mpl::true_ if and only if the argument's source and
// target types are the same.
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#define BOOST_PARAMETER_FUNCTION_CAST_B(tag, predicate, args) \
::boost::mp11::mp_apply_q< \
::boost::parameter::aux::cast<void predicate, args> \
, ::boost::mp11::mp_list< \
typename ::boost::parameter::value_type< \
args \
, tag \
, ::boost::parameter::aux::use_default_tag \
>::type \
, ::boost::mp11::mp_false \
> \
>
/**/
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
#define BOOST_PARAMETER_FUNCTION_CAST_B(tag, predicate, args) \
typename ::boost::mpl::apply_wrap2< \
::boost::parameter::aux::cast<void predicate, args> \
, typename ::boost::parameter::value_type< \
args \
, tag \
, ::boost::parameter::aux::use_default_tag \
>::type \
, ::boost::mpl::false_ \
>::type
/**/
#endif // BOOST_PARAMETER_CAN_USE_MP11
#include <boost/core/enable_if.hpp>
#include <utility>
namespace boost { namespace parameter { namespace aux {
// If the source and target types are not the same,
// then perform an implicit conversion.
template <typename Target, typename B, typename Source>
inline typename ::boost::lazy_disable_if<
B
, ::boost::parameter::aux::cast_convert<Source,Target>
>::type
forward(Source&& source)
{
return ::boost::parameter::aux::cast_convert<Source,Target>
::evaluate(::std::forward<Source>(source));
}
// If the source and target types are the same,
// then simply forward the argument.
// However, treat rvalue references to scalars as const lvalue references.
template <typename T, typename B>
inline typename ::boost::enable_if<B,T const&>::type forward(T const& t)
{
return t;
}
template <typename T, typename B>
inline typename ::boost::enable_if<
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
::boost::mp11::mp_if<
B
, ::boost::mp11::mp_if<
::std::is_const<T>
, ::boost::mp11::mp_false
, ::boost::mp11::mp_true
>
, ::boost::mp11::mp_false
>
#else
typename ::boost::mpl::eval_if<
B
, ::boost::mpl::if_<
::boost::is_const<T>
, ::boost::mpl::false_
, ::boost::mpl::true_
>
, ::boost::mpl::false_
>::type
#endif // BOOST_PARAMETER_CAN_USE_MP11
, T&
>::type
forward(T& t)
{
return t;
}
}}} // namespace boost::parameter::aux
#include <boost/type_traits/is_scalar.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename T, typename B>
inline typename ::boost::enable_if<
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
::boost::mp11::mp_if<
B
, ::boost::mp11::mp_if<
::std::is_scalar<T>
, ::boost::mp11::mp_false
, ::boost::mp11::mp_true
>
, ::boost::mp11::mp_false
>
#else
typename ::boost::mpl::eval_if<
B
, ::boost::mpl::if_<
::boost::is_scalar<T>
, ::boost::mpl::false_
, ::boost::mpl::true_
>
, ::boost::mpl::false_
>::type
#endif // BOOST_PARAMETER_CAN_USE_MP11
, T const&&
>::type
forward(T const&& t)
{
return static_cast<T const&&>(t);
}
template <typename T, typename B>
inline typename ::boost::enable_if<
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
::boost::mp11::mp_if<
B
, ::boost::mp11::mp_if<
::std::is_scalar<T>
, ::boost::mp11::mp_false
, ::boost::mp11::mp_true
>
, ::boost::mp11::mp_false
>
#else
typename ::boost::mpl::eval_if<
B
, ::boost::mpl::if_<
::boost::is_scalar<T>
, ::boost::mpl::false_
, ::boost::mpl::true_
>
, ::boost::mpl::false_
>::type
#endif // BOOST_PARAMETER_CAN_USE_MP11
, T&&
>::type
forward(T&& t)
{
return ::std::forward<T>(t);
}
}}} // namespace boost::parameter::aux
#elif BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
#define BOOST_PARAMETER_FUNCTION_CAST_T(value_t, predicate, args) value_t
#define BOOST_PARAMETER_FUNCTION_CAST_B(value, predicate, args) value
#else // no perfect forwarding support and no Borland workarounds needed
namespace boost { namespace parameter { namespace aux {
// Handles possible implicit casts. Used by preprocessor.hpp
// to normalize user input.
//
// cast<void*>::execute() is identity
// cast<void*(X)>::execute() is identity
// cast<void(X)>::execute() casts to X
//
// preprocessor.hpp uses this like this:
//
// #define X(value, predicate)
// cast<void predicate>::execute(value)
//
// X(something, *)
// X(something, *(predicate))
// X(something, (int))
template <typename VoidExpr, typename Args>
struct cast;
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/use_default_tag.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Args>
struct cast<void*,Args>
{
template <typename T>
struct apply
{
typedef T& type;
};
inline static ::boost::parameter::aux::use_default_tag
execute(::boost::parameter::aux::use_default_tag)
{
return ::boost::parameter::aux::use_default_tag();
}
template <typename U>
inline static U& execute(U& value)
{
return value;
}
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/void.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Predicate, typename Args>
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
struct cast< ::boost::parameter::aux::voidstar(Predicate),Args>
#else
struct cast<void*(Predicate),Args>
#endif
: ::boost::parameter::aux::cast<void*,Args>
{
};
}}} // namespace boost::parameter::aux
#include <boost/mpl/placeholders.hpp>
namespace boost { namespace parameter { namespace aux {
// This is a hack used in cast<> to turn the user supplied type,
// which may or may not be a placeholder expression, into one,
// so that it will be properly evaluated by mpl::apply.
template <typename T, typename Dummy = ::boost::mpl::_1>
struct as_placeholder_expr
{
typedef T type;
};
}}} // namespace boost::parameter::aux
#include <boost/mpl/apply.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Target, typename Source, typename Args>
struct is_target_same_as_source
: ::boost::mpl::if_<
::boost::is_same<
typename ::boost::remove_const<
typename ::boost::remove_reference<
typename ::boost::mpl::apply2<
::boost::parameter::aux
::as_placeholder_expr<Target>
, Source
, Args
>::type
>::type
>::type
, typename ::boost::remove_const<Source>::type
>
, ::boost::mpl::true_
, ::boost::mpl::false_
>::type
{
};
template <
typename Target
, typename Source
, typename Args
, typename Enable = ::boost::parameter::aux
::is_target_same_as_source<Target,Source,Args>
>
struct cast_impl
{
typedef Source& type;
inline static Source& evaluate(Source& value)
{
return value;
}
};
}}} // namespace boost::parameter::aux
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_lvalue_reference.hpp>
namespace boost { namespace parameter { namespace aux {
// Covers the case where is_convertible<Source,Target> but not
// is_same<Source,Target>. Use cases are covered
// by test/normalize_argument_types.cpp
template <typename Source, typename Target>
class cast_convert
{
typedef ::boost::parameter::aux::cast_convert<Source,Target> _self;
public:
typedef typename ::boost::add_lvalue_reference<
typename ::boost::add_const<Target>::type
>::type type;
private:
template <typename U>
inline static typename _self::type _mod_const(U const& u)
{
return u;
}
inline static Target _copy(Target value)
{
return value;
}
public:
inline static typename _self::type evaluate(Source& source)
{
return _self::_mod_const(_self::_copy(source));
}
};
template <typename Target, typename Source, typename Args>
struct cast_impl<Target,Source,Args,::boost::mpl::false_>
: ::boost::parameter::aux::cast_convert<
Source,
typename ::boost::mpl::apply2<
::boost::parameter::aux::as_placeholder_expr<Target>
, Source
, Args
>::type
>
{
};
}}} // namespace boost::parameter::aux
#include <boost/mpl/eval_if.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Target, typename Args>
struct cast<void(Target),Args>
{
template <typename T>
struct apply
{
typedef typename ::boost::mpl::eval_if<
::boost::parameter::aux
::is_target_same_as_source<Target,T,Args>
, ::boost::add_lvalue_reference<T>
, ::boost::parameter::aux::cast_impl<
Target
, T
, Args
, ::boost::mpl::false_
>
>::type type;
};
inline static ::boost::parameter::aux::use_default_tag
execute(::boost::parameter::aux::use_default_tag)
{
return ::boost::parameter::aux::use_default_tag();
}
template <typename U>
inline static typename ::boost::parameter::aux
::cast_impl<Target,U const,Args>::type
execute(U const& value)
{
return ::boost::parameter::aux
::cast_impl<Target,U const,Args>::evaluate(value);
}
template <typename U>
inline static typename ::boost::parameter::aux
::cast_impl<Target,U,Args>::type
execute(U& value)
{
return ::boost::parameter::aux
::cast_impl<Target,U,Args>::evaluate(value);
}
};
}}} // namespace boost::parameter::aux
#include <boost/mpl/apply_wrap.hpp>
#include <boost/parameter/value_type.hpp>
// Expands to the reference-qualified target type of the argument
// as indicated by the predicate.
#define BOOST_PARAMETER_FUNCTION_CAST_T(tag, predicate, args) \
typename ::boost::mpl::apply_wrap1< \
::boost::parameter::aux::cast<void predicate, args> \
, typename ::boost::parameter::value_type< \
args \
, tag \
, ::boost::parameter::aux::use_default_tag \
>::type \
>::type
/**/
// Expands to the converted or passed-through value
// as indicated by the predicate.
#define BOOST_PARAMETER_FUNCTION_CAST_B(value, predicate, args) \
::boost::parameter::aux::cast<void predicate, args>::execute(value)
/**/
#endif // perfect forwarding support, or Borland workarounds needed
#endif // include guard

View File

@@ -0,0 +1,474 @@
// Copyright Daniel Wallin 2006.
// Copyright Cromwell D. Enage 2017.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_DISPATCH_LAYER_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_DISPATCH_LAYER_HPP
#include <boost/preprocessor/cat.hpp>
// Expands to keyword_tag_type for some keyword_tag.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_TYPE(keyword_tag) \
BOOST_PP_CAT(keyword_tag, _type)
/**/
// Expands to a template parameter for each dispatch function.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_TEMPLATE_ARG(r, macro, arg) \
, typename BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_TYPE(macro(arg))
/**/
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
// Expands to a forwarding parameter for a dispatch function.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_DEFN(r, macro, arg) \
, BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_TYPE(macro(arg))&& macro(arg)
/**/
#include <utility>
// Expands to an argument passed from one dispatch function to the next.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_FWD(r, macro, arg) \
, ::std::forward< \
BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_TYPE(macro(arg)) \
>(macro(arg))
/**/
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
// Expands to a forwarding parameter for a dispatch function. The parameter
// type stores its const-ness.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_DEFN(r, macro, arg) \
, BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_TYPE(macro(arg))& macro(arg)
/**/
#include <boost/parameter/aux_/as_lvalue.hpp>
// Expands to an argument passed from one dispatch function to the next.
// Explicit forwarding takes the form of forcing the argument to be an lvalue.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_FWD(r, macro, arg) \
, ::boost::parameter::aux::as_lvalue(macro(arg))
/**/
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
#include <boost/parameter/aux_/preprocessor/impl/argument_specs.hpp>
#include <boost/parameter/aux_/preprocessor/impl/split_args.hpp>
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/seq/first_n.hpp>
// Iterates through all required arguments and the first n optional arguments,
// passing each argument to the specified macro.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT(macro, n, split_args) \
BOOST_PP_SEQ_FOR_EACH( \
macro \
, BOOST_PARAMETER_FN_ARG_NAME \
, BOOST_PARAMETER_SPLIT_ARG_REQ_SEQ(split_args) \
) \
BOOST_PP_SEQ_FOR_EACH( \
macro \
, BOOST_PARAMETER_FN_ARG_NAME \
, BOOST_PP_SEQ_FIRST_N( \
n, BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(split_args) \
) \
)
/**/
#include <boost/parameter/aux_/preprocessor/impl/function_dispatch_tuple.hpp>
#include <boost/parameter/aux_/preprocessor/impl/function_name.hpp>
#include <boost/preprocessor/control/if.hpp>
// Produces a name for the dispatch functions.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, n) \
BOOST_PP_CAT( \
BOOST_PP_CAT( \
BOOST_PP_IF( \
BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x) \
, boost_param_dispatch_const_ \
, boost_param_dispatch_ \
) \
, BOOST_PP_CAT(BOOST_PP_CAT(n, boost_), __LINE__) \
) \
, BOOST_PARAMETER_MEMBER_FUNCTION_NAME( \
BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
) \
)
/**/
// Expands to the template parameter list of the dispatch function with all
// required and first n optional parameters; also extracts the static keyword
// if present.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
template < \
typename ResultType, typename Args \
BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT( \
BOOST_PARAMETER_FUNCTION_DISPATCH_TEMPLATE_ARG \
, n \
, BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
) \
> BOOST_PARAMETER_MEMBER_FUNCTION_STATIC( \
BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
)
/**/
#include <boost/parameter/aux_/use_default_tag.hpp>
#include <boost/preprocessor/control/expr_if.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
// Expands to the result type, name, parenthesized list of all required and
// n optional parameters, and const-ness of the dispatch function; the bit
// value b determines whether or not this dispatch function takes in
// boost::parameter::aux::use_default_tag as its last parameter.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, b1, b2) \
ResultType BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, b1)( \
ResultType(*)(), Args const& args, long \
BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT( \
BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_DEFN \
, n \
, BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
) \
BOOST_PP_COMMA_IF(b2) \
BOOST_PP_EXPR_IF(b2, ::boost::parameter::aux::use_default_tag) \
) BOOST_PP_EXPR_IF(BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x), const)
/**/
// Expands to a forward declaration of the dispatch function that takes in
// all required and the first n optional parameters, but not
// boost::parameter::aux::use_default_tag.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_FWD_DECL_0_Z(z, n, x) \
BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 0, 0);
/**/
// Expands to a forward declaration of the dispatch function that takes in
// all required parameters, the first n optional parameters, and
// boost::parameter::aux::use_default_tag.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_FWD_DECL_1_Z(z, n, x) \
BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 0, 1);
/**/
#include <boost/preprocessor/seq/elem.hpp>
// Expands to the default value of the (n + 1)th optional parameter.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_DEFAULT_AUX(n, s_args) \
BOOST_PARAMETER_FN_ARG_DEFAULT( \
BOOST_PP_SEQ_ELEM(n, BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(s_args)) \
)
/**/
#include <boost/parameter/keyword.hpp>
// Expands to the assignment portion which binds the default value to the
// (n + 1)th optional parameter before composing it with the argument-pack
// parameter passed in to the n-th dispatch function.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_DEFAULT(n, s_args, tag_ns) \
::boost::parameter::keyword< \
tag_ns::BOOST_PARAMETER_FN_ARG_NAME( \
BOOST_PP_SEQ_ELEM(n, BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(s_args)) \
) \
>::instance = BOOST_PARAMETER_FUNCTION_DISPATCH_DEFAULT_AUX(n, s_args)
/**/
#include <boost/parameter/aux_/preprocessor/impl/function_cast.hpp>
// Takes in the arg tuple (name, pred) and the tag namespace.
// Extracts the corresponding required argument from the pack.
// This form enables BOOST_PARAMETER_FUNCTION_DISPATCH_LAYER to use it
// from within BOOST_PP_SEQ_FOR_EACH.
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
// The boost::parameter::aux::forward wrapper is necessary to transmit the
// target type to the next dispatch function. Otherwise, the argument will
// retain its original type. -- Cromwell D. Enage
#define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_CAST_R(r, tag_ns, arg) \
, ::boost::parameter::aux::forward< \
BOOST_PARAMETER_FUNCTION_CAST_T( \
tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
, BOOST_PARAMETER_FN_ARG_PRED(arg) \
, Args \
) \
, BOOST_PARAMETER_FUNCTION_CAST_B( \
tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
, BOOST_PARAMETER_FN_ARG_PRED(arg) \
, Args \
) \
>( \
args[ \
::boost::parameter::keyword< \
tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
>::instance \
] \
)
/**/
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
// The explicit type cast is necessary to transmit the target type to the next
// dispatch function. Otherwise, the argument will retain its original type.
// -- Cromwell D. Enage
#define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_CAST_R(r, tag_ns, arg) \
, BOOST_PARAMETER_FUNCTION_CAST_T( \
tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
, BOOST_PARAMETER_FN_ARG_PRED(arg) \
, Args \
)( \
args[ \
::boost::parameter::keyword< \
tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
>::instance \
] \
)
/**/
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
// Takes in the arg tuple (name, pred, default) and the tag namespace.
// Extracts the corresponding optional argument from the pack if specified,
// otherwise temporarily passes use_default_tag() to the dispatch functions.
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
// The boost::parameter::aux::forward wrapper is necessary to transmit the
// target type to the next dispatch function. Otherwise, the argument will
// retain its original type. -- Cromwell D. Enage
#define BOOST_PARAMETER_FUNCTION_DISPATCH_OPT_ARG_CAST(arg, tag_ns) \
::boost::parameter::aux::forward< \
BOOST_PARAMETER_FUNCTION_CAST_T( \
tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
, BOOST_PARAMETER_FN_ARG_PRED(arg) \
, Args \
) \
, BOOST_PARAMETER_FUNCTION_CAST_B( \
tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
, BOOST_PARAMETER_FN_ARG_PRED(arg) \
, Args \
) \
>( \
args[ \
::boost::parameter::keyword< \
tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
>::instance || ::boost::parameter::aux::use_default_tag() \
] \
)
/**/
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#define BOOST_PARAMETER_FUNCTION_DISPATCH_OPT_ARG_CAST(arg, tag_ns) \
BOOST_PARAMETER_FUNCTION_CAST_B( \
args[ \
::boost::parameter::keyword< \
tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
>::instance || ::boost::parameter::aux::use_default_tag() \
] \
, BOOST_PARAMETER_FN_ARG_PRED(arg) \
, Args \
)
/**/
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
#include <boost/parameter/aux_/preprocessor/nullptr.hpp>
// Expands to three dispatch functions that take in all required parameters
// and the first n optional parameters. The third dispatch function bears
// the same name as the first but takes in use_default_tag as the last
// parameter. The second dispatch function bears a different name from the
// other two.
//
// x is a tuple:
//
// (name, split_args, is_const, tag_namespace)
//
// Where name is the base name of the functions, and split_args is a tuple:
//
// (required_count, required_args, optional_count, required_args)
//
// The first dispatch function queries args if it has bound the (n + 1)th
// optional parameter to a user-defined argument. If so, then it forwards
// its own arguments followed by the user-defined argument to the dispatch
// function that takes in all required parameters and the first (n + 1)
// optional parameters, but not use_default_tag. Otherwise, it forwards
// its own arguments to the third dispatch function.
//
// The third dispatch function appends the default value of the (n + 1)th
// optional parameter to its copy of args. Then it forwards this copy, all
// required parameters, and the first n (not n + 1) optional parameters to
// the second dispatch function.
//
// The second dispatch function forwards its arguments, then the (n + 1)th
// optional parameter that it extracts from args, to the other-named dispatch
// function that takes in all required parameters and the first (n + 1)
// optional parameters, but not use_default_tag.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_OVERLOAD_Z(z, n, x) \
BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
inline BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 0, 0) \
{ \
return BOOST_PP_EXPR_IF( \
BOOST_PARAMETER_FUNCTION_DISPATCH_IS_MEMBER(x) \
, this-> \
) BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, 0)( \
static_cast<ResultType(*)()>(BOOST_PARAMETER_AUX_PP_NULLPTR) \
, args \
, 0L \
BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT( \
BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_FWD \
, n \
, BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
) \
, BOOST_PARAMETER_FUNCTION_DISPATCH_OPT_ARG_CAST( \
BOOST_PP_SEQ_ELEM( \
n \
, BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ( \
BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
) \
) \
, BOOST_PARAMETER_FUNCTION_DISPATCH_TAG_NAMESPACE(x) \
) \
); \
} \
BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
inline BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 1, 0) \
{ \
return BOOST_PP_EXPR_IF( \
BOOST_PARAMETER_FUNCTION_DISPATCH_IS_MEMBER(x) \
, this-> \
) BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, 0)( \
static_cast<ResultType(*)()>(BOOST_PARAMETER_AUX_PP_NULLPTR) \
, args \
, 0L \
BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT( \
BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_FWD \
, n \
, BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
) \
, args[ \
::boost::parameter::keyword< \
BOOST_PARAMETER_FUNCTION_DISPATCH_TAG_NAMESPACE(x):: \
BOOST_PARAMETER_FN_ARG_NAME( \
BOOST_PP_SEQ_ELEM( \
n \
, BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ( \
BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
) \
) \
) \
>::instance \
] \
); \
} \
BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
inline BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 0, 1) \
{ \
return BOOST_PP_EXPR_IF( \
BOOST_PARAMETER_FUNCTION_DISPATCH_IS_MEMBER(x) \
, this-> \
) BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, 1)( \
static_cast<ResultType(*)()>(BOOST_PARAMETER_AUX_PP_NULLPTR) \
, (args \
, BOOST_PARAMETER_FUNCTION_DISPATCH_DEFAULT( \
n \
, BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
, BOOST_PARAMETER_FUNCTION_DISPATCH_TAG_NAMESPACE(x) \
) \
) \
, 0L \
BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT( \
BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_FWD \
, n \
, BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
) \
); \
}
/**/
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/preprocessor/tuple/eat.hpp>
// x is a tuple:
//
// (base_name, split_args, is_member, is_const, tag_namespace)
//
// Generates all dispatch functions for the function named base_name. Each
// dispatch function that takes in n optional parameters passes the default
// value of the (n + 1)th optional parameter to the next dispatch function.
// The last dispatch function is the back-end implementation, so only the
// header is generated: the user is expected to supply the body.
//
// Also generates the front-end implementation function, which uses
// BOOST_PARAMETER_FUNCTION_CAST to extract each argument from the argument
// pack.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_LAYER(fwd_decl, x) \
BOOST_PP_IF(fwd_decl, BOOST_PP_REPEAT_FROM_TO, BOOST_PP_TUPLE_EAT(4))( \
0 \
, BOOST_PP_INC( \
BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT( \
BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
) \
) \
, BOOST_PARAMETER_FUNCTION_DISPATCH_FWD_DECL_0_Z \
, x \
) \
BOOST_PP_IF(fwd_decl, BOOST_PP_REPEAT_FROM_TO, BOOST_PP_TUPLE_EAT(4))( \
0 \
, BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT( \
BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
) \
, BOOST_PARAMETER_FUNCTION_DISPATCH_FWD_DECL_1_Z \
, x \
) \
template <typename Args> BOOST_PARAMETER_MEMBER_FUNCTION_STATIC( \
BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
) inline typename BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
, BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x) \
)<Args>::type BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
, BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x) \
)(Args const& args) \
BOOST_PP_EXPR_IF(BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x), const) \
{ \
return BOOST_PP_EXPR_IF( \
BOOST_PARAMETER_FUNCTION_DISPATCH_IS_MEMBER(x) \
, this-> \
) BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, 0)( \
static_cast< \
typename BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
, BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x) \
)<Args>::type(*)() \
>(BOOST_PARAMETER_AUX_PP_NULLPTR) \
, args \
, 0L \
BOOST_PP_SEQ_FOR_EACH( \
BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_CAST_R \
, BOOST_PARAMETER_FUNCTION_DISPATCH_TAG_NAMESPACE(x) \
, BOOST_PARAMETER_SPLIT_ARG_REQ_SEQ( \
BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
) \
) \
); \
} \
BOOST_PP_REPEAT_FROM_TO( \
0 \
, BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT( \
BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
) \
, BOOST_PARAMETER_FUNCTION_DISPATCH_OVERLOAD_Z \
, x \
) \
BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL( \
BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT( \
BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
) \
, x \
) \
inline BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN( \
BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT( \
BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
) \
, x \
, 0 \
, 0 \
)
/**/
#endif // include guard

View File

@@ -0,0 +1,33 @@
// Copyright Daniel Wallin 2006.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_DISPATCH_TUPLE_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_DISPATCH_TUPLE_HPP
#include <boost/preprocessor/tuple/elem.hpp>
// Accessor macros for the input tuple to the dispatch macros.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
BOOST_PP_TUPLE_ELEM(5, 0, x)
/**/
#define BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
BOOST_PP_TUPLE_ELEM(5, 1, x)
/**/
#define BOOST_PARAMETER_FUNCTION_DISPATCH_IS_MEMBER(x) \
BOOST_PP_TUPLE_ELEM(5, 2, x)
/**/
#define BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x) \
BOOST_PP_TUPLE_ELEM(5, 3, x)
/**/
#define BOOST_PARAMETER_FUNCTION_DISPATCH_TAG_NAMESPACE(x) \
BOOST_PP_TUPLE_ELEM(5, 4, x)
/**/
#endif // include guard

View File

@@ -0,0 +1,43 @@
// Copyright Daniel Wallin 2006.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_FORWARD_MATCH_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_FORWARD_MATCH_HPP
#include <boost/parameter/config.hpp>
#if !defined(BOOST_NO_SFINAE) && \
!BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x592))
#include <boost/parameter/aux_/pp_impl/match.hpp>
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
// Expands to an extra argument that is well-formed
// iff all Args... satisfy the requirements set by params.
#define BOOST_PARAMETER_FUNCTION_FORWARD_MATCH(params, n, prefix) \
, typename ::boost::parameter::aux::match< \
params BOOST_PP_ENUM_TRAILING_PARAMS(n, prefix) \
>::type = params()
/**/
#define BOOST_PARAMETER_FUNCTION_FORWARD_MATCH_Z(z, params, n, prefix) \
, typename ::boost::parameter::aux::match< \
params BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, prefix) \
>::type = params()
/**/
#else // SFINAE/Borland workarounds needed.
#define BOOST_PARAMETER_FUNCTION_FORWARD_MATCH(params, n, prefix) \
, params = params()
/**/
#define BOOST_PARAMETER_FUNCTION_FORWARD_MATCH_Z(z, params, n, prefix) \
, params = params()
/**/
#endif
#endif // include guard

View File

@@ -0,0 +1,152 @@
// Copyright Daniel Wallin 2006.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_NAME_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_NAME_HPP
#define BOOST_PARAMETER_MEMBER_FUNCTION_CHECK_STATIC_static ()
/**/
#include <boost/parameter/aux_/preprocessor/is_nullary.hpp>
#include <boost/preprocessor/cat.hpp>
#define BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(name) \
BOOST_PARAMETER_IS_NULLARY( \
BOOST_PP_CAT(BOOST_PARAMETER_MEMBER_FUNCTION_CHECK_STATIC_, name) \
)
/**/
#include <boost/preprocessor/seq/seq.hpp>
#include <boost/config.hpp>
#if defined(BOOST_MSVC)
// Workaround for MSVC preprocessor.
//
// When stripping static from "static f", msvc will produce " f". The leading
// whitespace doesn't go away when pasting the token with something else, so
// this thing is a hack to strip the whitespace.
#define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_static (
/**/
#define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_AUX(name) \
BOOST_PP_CAT(BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_, name))
/**/
#define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC(name) \
BOOST_PP_SEQ_HEAD( \
BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_AUX(name) \
)
/**/
#else
#define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_static
/**/
#define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC(name) \
BOOST_PP_CAT(BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_, name)
/**/
#endif // MSVC workarounds needed
#include <boost/preprocessor/control/expr_if.hpp>
#define BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(name) \
BOOST_PP_EXPR_IF( \
BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(name), static \
)
/**/
#include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/tuple/eat.hpp>
#define BOOST_PARAMETER_MEMBER_FUNCTION_NAME(name) \
BOOST_PP_IF( \
BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(name) \
, BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC \
, name BOOST_PP_TUPLE_EAT(1) \
)(name)
/**/
// Produces a name for a parameter specification for the function named base.
#define BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME(base, is_const) \
BOOST_PP_CAT( \
BOOST_PP_CAT( \
BOOST_PP_IF( \
is_const \
, boost_param_parameters_const_ \
, boost_param_parameters_ \
) \
, __LINE__ \
) \
, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
)
/**/
// Produces a name for a result type metafunction for the no-spec function
// named base.
#define BOOST_PARAMETER_NO_SPEC_FUNCTION_RESULT_NAME(base, is_const) \
BOOST_PP_CAT( \
BOOST_PP_CAT( \
BOOST_PP_IF( \
is_const \
, boost_param_no_spec_result_const_ \
, boost_param_no_spec_result_ \
) \
, __LINE__ \
) \
, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
)
/**/
// Produces a name for a result type metafunction for the function named base.
#define BOOST_PARAMETER_FUNCTION_RESULT_NAME(base, is_const) \
BOOST_PP_CAT( \
BOOST_PP_CAT( \
BOOST_PP_IF( \
is_const \
, boost_param_result_const_ \
, boost_param_result_ \
) \
, __LINE__ \
) \
, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
)
/**/
// Produces a name for the implementation function to which the no-spec
// function named base forwards its result type and argument pack.
#define BOOST_PARAMETER_NO_SPEC_FUNCTION_IMPL_NAME(base, is_const) \
BOOST_PP_CAT( \
BOOST_PP_CAT( \
BOOST_PP_IF( \
is_const \
, boost_param_no_spec_impl_const \
, boost_param_no_spec_impl \
) \
, __LINE__ \
) \
, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
)
/**/
// Can't do boost_param_impl_ ## basee
// because base might start with an underscore.
// daniel: what? how is that relevant? the reason for using CAT()
// is to make sure base is expanded. i'm not sure we need to here,
// but it's more stable to do it.
#define BOOST_PARAMETER_FUNCTION_IMPL_NAME(base, is_const) \
BOOST_PP_CAT( \
BOOST_PP_CAT( \
BOOST_PP_IF(is_const, boost_param_impl_const, boost_param_impl) \
, __LINE__ \
) \
, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
)
/**/
#endif // include guard

View File

@@ -0,0 +1,331 @@
// Copyright Cromwell D. Enage 2018.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_NO_SPEC_OVERLOADS_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_NO_SPEC_OVERLOADS_HPP
#include <boost/parameter/aux_/preprocessor/impl/function_name.hpp>
// Defines the no-spec implementation function header.
#define BOOST_PARAMETER_NO_SPEC_FUNCTION_IMPL_HEAD(name, is_const) \
template <typename ResultType, typename Args> \
BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(name) ResultType \
BOOST_PARAMETER_NO_SPEC_FUNCTION_IMPL_NAME( \
name, is_const \
)(ResultType(*)(), Args const& args)
/**/
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#include <boost/parameter/aux_/preprocessor/impl/parenthesized_return_type.hpp>
// Expands to the result metafunction for the specified no-spec function.
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#define BOOST_PARAMETER_NO_SPEC_FUNCTION_HEAD(result, name, is_const) \
template <typename TaggedArg0, typename ...TaggedArgs> \
using BOOST_PARAMETER_NO_SPEC_FUNCTION_RESULT_NAME(name, is_const) \
= typename BOOST_PARAMETER_PARENTHESIZED_RETURN_TYPE(result);
/**/
#else
#define BOOST_PARAMETER_NO_SPEC_FUNCTION_HEAD(result, name, is_const) \
template <typename TaggedArg0, typename ...TaggedArgs> \
struct BOOST_PARAMETER_NO_SPEC_FUNCTION_RESULT_NAME(name, is_const) \
: BOOST_PARAMETER_PARENTHESIZED_RETURN_TYPE(result) \
{ \
};
/**/
#endif // BOOST_PARAMETER_CAN_USE_MP11
#include <boost/parameter/compose.hpp>
#include <boost/parameter/are_tagged_arguments.hpp>
#include <boost/parameter/aux_/preprocessor/impl/parenthesized_type.hpp>
#include <boost/core/enable_if.hpp>
// Exapnds to a variadic constructor that is enabled if and only if all its
// arguments are tagged arguments. The enclosing class must inherit from the
// specified base class, which in turn must implement a constructor that takes
// in the argument pack that this one passes on.
#define BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR(class_, base) \
template < \
typename TaggedArg0 \
, typename ...TaggedArgs \
, typename = typename ::boost::enable_if< \
::boost::parameter \
::are_tagged_arguments<TaggedArg0,TaggedArgs...> \
>::type \
> inline explicit \
class_(TaggedArg0 const& arg0, TaggedArgs const&... args) \
: BOOST_PARAMETER_PARENTHESIZED_TYPE(base)( \
::boost::parameter::compose(arg0, args...) \
) \
{ \
}
/**/
// Exapnds to a variadic constructor that is enabled if and only if all its
// arguments are tagged arguments. The specified function must be able to
// take in the argument pack that this constructor passes on.
#define BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR(class_, func) \
template < \
typename TaggedArg0 \
, typename ...TaggedArgs \
, typename = typename ::boost::enable_if< \
::boost::parameter \
::are_tagged_arguments<TaggedArg0,TaggedArgs...> \
>::type \
> inline explicit \
class_(TaggedArg0 const& arg0, TaggedArgs const&... args) \
{ \
func(::boost::parameter::compose(arg0, args...)); \
}
/**/
#include <boost/parameter/aux_/preprocessor/nullptr.hpp>
#include <boost/preprocessor/control/expr_if.hpp>
// Exapnds to a variadic function that is enabled if and only if
// all its arguments are tagged arguments.
#define BOOST_PARAMETER_NO_SPEC_FUNCTION_OVERLOAD(name, impl, is_m, c) \
template <typename TaggedArg0, typename ...TaggedArgs> \
BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(impl) \
inline typename ::boost::lazy_enable_if< \
::boost::parameter \
::are_tagged_arguments<TaggedArg0,TaggedArgs...> \
, BOOST_PARAMETER_NO_SPEC_FUNCTION_RESULT_NAME( \
impl, c \
)<TaggedArg0,TaggedArgs...> \
>::type BOOST_PARAMETER_MEMBER_FUNCTION_NAME(name) \
(TaggedArg0 const& arg0, TaggedArgs const&... args) \
BOOST_PP_EXPR_IF(c, const) \
{ \
return BOOST_PP_EXPR_IF(is_m, this->) \
BOOST_PARAMETER_NO_SPEC_FUNCTION_IMPL_NAME(impl, c)( \
static_cast< \
typename BOOST_PARAMETER_NO_SPEC_FUNCTION_RESULT_NAME( \
impl, c \
)<TaggedArg0,TaggedArgs...>::type(*)() \
>(BOOST_PARAMETER_AUX_PP_NULLPTR) \
, ::boost::parameter::compose(arg0, args...) \
); \
}
/**/
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#include <boost/parameter/aux_/void.hpp>
#include <boost/parameter/aux_/preprocessor/impl/parenthesized_return_type.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
// Expands to the result metafunction for the specified no-spec function.
#define BOOST_PARAMETER_NO_SPEC_FUNCTION_HEAD(result, name, is_const) \
template < \
BOOST_PP_ENUM_BINARY_PARAMS( \
BOOST_PARAMETER_COMPOSE_MAX_ARITY \
, typename TaggedArg \
, = ::boost::parameter::void_ BOOST_PP_INTERCEPT \
) \
> \
struct BOOST_PARAMETER_NO_SPEC_FUNCTION_RESULT_NAME(name, is_const) \
: BOOST_PARAMETER_PARENTHESIZED_RETURN_TYPE(result) \
{ \
};
/**/
#include <boost/parameter/compose.hpp>
#include <boost/parameter/aux_/preprocessor/impl/parenthesized_type.hpp>
#include <boost/preprocessor/comparison/equal.hpp>
#include <boost/preprocessor/control/expr_if.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#if defined(BOOST_NO_SFINAE)
// Exapnds to a tagged-argument constructor overload that passes the argument
// pack to the base class delegate constructor.
#define BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR_OVERLOAD_Z(z, n, data) \
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename TaggedArg)> \
BOOST_PP_EXPR_IF(BOOST_PP_EQUAL(n, 1), explicit) inline \
BOOST_PP_TUPLE_ELEM(2, 0, data)( \
BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, TaggedArg, const& arg) \
) : BOOST_PARAMETER_PARENTHESIZED_TYPE(BOOST_PP_TUPLE_ELEM(2, 1, data))( \
::boost::parameter::compose(BOOST_PP_ENUM_PARAMS_Z(z, n, arg)) \
) \
{ \
}
/**/
// Exapnds to a tagged-argument constructor overload that passes the argument
// pack to the delegate function.
#define BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR_OVERLOAD_Z(z, n, data) \
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename TaggedArg)> \
BOOST_PP_EXPR_IF(BOOST_PP_EQUAL(n, 1), explicit) inline \
BOOST_PP_TUPLE_ELEM(2, 0, data)( \
BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, TaggedArg, const& a) \
) \
{ \
BOOST_PP_TUPLE_ELEM(2, 1, data)( \
::boost::parameter::compose(BOOST_PP_ENUM_PARAMS_Z(z, n, a)) \
); \
}
/**/
#include <boost/parameter/aux_/preprocessor/nullptr.hpp>
// Exapnds to a tagged-argument function overload.
#define BOOST_PARAMETER_NO_SPEC_FUNCTION_OVERLOAD_Z(z, n, data) \
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename TaggedArg)> \
BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(BOOST_PP_TUPLE_ELEM(4, 1, data)) \
inline typename BOOST_PARAMETER_NO_SPEC_FUNCTION_RESULT_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, data) \
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
)<BOOST_PP_ENUM_PARAMS_Z(z, n, TaggedArg)>::type \
BOOST_PARAMETER_MEMBER_FUNCTION_NAME( \
BOOST_PP_TUPLE_ELEM(4, 0, data) \
)(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, TaggedArg, const& arg)) \
BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(4, 3, data), const) \
{ \
return BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(4, 2, data), this->) \
BOOST_PARAMETER_NO_SPEC_FUNCTION_IMPL_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, data) \
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
)( \
static_cast< \
typename BOOST_PARAMETER_NO_SPEC_FUNCTION_RESULT_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, data) \
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
)<BOOST_PP_ENUM_PARAMS_Z(z, n, TaggedArg)>::type(*)() \
>(BOOST_PARAMETER_AUX_PP_NULLPTR) \
, ::boost::parameter::compose(BOOST_PP_ENUM_PARAMS_Z(z, n, arg)) \
); \
}
/**/
#else // !defined(BOOST_NO_SFINAE)
#include <boost/parameter/are_tagged_arguments.hpp>
#include <boost/parameter/aux_/preprocessor/nullptr.hpp>
#include <boost/core/enable_if.hpp>
// Exapnds to a tagged-argument constructor overload that passes the argument
// pack to the base class delegate constructor. This constructor is enabled
// if and only if all its arguments are tagged arguments.
#define BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR_OVERLOAD_Z(z, n, data) \
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename TaggedArg)> \
BOOST_PP_EXPR_IF(BOOST_PP_EQUAL(n, 1), explicit) inline \
BOOST_PP_TUPLE_ELEM(2, 0, data)( \
BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, TaggedArg, const& arg) \
, typename ::boost::enable_if< \
::boost::parameter::are_tagged_arguments< \
BOOST_PP_ENUM_PARAMS_Z(z, n, TaggedArg) \
> \
>::type* = BOOST_PARAMETER_AUX_PP_NULLPTR \
) : BOOST_PARAMETER_PARENTHESIZED_TYPE(BOOST_PP_TUPLE_ELEM(2, 1, data))( \
::boost::parameter::compose(BOOST_PP_ENUM_PARAMS_Z(z, n, arg)) \
) \
{ \
}
/**/
// Exapnds to a tagged-argument constructor overload that passes the argument
// pack to the delegate function. This constructor is enabled if and only if
// all its arguments are tagged arguments.
#define BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR_OVERLOAD_Z(z, n, data) \
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename TaggedArg)> \
BOOST_PP_EXPR_IF(BOOST_PP_EQUAL(n, 1), explicit) inline \
BOOST_PP_TUPLE_ELEM(2, 0, data)( \
BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, TaggedArg, const& a) \
, typename ::boost::enable_if< \
::boost::parameter::are_tagged_arguments< \
BOOST_PP_ENUM_PARAMS_Z(z, n, TaggedArg) \
> \
>::type* = BOOST_PARAMETER_AUX_PP_NULLPTR \
) \
{ \
BOOST_PP_TUPLE_ELEM(2, 1, data)( \
::boost::parameter::compose(BOOST_PP_ENUM_PARAMS_Z(z, n, a)) \
); \
}
/**/
// Exapnds to a function overload that is enabled if and only if
// all its arguments are tagged arguments.
#define BOOST_PARAMETER_NO_SPEC_FUNCTION_OVERLOAD_Z(z, n, data) \
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename TaggedArg)> \
BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(BOOST_PP_TUPLE_ELEM(4, 1, data)) \
inline typename ::boost::lazy_enable_if< \
::boost::parameter \
::are_tagged_arguments<BOOST_PP_ENUM_PARAMS_Z(z, n, TaggedArg)> \
, BOOST_PARAMETER_NO_SPEC_FUNCTION_RESULT_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, data) \
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
)<BOOST_PP_ENUM_PARAMS_Z(z, n, TaggedArg)> \
>::type BOOST_PARAMETER_MEMBER_FUNCTION_NAME( \
BOOST_PP_TUPLE_ELEM(4, 0, data) \
)(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, TaggedArg, const& arg)) \
BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(4, 3, data), const) \
{ \
return BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(4, 2, data), this->) \
BOOST_PARAMETER_NO_SPEC_FUNCTION_IMPL_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, data) \
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
)( \
static_cast< \
typename BOOST_PARAMETER_NO_SPEC_FUNCTION_RESULT_NAME( \
BOOST_PP_TUPLE_ELEM(4, 1, data) \
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
)<BOOST_PP_ENUM_PARAMS_Z(z, n, TaggedArg)>::type(*)() \
>(BOOST_PARAMETER_AUX_PP_NULLPTR) \
, ::boost::parameter::compose(BOOST_PP_ENUM_PARAMS_Z(z, n, arg)) \
); \
}
/**/
#endif // BOOST_NO_SFINAE
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
// Emulates a variadic constructor that is enabled if and only if all its
// arguments are tagged arguments. The enclosing class must inherit from the
// specified base class, which in turn must implement a constructor that takes
// in the argument pack that this one passes on.
#define BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR(class_, base) \
BOOST_PP_REPEAT_FROM_TO( \
1 \
, BOOST_PP_INC(BOOST_PARAMETER_COMPOSE_MAX_ARITY) \
, BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR_OVERLOAD_Z \
, (class_, base) \
)
/**/
// Emulates a variadic constructor that is enabled if and only if all its
// arguments are tagged arguments. The specified function must be able to
// take in the argument pack that this constructor passes on.
#define BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR(class_, func) \
BOOST_PP_REPEAT_FROM_TO( \
1 \
, BOOST_PP_INC(BOOST_PARAMETER_COMPOSE_MAX_ARITY) \
, BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR_OVERLOAD_Z \
, (class_, func) \
)
/**/
// Emulates a variadic function that is enabled if and only if
// all its arguments are tagged arguments.
#define BOOST_PARAMETER_NO_SPEC_FUNCTION_OVERLOAD(name, impl, is_m, c) \
BOOST_PP_REPEAT_FROM_TO( \
1 \
, BOOST_PP_INC(BOOST_PARAMETER_COMPOSE_MAX_ARITY) \
, BOOST_PARAMETER_NO_SPEC_FUNCTION_OVERLOAD_Z \
, (name, impl, is_m, c) \
)
/**/
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
#endif // include guard

View File

@@ -0,0 +1,122 @@
// Copyright Cromwell D. Enage 2019.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_PARENTHESIZED_RETURN_TYPE_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_PARENTHESIZED_RETURN_TYPE_HPP
namespace boost { namespace parameter { namespace aux {
// A metafunction that transforms void(*)(T) -> identity<T>
template <typename UnaryFunctionPointer>
struct unaryfunptr_return_type;
}}} // namespace boost::parameter::aux
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/utility.hpp>
#else
#include <boost/mpl/identity.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename Arg>
struct unaryfunptr_return_type<void(*)(Arg)>
{
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using type = ::boost::mp11::mp_identity<Arg>;
#else
typedef ::boost::mpl::identity<Arg> type;
#endif
};
template <>
struct unaryfunptr_return_type<void(*)(void)>
{
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using type = ::boost::mp11::mp_identity<void>;
#else
typedef ::boost::mpl::identity<void> type;
#endif
};
}}} // namespace boost::parameter::aux
#if !defined(BOOST_NO_SFINAE)
#include <boost/core/enable_if.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Pred, typename Ret>
struct unaryfunptr_return_type<void(*)(::boost::enable_if<Pred,Ret>)>
{
typedef ::boost::enable_if<Pred,Ret> type;
};
template <bool b, typename Ret>
struct unaryfunptr_return_type<void(*)(::boost::enable_if_c<b,Ret>)>
{
typedef ::boost::enable_if_c<b,Ret> type;
};
template <typename Pred, typename Ret>
struct unaryfunptr_return_type<void(*)(::boost::lazy_enable_if<Pred,Ret>)>
{
typedef ::boost::lazy_enable_if<Pred,Ret> type;
};
template <bool b, typename Ret>
struct unaryfunptr_return_type<void(*)(::boost::lazy_enable_if_c<b,Ret>)>
{
typedef ::boost::lazy_enable_if_c<b,Ret> type;
};
template <typename Pred, typename Ret>
struct unaryfunptr_return_type<void(*)(::boost::disable_if<Pred,Ret>)>
{
typedef ::boost::disable_if<Pred,Ret> type;
};
template <bool b, typename Ret>
struct unaryfunptr_return_type<void(*)(::boost::disable_if_c<b,Ret>)>
{
typedef ::boost::disable_if_c<b,Ret> type;
};
template <typename B, typename Ret>
struct unaryfunptr_return_type<void(*)(::boost::lazy_disable_if<B,Ret>)>
{
typedef ::boost::lazy_disable_if<B,Ret> type;
};
template <bool b, typename Ret>
struct unaryfunptr_return_type<void(*)(::boost::lazy_disable_if_c<b,Ret>)>
{
typedef ::boost::lazy_disable_if_c<b,Ret> type;
};
}}} // namespace boost::parameter::aux
#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
#include <type_traits>
namespace boost { namespace parameter { namespace aux {
template <bool b, typename Ret>
struct unaryfunptr_return_type<void(*)(::std::enable_if<b,Ret>)>
{
typedef ::std::enable_if<b,Ret> type;
};
}}} // namespace boost::parameter::aux
#endif // BOOST_NO_CXX11_HDR_TYPE_TRAITS
#endif // BOOST_NO_SFINAE
// A macro that takes a parenthesized C++ type name (T) and transforms it
// into an un-parenthesized type expression equivalent to identity<T>.
#define BOOST_PARAMETER_PARENTHESIZED_RETURN_TYPE(x) \
::boost::parameter::aux::unaryfunptr_return_type< void(*)x >::type
#endif // include guard

View File

@@ -0,0 +1,34 @@
// Copyright David Abrahams 2006.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_PARENTHESIZED_TYPE_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_PARENTHESIZED_TYPE_HPP
namespace boost { namespace parameter { namespace aux {
// A metafunction that transforms void(*)(T) -> T
template <typename UnaryFunctionPointer>
struct unaryfunptr_arg_type;
template <typename Arg>
struct unaryfunptr_arg_type<void(*)(Arg)>
{
typedef Arg type;
};
template <>
struct unaryfunptr_arg_type<void(*)(void)>
{
typedef void type;
};
}}} // namespace boost::parameter::aux
// A macro that takes a parenthesized C++ type name (T) and transforms it
// into an un-parenthesized type expression equivalent to T.
#define BOOST_PARAMETER_PARENTHESIZED_TYPE(x) \
::boost::parameter::aux::unaryfunptr_arg_type< void(*)x >::type
#endif // include guard

View File

@@ -0,0 +1,109 @@
// Copyright Daniel Wallin 2006.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_SPECIFICATION_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_SPECIFICATION_HPP
#include <boost/parameter/optional.hpp>
// Helper macros for BOOST_PARAMETER_SPECIFICATION_ELEM_R.
#define BOOST_PARAMETER_QUALIFIED_TAG_optional(tag) \
optional<tag
/**/
#include <boost/parameter/required.hpp>
#define BOOST_PARAMETER_QUALIFIED_TAG_required(tag) \
required<tag
/**/
#include <boost/parameter/deduced.hpp>
#define BOOST_PARAMETER_QUALIFIED_TAG_deduced_optional(tag) \
optional< ::boost::parameter::deduced<tag>
/**/
#define BOOST_PARAMETER_QUALIFIED_TAG_deduced_required(tag) \
required< ::boost::parameter::deduced<tag>
/**/
#include <boost/parameter/aux_/preprocessor/impl/argument_specs.hpp>
#include <boost/parameter/config.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/cat.hpp>
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
#include <boost/parameter/aux_/use_default.hpp>
#define BOOST_PARAMETER_SPECIFICATION_ELEM_R(r, tag_namespace, i, elem) \
BOOST_PP_COMMA_IF(i) ::boost::parameter::BOOST_PP_CAT( \
BOOST_PARAMETER_QUALIFIED_TAG_ \
, BOOST_PARAMETER_FN_ARG_QUALIFIER(elem) \
)(tag_namespace::BOOST_PARAMETER_FN_ARG_NAME(elem)) \
, ::boost::parameter::aux::use_default \
>
/**/
#else // !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
#include <boost/parameter/aux_/pp_impl/unwrap_predicate.hpp>
// Expands to each boost::parameter::parameters<> element type.
#define BOOST_PARAMETER_SPECIFICATION_ELEM_R(r, tag_namespace, i, elem) \
BOOST_PP_COMMA_IF(i) ::boost::parameter::BOOST_PP_CAT( \
BOOST_PARAMETER_QUALIFIED_TAG_ \
, BOOST_PARAMETER_FN_ARG_QUALIFIER(elem) \
)(tag_namespace::BOOST_PARAMETER_FN_ARG_NAME(elem)) \
, typename ::boost::parameter::aux::unwrap_predicate< \
void BOOST_PARAMETER_FN_ARG_PRED(elem) \
>::type \
>
/**/
#endif // Borland workarounds needed.
#include <boost/parameter/parameters.hpp>
#include <boost/parameter/aux_/preprocessor/impl/function_name.hpp>
#include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/seq/for_each_i.hpp>
// Expands to a boost::parameter::parameters<> specialization for the
// function named base. Used by BOOST_PARAMETER_CONSTRUCTOR_AUX and
// BOOST_PARAMETER_FUNCTION_HEAD for their respective ParameterSpec models.
#define BOOST_PARAMETER_SPECIFICATION(tag_ns, base, split_args, is_const) \
template <typename BoostParameterDummy> \
struct BOOST_PP_CAT( \
BOOST_PP_CAT( \
BOOST_PP_IF( \
is_const \
, boost_param_params_const_ \
, boost_param_params_ \
) \
, __LINE__ \
) \
, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
) : ::boost::parameter::parameters< \
BOOST_PP_SEQ_FOR_EACH_I( \
BOOST_PARAMETER_SPECIFICATION_ELEM_R, tag_ns, split_args \
) \
> \
{ \
}; \
typedef BOOST_PP_CAT( \
BOOST_PP_CAT( \
BOOST_PP_IF( \
is_const \
, boost_param_params_const_ \
, boost_param_params_ \
) \
, __LINE__ \
) \
, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
)<int>
/**/
#endif // include guard

View File

@@ -0,0 +1,71 @@
// Copyright Daniel Wallin 2006.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_SPLIT_ARGS_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_SPLIT_ARGS_HPP
#include <boost/preprocessor/tuple/elem.hpp>
// Accessor macros for the split_args tuple.
#define BOOST_PARAMETER_SPLIT_ARG_REQ_COUNT(x) BOOST_PP_TUPLE_ELEM(4, 0, x)
#define BOOST_PARAMETER_SPLIT_ARG_REQ_SEQ(x) BOOST_PP_TUPLE_ELEM(4, 1, x)
#define BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT(x) BOOST_PP_TUPLE_ELEM(4, 2, x)
#define BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(x) BOOST_PP_TUPLE_ELEM(4, 3, x)
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/seq/push_back.hpp>
// Helper macros for BOOST_PARAMETER_FUNCTION_SPLIT_ARGS.
#define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_required(s_a, arg) \
( \
BOOST_PP_INC(BOOST_PARAMETER_SPLIT_ARG_REQ_COUNT(s_a)) \
, BOOST_PP_SEQ_PUSH_BACK(BOOST_PARAMETER_SPLIT_ARG_REQ_SEQ(s_a), arg) \
, BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT(s_a) \
, BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(s_a) \
)
/**/
#define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_deduced_required(split_args, arg) \
BOOST_PARAMETER_FUNCTION_SPLIT_ARG_required(split_args, arg)
/**/
#define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_optional(s_a, arg) \
( \
BOOST_PARAMETER_SPLIT_ARG_REQ_COUNT(s_a) \
, BOOST_PARAMETER_SPLIT_ARG_REQ_SEQ(s_a) \
, BOOST_PP_INC(BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT(s_a)) \
, BOOST_PP_SEQ_PUSH_BACK(BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(s_a), arg) \
)
/**/
#define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_deduced_optional(split_args, arg) \
BOOST_PARAMETER_FUNCTION_SPLIT_ARG_optional(split_args, arg)
/**/
#include <boost/parameter/aux_/preprocessor/impl/argument_specs.hpp>
#include <boost/preprocessor/cat.hpp>
#define BOOST_PARAMETER_FUNCTION_SPLIT_ARG(s, split_args, arg) \
BOOST_PP_CAT( \
BOOST_PARAMETER_FUNCTION_SPLIT_ARG_ \
, BOOST_PARAMETER_FN_ARG_QUALIFIER(arg) \
)(split_args, arg)
/**/
#include <boost/preprocessor/seq/fold_left.hpp>
#include <boost/preprocessor/seq/seq.hpp>
// Expands from the flattened BOOST_PARAMETER_FUNCTION et. al. arg sequence to
// the tuple (required_count, required_args, optional_count, optional_args).
#define BOOST_PARAMETER_FUNCTION_SPLIT_ARGS(args) \
BOOST_PP_SEQ_FOLD_LEFT( \
BOOST_PARAMETER_FUNCTION_SPLIT_ARG \
, (0, BOOST_PP_SEQ_NIL, 0, BOOST_PP_SEQ_NIL) \
, args \
)
/**/
#endif // include guard

View File

@@ -0,0 +1,78 @@
// Copyright Cromwell D. Enage 2013.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_INC_BINARY_SEQ_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_INC_BINARY_SEQ_HPP
#include <boost/preprocessor/seq/push_back.hpp>
// This macro keeps the rest of the sequence if carry == 0.
#define BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_0(seq, element) \
(BOOST_PP_SEQ_PUSH_BACK(seq, element), 0)
/**/
#include <boost/preprocessor/control/iif.hpp>
// This macro updates the rest of the sequence if carry == 1.
#define BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_1(seq, element) \
(BOOST_PP_SEQ_PUSH_BACK(seq, BOOST_PP_IIF(element, 0, 1)), element)
/**/
#include <boost/preprocessor/tuple/elem.hpp>
#include <boost/preprocessor/cat.hpp>
// This macro maintains a tuple (seq, carry), where seq is the intermediate
// result and carry is a flag that will unset upon finding an element == 0.
#define BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_OP(s, result_tuple, element) \
BOOST_PP_CAT( \
BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_ \
, BOOST_PP_TUPLE_ELEM(2, 1, result_tuple) \
)(BOOST_PP_TUPLE_ELEM(2, 0, result_tuple), element)
/**/
// This macro keeps the sequence at its original length if carry == 0.
#define BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_IMPL_0(seq) seq
/**/
// This macro appends a zero to seq if carry == 1.
#define BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_IMPL_1(seq) \
BOOST_PP_SEQ_PUSH_BACK(seq, 0)
/**/
// This macro takes in the tuple (seq, carry), with carry indicating whether
// or not seq originally contained all 1s. If so, then seq now contains all
// 0s, and this macro pushes an extra 0 before expanding to the new sequence.
// Otherwise, this macro expands to seq as is.
#define BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_IMPL(seq_and_carry) \
BOOST_PP_CAT( \
BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_IMPL_ \
, BOOST_PP_TUPLE_ELEM(2, 1, seq_and_carry) \
)(BOOST_PP_TUPLE_ELEM(2, 0, seq_and_carry))
/**/
#include <boost/preprocessor/seq/seq.hpp>
#include <boost/preprocessor/seq/fold_left.hpp>
// This macro treats the specified sequence of 1s and 0s like a binary number
// in reverse and expands to a sequence representing the next value up.
// However, if the input sequence contains all 1s, then the output sequence
// will contain one more element but all 0s.
//
// Examples:
// seq = (1)(0)(1)(0) --> return (0)(1)(1)(0)
// seq = (1)(1)(1)(0) --> return (0)(0)(0)(1)
// seq = (1)(1)(1)(1) --> return (0)(0)(0)(0)(0)
#define BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ(seq) \
BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_IMPL( \
BOOST_PP_SEQ_FOLD_LEFT( \
BOOST_PARAMETER_AUX_PP_INC_BINARY_SEQ_OP \
, (BOOST_PP_SEQ_NIL, 1) \
, seq \
) \
)
/**/
#endif // include guard

View File

@@ -0,0 +1,31 @@
// Copyright Daniel Wallin 2006.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IS_BINARY_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IS_BINARY_HPP
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
// From Paul Mensonides
#include <boost/preprocessor/punctuation/comma.hpp>
#include <boost/preprocessor/detail/split.hpp>
#define BOOST_PARAMETER_IS_BINARY(x) \
BOOST_PP_SPLIT(1, BOOST_PARAMETER_IS_BINARY_C x BOOST_PP_COMMA() 0)
/**/
#include <boost/preprocessor/punctuation/paren.hpp>
#include <boost/preprocessor/tuple/eat.hpp>
#define BOOST_PARAMETER_IS_BINARY_C(x,y) \
~, 1 BOOST_PP_RPAREN() \
BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~
/**/
#else
#include <boost/preprocessor/detail/is_binary.hpp>
#define BOOST_PARAMETER_IS_BINARY(x) BOOST_PP_IS_BINARY(x)
#endif
#endif // include guard

View File

@@ -0,0 +1,32 @@
// Copyright Daniel Wallin 2006.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IS_NULLARY_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IS_NULLARY_HPP
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
// From Paul Mensonides
#include <boost/preprocessor/punctuation/comma.hpp>
#include <boost/preprocessor/detail/split.hpp>
#define BOOST_PARAMETER_IS_NULLARY(x) \
BOOST_PP_SPLIT(1, BOOST_PARAMETER_IS_NULLARY_C x BOOST_PP_COMMA() 0)
/**/
#include <boost/preprocessor/punctuation/paren.hpp>
#include <boost/preprocessor/tuple/eat.hpp>
#define BOOST_PARAMETER_IS_NULLARY_C() \
~, 1 BOOST_PP_RPAREN() \
BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~
/**/
#else
#include <boost/preprocessor/detail/is_nullary.hpp>
#define BOOST_PARAMETER_IS_NULLARY(x) BOOST_PP_IS_NULLARY(x)
/**/
#endif
#endif // include guard

View File

@@ -0,0 +1,165 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Copyright Cromwell D. Enage 2017.
// 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)
// No include guard. This file is intended for multiple inclusion.
#define BOOST_PARAMETER_right_angle(z, n, _) >
/**/
#define BOOST_PARAMETER_satisfies_end(z, n, false_t) ,false_t>
/**/
#include <boost/preprocessor/seq/elem.hpp>
#include <boost/preprocessor/cat.hpp>
// Generates:
//
// make<
// parameter_spec##0, argument_type##0
// , make<
// parameter_spec##1, argument_type##1
// , ... boost::mpl::identity<boost::parameter::aux::empty_arg_list>
// ...>
// >
#define BOOST_PARAMETER_make_arg_list(z, n, names) \
BOOST_PP_SEQ_ELEM(0, names)< \
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, names), n), \
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(2, names), n),
/**/
#include <boost/parameter/aux_/void.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#define BOOST_PARAMETER_build_arg_list(n, make, param_spec, arg_type) \
BOOST_PP_REPEAT( \
n, BOOST_PARAMETER_make_arg_list, (make)(param_spec)(arg_type) \
) \
::boost::mpl::identity< ::boost::parameter::void_> \
BOOST_PP_REPEAT(n, BOOST_PARAMETER_right_angle, _)
/**/
#define BOOST_PARAMETER_make_deduced_list(z, n, names) \
BOOST_PP_SEQ_ELEM(0, names)<BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, names), n),
/**/
#define BOOST_PARAMETER_build_deduced_list(n, make, parameter_spec) \
BOOST_PP_REPEAT( \
n, BOOST_PARAMETER_make_deduced_list, (make)(parameter_spec) \
) \
::boost::mpl::identity< ::boost::parameter::void_> \
BOOST_PP_REPEAT(n, BOOST_PARAMETER_right_angle, _)
/**/
#define BOOST_PARAMETER_forward_typedef(z, n, names) \
typedef BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, names), n) \
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, names), n);
/**/
#define BOOST_PARAMETER_template_args(z, n, prefix) \
typename BOOST_PP_CAT(prefix, n) = ::boost::parameter::void_
/**/
#include <boost/mpl/pair.hpp>
#if (0 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
#include <boost/parameter/aux_/pack/item.hpp>
#include <boost/preprocessor/control/iif.hpp>
#define BOOST_PARAMETER_make_arg_items_R(r, prefix, i, elem) \
::boost::parameter::aux::item<BOOST_PP_CAT(prefix, i), \
BOOST_PP_CAT(A, i) BOOST_PP_IIF(elem, &, const&),
/**/
#include <boost/parameter/aux_/pack/make_arg_list.hpp>
#include <boost/parameter/aux_/pack/tag_keyword_arg.hpp>
#include <boost/preprocessor/seq/for_each_i.hpp>
#include <boost/preprocessor/seq/size.hpp>
#define BOOST_PARAMETER_function_call_arg_list_R(r, seq) \
::boost::parameter::aux::make_arg_list< \
BOOST_PP_SEQ_FOR_EACH_I_R( \
r, BOOST_PARAMETER_make_arg_items_R, PS, seq \
) \
::boost::parameter::void_ \
BOOST_PP_REPEAT( \
BOOST_PP_SEQ_SIZE(seq), BOOST_PARAMETER_right_angle, _ \
) \
, deduced_list \
, ::boost::parameter::aux::tag_keyword_arg \
>
/**/
#include <boost/preprocessor/arithmetic/sub.hpp>
#define BOOST_PARAMETER_function_call_arg_pack_init(z, n, limit) \
BOOST_PP_CAT(a, BOOST_PP_SUB(limit, n))
/**/
#include <boost/parameter/aux_/preprocessor/binary_seq_to_args.hpp>
#include <boost/preprocessor/arithmetic/dec.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
#include <boost/preprocessor/seq/seq.hpp>
#define BOOST_PARAMETER_function_call_op_overload_R(r, seq) \
template < \
BOOST_PP_ENUM_PARAMS( \
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)) \
, typename A \
) \
> \
inline typename ::boost::mpl::first< \
typename BOOST_PARAMETER_function_call_arg_list_R( \
r, BOOST_PP_SEQ_TAIL(seq) \
)::type \
>::type \
operator()( \
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS( \
BOOST_PP_SEQ_TAIL(seq), (A)(a) \
) \
) const \
{ \
typedef typename BOOST_PARAMETER_function_call_arg_list_R( \
r, BOOST_PP_SEQ_TAIL(seq) \
)::type result; \
typedef typename ::boost::mpl::first<result>::type result_type; \
typedef typename ::boost::mpl::second<result>::type error; \
error(); \
return result_type( \
BOOST_PP_ENUM( \
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)) \
, BOOST_PARAMETER_function_call_arg_pack_init \
, BOOST_PP_DEC(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq))) \
) \
BOOST_PP_ENUM_TRAILING_PARAMS( \
BOOST_PP_SUB( \
BOOST_PARAMETER_COMPOSE_MAX_ARITY \
, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)) \
) \
, ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT \
) \
); \
}
/**/
#endif // exponential overloads
#include <boost/parameter/aux_/pack/satisfies.hpp>
#include <boost/mpl/eval_if.hpp>
#define BOOST_PARAMETER_satisfies_begin(z, n, prefix) \
::boost::mpl::eval_if< \
::boost::parameter::aux::satisfies_requirements_of< \
typename ::boost::mpl::first<ArgumentPackAndError>::type \
, BOOST_PP_CAT(prefix, n) \
>,
/**/

View File

@@ -0,0 +1,24 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Copyright Cromwell D. Enage 2017.
// 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)
// No include guard. This file is intended for multiple inclusion.
#undef BOOST_PARAMETER_satisfies_begin
#if (0 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
#undef BOOST_PARAMETER_function_call_op_overload_R
#undef BOOST_PARAMETER_function_call_arg_pack_init
#undef BOOST_PARAMETER_function_call_arg_list_R
#undef BOOST_PARAMETER_make_arg_items_R
#endif
#undef BOOST_PARAMETER_template_args
#undef BOOST_PARAMETER_forward_typedef
#undef BOOST_PARAMETER_build_deduced_list
#undef BOOST_PARAMETER_make_deduced_list
#undef BOOST_PARAMETER_build_arg_list
#undef BOOST_PARAMETER_make_arg_list
#undef BOOST_PARAMETER_satisfies_end
#undef BOOST_PARAMETER_right_angle

View File

@@ -0,0 +1,18 @@
// Copyright Cromwell D. Enage 2019.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_NULLPTR_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_NULLPTR_HPP
#include <boost/config.hpp>
#if defined(BOOST_NO_CXX11_NULLPTR)
#define BOOST_PARAMETER_AUX_PP_NULLPTR 0
#else
#define BOOST_PARAMETER_AUX_PP_NULLPTR nullptr
#endif
#endif // include guard

View File

@@ -0,0 +1,92 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
// This file generates overloads in this format:
//
// template <typename A0, typename A1>
// typename ::boost::mpl::apply_wrap1<
// ::boost::parameter::aux::make_arg_list<
// PS0,A0
// , ::boost::parameter::aux::make_arg_list<
// PS1,A1
// , ::boost::mpl::identity<
// ::boost::parameter::aux::empty_arg_list
// >
// >
// >
// , unnamed_list
// >::type
// operator()(A0 const& a0, A1 const& a1) const
// {
// typedef typename ::boost::mpl::apply_wrap1<
// ::boost::parameter::aux::make_arg_list<
// PS0,A0
// , ::boost::parameter::aux::make_arg_list<
// PS1,A1
// , ::boost::mpl::identity<
// ::boost::parameter::aux::empty_arg_list
// >
// >
// >
// >::type arg_tuple;
//
// return arg_tuple(
// a0
// , a1
// , ::boost::parameter::aux::void_()
// ...
// );
// }
//
#if !defined(BOOST_PP_IS_ITERATING)
# error Boost.Parameters - do not include this file!
#endif
#define N BOOST_PP_ITERATION()
#define BOOST_PARAMETER_open_list(z, n, text) \
::boost::parameter::aux::item< \
BOOST_PP_CAT(PS, n), BOOST_PP_CAT(A, n)
#define BOOST_PARAMETER_close_list(z, n, text) >
#define BOOST_PARAMETER_arg_list(n) \
::boost::parameter::aux::make_arg_list< \
BOOST_PP_ENUM(N, BOOST_PARAMETER_open_list, _) \
, ::boost::parameter::void_ \
BOOST_PP_REPEAT(N, BOOST_PARAMETER_close_list, _) \
, deduced_list \
, ::boost::parameter::aux::tag_keyword_arg \
>
#define BOOST_PARAMETER_arg_pack_init(z, n, limit) \
BOOST_PP_CAT(a, BOOST_PP_SUB(limit, n))
template <BOOST_PP_ENUM_PARAMS(N, typename A)>
typename ::boost::mpl::first<
typename BOOST_PARAMETER_arg_list(N)::type
>::type
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, & a)) const
{
typedef typename BOOST_PARAMETER_arg_list(N)::type result;
typedef typename ::boost::mpl::first<result>::type result_type;
typedef typename ::boost::mpl::second<result>::type error;
error();
return result_type(
BOOST_PP_ENUM(N, BOOST_PARAMETER_arg_pack_init, BOOST_PP_DEC(N))
BOOST_PP_ENUM_TRAILING_PARAMS(
BOOST_PP_SUB(BOOST_PARAMETER_COMPOSE_MAX_ARITY, N)
, ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT
)
);
}
#undef BOOST_PARAMETER_arg_list
#undef BOOST_PARAMETER_close_list
#undef BOOST_PARAMETER_open_list
#undef N

View File

@@ -0,0 +1,88 @@
// Copyright Daniel Wallin 2006.
// Copyright Cromwell D. Enage 2017.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_QUALIFIER_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_QUALIFIER_HPP
#define BOOST_PARAMETER_QUALIFIER_EAT_in(x)
#define BOOST_PARAMETER_QUALIFIER_EAT_out(x)
#define BOOST_PARAMETER_QUALIFIER_EAT_in_out(x)
#define BOOST_PARAMETER_QUALIFIER_EAT_consume(x)
#define BOOST_PARAMETER_QUALIFIER_EAT_move_from(x)
#define BOOST_PARAMETER_QUALIFIER_EAT_forward(x)
#define BOOST_PARAMETER_GET_QUALIFIER_in(x) in_reference
#define BOOST_PARAMETER_GET_QUALIFIER_out(x) out_reference
#define BOOST_PARAMETER_GET_QUALIFIER_in_out(x) in_out_reference
#define BOOST_PARAMETER_GET_QUALIFIER_consume(x) consume_reference
#define BOOST_PARAMETER_GET_QUALIFIER_move_from(x) move_from_reference
#define BOOST_PARAMETER_GET_QUALIFIER_forward(x) forward_reference
#define BOOST_PARAMETER_STRIP_QUALIFIER_in(x) x
#define BOOST_PARAMETER_STRIP_QUALIFIER_out(x) x
#define BOOST_PARAMETER_STRIP_QUALIFIER_in_out(x) x
#define BOOST_PARAMETER_STRIP_QUALIFIER_consume(x) x
#define BOOST_PARAMETER_STRIP_QUALIFIER_move_from(x) x
#define BOOST_PARAMETER_STRIP_QUALIFIER_forward(x) x
#include <boost/preprocessor/cat.hpp>
#define BOOST_PARAMETER_GET_QUALIFIER_GET(x) \
BOOST_PP_CAT(BOOST_PARAMETER_GET_QUALIFIER_, x)
/**/
#define BOOST_PARAMETER_GET_UNQUALIFIED(x) \
BOOST_PP_CAT(BOOST_PARAMETER_STRIP_QUALIFIER_, x)
/**/
#include <boost/preprocessor/facilities/is_empty.hpp>
// Expands to 1 if x is either "in(k)", "out(k)", "in_out(k)", "consume(k)",
// "move_from(k)", or "forward(k)"; expands to 0 otherwise.
#define BOOST_PARAMETER_IS_QUALIFIER(x) \
BOOST_PP_IS_EMPTY(BOOST_PP_CAT(BOOST_PARAMETER_QUALIFIER_EAT_, x))
/**/
#include <boost/preprocessor/control/iif.hpp>
// Expands to the qualifier of x,
// where x is either a keyword qualifier or a keyword.
//
// k => forward_reference
// in(k) => in_reference
// out(k) => out_reference
// in_out(k) => in_out_reference
// forward(k) => forward_reference
// consume(k) => consume_reference
// move_from(k) => move_from_reference
#define BOOST_PARAMETER_GET_QUALIFIER(x) \
BOOST_PP_IIF( \
BOOST_PARAMETER_IS_QUALIFIER(x) \
, BOOST_PARAMETER_GET_QUALIFIER_GET(x) \
, forward_reference \
)
/**/
// Expands to the unqualified version of x,
// where x is either a keyword qualifier or a keyword.
//
// k => k
// in(k) => k
// out(k) => k
// in_out(k) => k
// forward(k) => k
// consume(k) => k
// move_from(k) => k
#define BOOST_PARAMETER_UNQUALIFIED(x) \
BOOST_PP_IIF( \
BOOST_PARAMETER_IS_QUALIFIER(x) \
, BOOST_PARAMETER_GET_UNQUALIFIED(x) \
, x \
)
/**/
#endif // include guard

View File

@@ -0,0 +1,26 @@
// Copyright David Abrahams 2005.
// 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)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_SEQ_ENUM_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_SEQ_ENUM_HPP
#include <boost/preprocessor/seq/enum.hpp>
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003)
#include <boost/preprocessor/seq/size.hpp>
// Temporary version of BOOST_PP_SEQ_ENUM
// until Paul M. integrates the workaround.
#define BOOST_PARAMETER_SEQ_ENUM_I(size, seq) \
BOOST_PP_CAT(BOOST_PP_SEQ_ENUM_, size) seq
#define BOOST_PARAMETER_SEQ_ENUM(seq) \
BOOST_PARAMETER_SEQ_ENUM_I(BOOST_PP_SEQ_SIZE(seq), seq)
#else
#define BOOST_PARAMETER_SEQ_ENUM(seq) BOOST_PP_SEQ_ENUM(seq)
#endif
#endif // include guard

File diff suppressed because it is too large Load Diff

View File

@@ -1,132 +0,0 @@
// Copyright Daniel Wallin 2005. 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)
#ifndef BOOST_PARAMETER_INVOKER_051210_HPP
# define BOOST_PARAMETER_INVOKER_051210_HPP
# include <boost/mpl/begin.hpp>
# include <boost/mpl/next.hpp>
# include <boost/mpl/deref.hpp>
# include <boost/mpl/size.hpp>
# include <boost/parameter/keyword.hpp>
# include <boost/preprocessor/iteration/iterate.hpp>
namespace boost { namespace parameter { namespace python { namespace aux {
template <long Arity, class M, class R, class Args>
struct invoker;
template <class M, class R>
struct make_invoker
{
template <class Args>
struct apply
{
typedef invoker<
mpl::size<Args>::value, M, R, Args
> type;
};
};
template <long Arity, class M, class R, class T, class Args>
struct member_invoker;
template <class M, class R, class T>
struct make_member_invoker
{
template <class Args>
struct apply
{
typedef member_invoker<
mpl::size<Args>::value, M, R, T, Args
> type;
};
};
template <long Arity, class T, class R, class Args>
struct call_invoker;
template <class T, class R>
struct make_call_invoker
{
template <class Args>
struct apply
{
typedef call_invoker<
mpl::size<Args>::value, T, R, Args
> type;
};
};
template <long Arity, class T, class Args>
struct init_invoker;
template <class T>
struct make_init_invoker
{
template <class Args>
struct apply
{
typedef init_invoker<
mpl::size<Args>::value, T, Args
> type;
};
};
template <class M, class R, class Args>
struct invoker<0, M, R, Args>
{
static R execute()
{
return M()(boost::type<R>());
}
};
template <class M, class R, class T, class Args>
struct member_invoker<0, M, R, T, Args>
{
static R execute(T& self)
{
return M()(boost::type<R>(), self);
}
};
template <class T, class R, class Args>
struct call_invoker<0, T, R, Args>
{
static R execute(T& self)
{
return self();
}
};
template <class T, class Args>
struct init_invoker<0, T, Args>
{
static T* execute(T& self)
{
return new T;
}
};
# define BOOST_PP_ITERATION_PARAMS_1 (4, \
(1, BOOST_PARAMETER_MAX_ARITY, <boost/parameter/aux_/python/invoker_iterate.hpp>, 1))
# include BOOST_PP_ITERATE()
# define BOOST_PP_ITERATION_PARAMS_1 (4, \
(1, BOOST_PARAMETER_MAX_ARITY, <boost/parameter/aux_/python/invoker_iterate.hpp>, 2))
# include BOOST_PP_ITERATE()
# define BOOST_PP_ITERATION_PARAMS_1 (4, \
(1, BOOST_PARAMETER_MAX_ARITY, <boost/parameter/aux_/python/invoker_iterate.hpp>, 3))
# include BOOST_PP_ITERATE()
# define BOOST_PP_ITERATION_PARAMS_1 (4, \
(1, BOOST_PARAMETER_MAX_ARITY, <boost/parameter/aux_/python/invoker_iterate.hpp>, 4))
# include BOOST_PP_ITERATE()
}}}} // namespace boost::parameter::python::aux
#endif // BOOST_PARAMETER_INVOKER_051210_HPP

View File

@@ -1,93 +0,0 @@
// Copyright Daniel Wallin 2005. 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)
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/dec.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#define N BOOST_PP_ITERATION()
#define BOOST_PARAMETER_PY_ARG_TYPES(z, n, _) \
typedef typename mpl::next< \
BOOST_PP_CAT(iter,BOOST_PP_DEC(n)) \
>::type BOOST_PP_CAT(iter,n); \
\
typedef typename mpl::deref<BOOST_PP_CAT(iter,n)>::type BOOST_PP_CAT(spec,n); \
typedef typename mpl::if_< \
mpl::and_< \
mpl::not_<typename BOOST_PP_CAT(spec,n)::required> \
, typename BOOST_PP_CAT(spec,n)::optimized_default \
> \
, parameter::aux::maybe<typename BOOST_PP_CAT(spec,n)::type> \
, typename BOOST_PP_CAT(spec,n)::type \
>::type BOOST_PP_CAT(arg,n); \
typedef typename BOOST_PP_CAT(spec,n)::keyword BOOST_PP_CAT(kw,n);
#if BOOST_PP_ITERATION_FLAGS() == 1
template <class M, class R, class Args>
struct invoker<N, M, R, Args>
#elif BOOST_PP_ITERATION_FLAGS() == 2
template <class T, class R, class Args>
struct call_invoker<N, T, R, Args>
#elif BOOST_PP_ITERATION_FLAGS() == 3
template <class T, class Args>
struct init_invoker<N, T, Args>
#elif BOOST_PP_ITERATION_FLAGS() == 4
template <class M, class R, class T, class Args>
struct member_invoker<N, M, R, T, Args>
#endif
{
typedef typename mpl::begin<Args>::type iter0;
typedef typename mpl::deref<iter0>::type spec0;
typedef typename mpl::if_<
mpl::and_<
mpl::not_<typename spec0::required>
, typename spec0::optimized_default
>
, parameter::aux::maybe<typename spec0::type>
, typename spec0::type
>::type arg0;
typedef typename spec0::keyword kw0;
BOOST_PP_REPEAT_FROM_TO(1, N, BOOST_PARAMETER_PY_ARG_TYPES, ~)
static
#if BOOST_PP_ITERATION_FLAGS() == 3
T*
#else
R
#endif
execute(
#if BOOST_PP_ITERATION_FLAGS() == 2 || BOOST_PP_ITERATION_FLAGS() == 4
T& self
,
#endif
BOOST_PP_ENUM_BINARY_PARAMS(N, arg, a)
)
{
return
#if BOOST_PP_ITERATION_FLAGS() == 1 || BOOST_PP_ITERATION_FLAGS() == 4
M()(
boost::type<R>()
# if BOOST_PP_ITERATION_FLAGS() == 4
, self
# endif
, BOOST_PP_ENUM_BINARY_PARAMS(N, parameter::keyword<kw, >::get() = a)
);
#elif BOOST_PP_ITERATION_FLAGS() == 2
self(
BOOST_PP_ENUM_BINARY_PARAMS(N, parameter::keyword<kw, >::get() = a)
);
#elif BOOST_PP_ITERATION_FLAGS() == 3
new T(
BOOST_PP_ENUM_BINARY_PARAMS(N, parameter::keyword<kw, >::get() = a)
);
#endif
}
};
#undef BOOST_PARAMETER_PY_ARG_TYPES
#undef N

71
include/boost/parameter/aux_/result_of0.hpp Executable file → Normal file
View File

@@ -1,36 +1,53 @@
// Copyright David Abrahams 2005. 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)
// Copyright David Abrahams 2005.
// 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)
#ifndef BOOST_PARAMETER_AUX_RESULT_OF0_DWA2005511_HPP
# define BOOST_PARAMETER_AUX_RESULT_OF0_DWA2005511_HPP
#define BOOST_PARAMETER_AUX_RESULT_OF0_DWA2005511_HPP
# include <boost/utility/result_of.hpp>
// A metafunction returning the result of invoking a nullary function
// object of the given type.
#ifndef BOOST_NO_RESULT_OF
# include <boost/utility/result_of.hpp>
namespace boost { namespace parameter { namespace aux {
template <class F>
struct result_of0 : result_of<F()>
{};
}}} // namespace boost::parameter::aux_
#include <boost/parameter/aux_/use_default_tag.hpp>
#include <boost/parameter/config.hpp>
#include <boost/utility/result_of.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/utility.hpp>
#include <type_traits>
#else
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_void.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <class F>
struct result_of0
{
typedef typename F::result_type type;
};
namespace boost { namespace parameter { namespace aux {
}}} // namespace boost::parameter::aux_
// A metafunction returning the result of invoking
// a nullary function object of the given type.
template <typename F>
class result_of0
{
#if defined(BOOST_NO_RESULT_OF)
typedef typename F::result_type result_of_F;
#else
typedef typename ::boost::result_of<F()>::type result_of_F;
#endif
#endif
public:
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using type = ::boost::mp11::mp_if<
::std::is_void<result_of_F>
#else
typedef typename ::boost::mpl::if_<
::boost::is_void<result_of_F>
#endif
, ::boost::parameter::aux::use_default_tag
, result_of_F
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
>;
#else
>::type type;
#endif
};
}}} // namespace boost::parameter::aux
#endif // include guard
#endif // BOOST_PARAMETER_AUX_RESULT_OF0_DWA2005511_HPP

View File

@@ -1,67 +1,118 @@
// Copyright Daniel Wallin 2006. 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)
// Copyright Daniel Wallin 2006.
// 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)
#ifndef BOOST_PARAMETER_SET_060912_HPP
# define BOOST_PARAMETER_SET_060912_HPP
#define BOOST_PARAMETER_SET_060912_HPP
# include <boost/detail/workaround.hpp>
#include <boost/parameter/config.hpp>
# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \
&& !BOOST_WORKAROUND(__GNUC__, < 3)
# include <boost/mpl/insert.hpp>
# include <boost/mpl/set/set0.hpp>
# include <boost/mpl/has_key.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/list.hpp>
namespace boost { namespace parameter { namespace aux {
typedef mpl::set0<> set0;
template <class Set, class K>
struct insert_
{
typedef typename mpl::insert<Set, K>::type type;
};
template <class Set, class K>
struct has_key_
{
typedef typename mpl::has_key<Set, K>::type type;
};
typedef ::boost::mp11::mp_list<> set0;
}}} // namespace boost::parameter::aux
# else
# include <boost/mpl/list.hpp>
# include <boost/mpl/end.hpp>
# include <boost/mpl/find.hpp>
# include <boost/mpl/not.hpp>
# include <boost/mpl/push_front.hpp>
#include <boost/mp11/algorithm.hpp>
namespace boost { namespace parameter { namespace aux {
typedef mpl::list0<> set0;
template <class Set, class K>
struct insert_
{
typedef typename mpl::push_front<Set, K>::type type;
};
template <class Set, class K>
struct has_key_
{
typedef typename mpl::find<Set, K>::type iter;
typedef mpl::not_<
is_same<iter, typename mpl::end<Set>::type>
> type;
};
template <typename S, typename K>
struct insert_
{
using type = ::boost::mp11::mp_insert_c<S,0,K>;
};
}}} // namespace boost::parameter::aux
# endif
#include <boost/mp11/integral.hpp>
#include <boost/mp11/utility.hpp>
#include <type_traits>
namespace boost { namespace parameter { namespace aux {
#endif // BOOST_PARAMETER_SET_060912_HPP
template <typename Set, typename K>
struct has_key_
{
using type = ::boost::mp11::mp_if<
::boost::mp11::mp_empty<Set>
, ::boost::mp11::mp_false
, ::std::is_same<
::boost::mp11::mp_find<Set,K>
, ::boost::mp11::mp_size<Set>
>
>;
};
}}} // namespace boost::parameter::aux
#elif BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
#include <boost/mpl/list.hpp>
namespace boost { namespace parameter { namespace aux {
typedef ::boost::mpl::list0<> set0;
}}} // namespace boost::parameter::aux
#include <boost/mpl/push_front.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Set, typename K>
struct insert_ : ::boost::mpl::push_front<Set,K>
{
};
}}} // namespace boost::parameter::aux
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/end.hpp>
#include <boost/mpl/find.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Set, typename K>
struct has_key_
{
typedef typename ::boost::mpl::find<Set,K>::type iter;
typedef typename ::boost::mpl::if_<
::boost::is_same<iter,typename ::boost::mpl::end<Set>::type>
, ::boost::mpl::false_
, ::boost::mpl::true_
>::type type;
};
}}} // namespace boost::parameter::aux
#else // !BOOST_PARAMETER_CAN_USE_MP11 && Borland workarounds not needed
#include <boost/mpl/set/set0.hpp>
namespace boost { namespace parameter { namespace aux {
typedef ::boost::mpl::set0<> set0;
}}} // namespace boost::parameter::aux
#include <boost/mpl/insert.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Set, typename K>
struct insert_ : ::boost::mpl::insert<Set,K>
{
};
}}} // namespace boost::parameter::aux
#include <boost/mpl/has_key.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Set, typename K>
struct has_key_ : ::boost::mpl::has_key<Set,K>
{
};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_CAN_USE_MP11 || Borland workarounds needed
#endif // include guard

182
include/boost/parameter/aux_/tag.hpp Executable file → Normal file
View File

@@ -1,38 +1,160 @@
// Copyright David Abrahams 2005. 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)
// Copyright David Abrahams 2005.
// Copyright Cromwell D. Enage 2017.
// 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)
#ifndef BOOST_PARAMETER_AUX_TAG_DWA2005610_HPP
# define BOOST_PARAMETER_AUX_TAG_DWA2005610_HPP
#define BOOST_PARAMETER_AUX_TAG_DWA2005610_HPP
# include <boost/parameter/aux_/unwrap_cv_reference.hpp>
# include <boost/parameter/aux_/tagged_argument.hpp>
#include <boost/parameter/aux_/unwrap_cv_reference.hpp>
#include <boost/parameter/aux_/tagged_argument.hpp>
#include <boost/parameter/config.hpp>
namespace boost { namespace parameter { namespace aux {
#if defined(BOOST_PARAMETER_CAN_USE_MP11) && \
!BOOST_WORKAROUND(BOOST_MSVC, >= 1910)
// MSVC-14.1+ assigns rvalue references to tagged_argument instances
// instead of tagged_argument_rref instances with this code.
#include <boost/mp11/integral.hpp>
#include <boost/mp11/utility.hpp>
#include <type_traits>
template <class Keyword, class ActualArg
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
, class = typename is_cv_reference_wrapper<ActualArg>::type
#endif
>
struct tag
{
typedef tagged_argument<
Keyword
, typename unwrap_cv_reference<ActualArg>::type
> type;
};
namespace boost { namespace parameter { namespace aux {
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
template <class Keyword, class ActualArg>
struct tag<Keyword,ActualArg,mpl::false_>
{
typedef tagged_argument<
Keyword
, ActualArg
> type;
};
#endif
template <typename Keyword, typename Arg>
struct tag_if_lvalue_reference
{
using type = ::boost::parameter::aux::tagged_argument_list_of_1<
::boost::parameter::aux::tagged_argument<
Keyword
, typename ::boost::parameter::aux
::unwrap_cv_reference<Arg>::type
>
>;
};
template <typename Keyword, typename Arg>
struct tag_if_scalar
{
using type = ::boost::parameter::aux::tagged_argument_list_of_1<
::boost::parameter::aux
::tagged_argument<Keyword,typename ::std::add_const<Arg>::type>
>;
};
template <typename Keyword, typename Arg>
using tag_if_otherwise = ::boost::mp11::mp_if<
::std::is_scalar<typename ::std::remove_const<Arg>::type>
, ::boost::parameter::aux::tag_if_scalar<Keyword,Arg>
, ::boost::mp11::mp_identity<
::boost::parameter::aux::tagged_argument_list_of_1<
::boost::parameter::aux::tagged_argument_rref<Keyword,Arg>
>
>
>;
template <typename Keyword, typename Arg>
using tag = ::boost::mp11::mp_if<
::boost::mp11::mp_if<
::std::is_lvalue_reference<Arg>
, ::boost::mp11::mp_true
, ::boost::parameter::aux::is_cv_reference_wrapper<Arg>
>
, ::boost::parameter::aux::tag_if_lvalue_reference<Keyword,Arg>
, ::boost::parameter::aux::tag_if_otherwise<Keyword,Arg>
>;
}}} // namespace boost::parameter::aux_
#endif // BOOST_PARAMETER_AUX_TAG_DWA2005610_HPP
#elif defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/is_scalar.hpp>
#include <boost/type_traits/is_lvalue_reference.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Keyword, typename ActualArg>
struct tag
{
typedef typename ::boost::parameter::aux
::unwrap_cv_reference<ActualArg>::type Arg;
typedef typename ::boost::add_const<Arg>::type ConstArg;
typedef typename ::boost::remove_const<Arg>::type MutArg;
typedef typename ::boost::mpl::eval_if<
typename ::boost::mpl::if_<
::boost::is_lvalue_reference<ActualArg>
, ::boost::mpl::true_
, ::boost::parameter::aux::is_cv_reference_wrapper<ActualArg>
>::type
, ::boost::mpl::identity<
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
::boost::parameter::aux::tagged_argument_list_of_1<
#endif
::boost::parameter::aux::tagged_argument<Keyword,Arg>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
>
#endif
>
, ::boost::mpl::if_<
::boost::is_scalar<MutArg>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
, ::boost::parameter::aux::tagged_argument_list_of_1<
::boost::parameter::aux::tagged_argument<Keyword,ConstArg>
>
, ::boost::parameter::aux::tagged_argument_list_of_1<
::boost::parameter::aux::tagged_argument_rref<Keyword,Arg>
>
#else
, ::boost::parameter::aux::tagged_argument<Keyword,ConstArg>
, ::boost::parameter::aux::tagged_argument_rref<Keyword,Arg>
#endif
>
>::type type;
};
}}} // namespace boost::parameter::aux_
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
namespace boost { namespace parameter { namespace aux {
template <
typename Keyword
, typename Arg
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
, typename = typename ::boost::parameter::aux
::is_cv_reference_wrapper<Arg>::type
#endif
>
struct tag
{
typedef ::boost::parameter::aux::tagged_argument<
Keyword
, typename ::boost::parameter::aux::unwrap_cv_reference<Arg>::type
> type;
};
}}} // namespace boost::parameter::aux_
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
#include <boost/mpl/bool.hpp>
#include <boost/type_traits/remove_reference.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Keyword, typename Arg>
struct tag<Keyword,Arg,::boost::mpl::false_>
{
typedef ::boost::parameter::aux::tagged_argument<
Keyword
, typename ::boost::remove_reference<Arg>::type
> type;
};
}}} // namespace boost::parameter::aux_
#endif // Borland workarounds needed.
#endif // MP11 or perfect forwarding support
#endif // include guard

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
// Copyright Daniel Wallin, David Abrahams 2005.
// Copyright Cromwell D. Enage 2017.
// 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)
#ifndef BOOST_PARAMETER_TAGGED_ARGUMENT_FWD_HPP
#define BOOST_PARAMETER_TAGGED_ARGUMENT_FWD_HPP
namespace boost { namespace parameter { namespace aux {
template <typename Keyword, typename Arg>
class tagged_argument;
}}} // namespace boost::parameter::aux
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
namespace boost { namespace parameter { namespace aux {
template <typename Keyword, typename Arg>
struct tagged_argument_rref;
}}} // namespace boost::parameter::aux
#endif
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
namespace boost { namespace parameter { namespace aux {
template <typename TaggedArg>
struct tagged_argument_list_of_1;
}}} // namespace boost::parameter::aux
#endif
#endif // include guard

110
include/boost/parameter/aux_/template_keyword.hpp Executable file → Normal file
View File

@@ -1,47 +1,89 @@
// Copyright Daniel Wallin 2006. 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)
// Copyright Daniel Wallin 2006.
// Copyright Cromwell D. Enage 2017.
// 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)
#ifndef BOOST_PARAMETER_TEMPLATE_KEYWORD_060203_HPP
# define BOOST_PARAMETER_TEMPLATE_KEYWORD_060203_HPP
#define BOOST_PARAMETER_TEMPLATE_KEYWORD_060203_HPP
# include <boost/mpl/and.hpp>
# include <boost/mpl/not.hpp>
# include <boost/type_traits/is_convertible.hpp>
# include <boost/type_traits/is_reference.hpp>
namespace boost { namespace parameter { namespace aux {
namespace boost { namespace parameter {
struct template_keyword_base
{
};
}}} // namespace boost::parameter::aux
namespace aux
{
#include <boost/parameter/config.hpp>
struct template_keyword_tag {};
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <type_traits>
template <class T, class U>
struct is_pointer_convertible
: is_convertible<T*, U*>
{};
namespace boost { namespace parameter { namespace aux {
template <class T>
struct is_template_keyword
: mpl::and_<
mpl::not_<is_reference<T> >
, is_pointer_convertible<T, template_keyword_tag>
>
{};
template <typename T>
using is_template_keyword = ::std::is_base_of<
::boost::parameter::aux::template_keyword_base
, typename ::std::remove_const<
typename ::std::remove_reference<T>::type
>::type
>;
}}} // namespace boost::parameter::aux
} // namespace aux
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/remove_const.hpp>
template <class Tag, class T>
struct template_keyword
: aux::template_keyword_tag
{
typedef Tag key_type;
typedef T value_type;
typedef value_type reference;
};
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#include <boost/type_traits/is_base_of.hpp>
#include <boost/type_traits/remove_reference.hpp>
#else
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_lvalue_reference.hpp>
#endif
}} // namespace boost::parameter
namespace boost { namespace parameter { namespace aux {
#endif // BOOST_PARAMETER_TEMPLATE_KEYWORD_060203_HPP
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
template <typename T>
struct is_template_keyword_aux
: ::boost::mpl::if_<
::boost::is_convertible<
T*
, ::boost::parameter::aux::template_keyword_base const*
>
, ::boost::mpl::true_
, ::boost::mpl::false_
>::type
{
};
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
template <typename T>
struct is_template_keyword
: ::boost::mpl::if_<
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
// Cannot use is_convertible<> to check if T is derived from
// template_keyword_base. -- Cromwell D. Enage
::boost::is_base_of<
::boost::parameter::aux::template_keyword_base
, typename ::boost::remove_const<
typename ::boost::remove_reference<T>::type
>::type
>
, ::boost::mpl::true_
, ::boost::mpl::false_
#else
::boost::is_lvalue_reference<T>
, ::boost::mpl::false_
, ::boost::parameter::aux::is_template_keyword_aux<T>
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
>::type
{
};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_CAN_USE_MP11
#endif // include guard

247
include/boost/parameter/aux_/unwrap_cv_reference.hpp Executable file → Normal file
View File

@@ -1,97 +1,174 @@
// Copyright Daniel Wallin, David Abrahams 2005. Use, modification and
// distribution is subject to the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// Copyright Daniel Wallin, David Abrahams 2005.
// Copyright Cromwell D. Enage 2017.
// 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)
#ifndef UNWRAP_CV_REFERENCE_050328_HPP
#define UNWRAP_CV_REFERENCE_050328_HPP
#ifndef BOOST_PARAMETER_AUX_UNWRAP_CV_REFERENCE_HPP
#define BOOST_PARAMETER_AUX_UNWRAP_CV_REFERENCE_HPP
namespace boost {
template <typename T>
class reference_wrapper;
} // namespace boost
#include <boost/parameter/aux_/yesno.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/eval_if.hpp>
namespace boost { template<class T> class reference_wrapper; }
namespace boost { namespace parameter { namespace aux {
//
// reference_wrapper support -- because of the forwarding problem,
// when passing arguments positionally by non-const reference, we
// ask users of named parameter interfaces to use ref(x) to wrap
// them.
//
//
// reference_wrapper support -- if perfect forwarding is unsupported,
// then when passing arguments positionally by non-const reference,
// we ask users of named parameter interfaces to use ref(x) to wrap them.
//
// is_cv_reference_wrapper returns mpl::true_ if T is of type
// reference_wrapper<U> cv
template <class U>
yes_tag is_cv_reference_wrapper_check(reference_wrapper<U> const volatile*);
no_tag is_cv_reference_wrapper_check(...);
template <class T>
struct is_cv_reference_wrapper
{
BOOST_STATIC_CONSTANT(
bool, value = (
sizeof(is_cv_reference_wrapper_check((T*)0)) == sizeof(yes_tag)
)
);
typedef mpl::bool_<
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
is_cv_reference_wrapper::
#endif
value> type;
};
#if BOOST_WORKAROUND(MSVC, == 1200)
template <>
struct is_cv_reference_wrapper<int>
: mpl::false_ {};
#endif
// Needed for unwrap_cv_reference below. T might be const, so
// eval_if might fail because of deriving from T const on EDG.
template <class T>
struct get_type
{
typedef typename T::type type;
};
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
template <class T, class is_reference_wrapper = typename is_cv_reference_wrapper<T>::type>
struct unwrap_cv_reference
{
typedef T type;
};
template <class T>
struct unwrap_cv_reference<T const, mpl::false_>
{
typedef T const type;
};
template <class T>
struct unwrap_cv_reference<T, mpl::true_>
: T
{};
#else
// Produces the unwrapped type to hold a reference to in named<>
// Can't use boost::unwrap_reference<> here because it
// doesn't handle the case where T = reference_wrapper<U> cv
template <class T>
struct unwrap_cv_reference
{
typedef typename mpl::eval_if<
is_cv_reference_wrapper<T>
, get_type<T>
, mpl::identity<T>
>::type type;
};
#endif
template <typename U>
::boost::parameter::aux::yes_tag
is_cv_reference_wrapper_check(
::boost::reference_wrapper<U> const volatile*
);
::boost::parameter::aux::no_tag is_cv_reference_wrapper_check(...);
}}} // namespace boost::parameter::aux
#endif // UNWRAP_CV_REFERENCE_050328_HPP
#include <boost/parameter/config.hpp>
#if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
#include <functional>
namespace boost { namespace parameter { namespace aux {
// Support for std::ref(x) -- Cromwell D. Enage
template <typename U>
::boost::parameter::aux::yes_tag
is_cv_reference_wrapper_check(
::std::reference_wrapper<U> const volatile*
);
}}} // namespace boost::parameter::aux
#endif
#include <boost/parameter/aux_/preprocessor/nullptr.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11) && !( \
BOOST_WORKAROUND(BOOST_MSVC, >= 1900) && \
BOOST_WORKAROUND(BOOST_MSVC, < 1910) \
)
#include <boost/mp11/integral.hpp>
#include <boost/mp11/utility.hpp>
#include <type_traits>
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11) || MSVC-14.0
#include <boost/mpl/bool.hpp>
#include <boost/type_traits/remove_reference.hpp>
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) && \
!BOOST_WORKAROUND(BOOST_GCC, < 40000)
#include <boost/mpl/eval_if.hpp>
#endif
#endif // BOOST_PARAMETER_CAN_USE_MP11 && not MSVC-14.0
namespace boost { namespace parameter { namespace aux {
#if defined(BOOST_PARAMETER_CAN_USE_MP11) && !( \
BOOST_WORKAROUND(BOOST_MSVC, >= 1900) && \
BOOST_WORKAROUND(BOOST_MSVC, < 1910) \
)
// This metafunction returns mp11::mp_true if T is of type
// reference_wrapper<U> cv.
template <typename T>
using is_cv_reference_wrapper = ::boost::mp11::mp_bool<
sizeof(
::boost::parameter::aux::is_cv_reference_wrapper_check(
static_cast<
typename ::std::remove_reference<T>::type*
>(BOOST_PARAMETER_AUX_PP_NULLPTR)
)
) == sizeof(::boost::parameter::aux::yes_tag)
>;
// Needed for unwrap_cv_reference below. T might be const, so
// mp_eval_if<> might fail because of deriving from T const on EDG.
template <typename T>
using unwrap_cv_reference_impl = typename ::std::remove_reference<T>::type;
// Produces the unwrapped type to hold a reference to in
// tagged_argument<>. Can't use boost::unwrap_reference<> here
// because it doesn't handle the case where T = reference_wrapper<U> cv.
template <typename T>
using unwrap_cv_reference = ::boost::mp11::mp_eval_if<
::boost::parameter::aux::is_cv_reference_wrapper<T>
, ::boost::parameter::aux::unwrap_cv_reference_impl<T>
, ::std::remove_reference
, T
>;
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11) || MSVC-14.0
// This metafunction returns mpl::true_ if T is of type
// reference_wrapper<U> cv.
template <typename T>
struct is_cv_reference_wrapper
{
BOOST_STATIC_CONSTANT(
bool, value = (
sizeof(
::boost::parameter::aux::is_cv_reference_wrapper_check(
static_cast<
typename ::boost::remove_reference<T>::type*
>(BOOST_PARAMETER_AUX_PP_NULLPTR)
)
) == sizeof(::boost::parameter::aux::yes_tag)
)
);
typedef boost::mpl::bool_<
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
is_cv_reference_wrapper::
#endif
value> type;
};
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) || \
BOOST_WORKAROUND(BOOST_GCC, < 40000)
template <
typename T
, typename = typename ::boost::parameter::aux
::is_cv_reference_wrapper<T>::type
>
struct unwrap_cv_reference : ::boost::remove_reference<T>
{
};
template <typename T>
struct unwrap_cv_reference<T const,::boost::mpl::false_>
{
typedef T const type;
};
template <typename T>
struct unwrap_cv_reference<T,::boost::mpl::true_> : T
{
};
#else // no Borland or GCC 3- workarounds needed
// Needed for unwrap_cv_reference below. T might be const, so
// eval_if<> might fail because of deriving from T const on EDG.
template <typename T>
struct unwrap_cv_reference_impl : ::boost::remove_reference<T>::type
{
};
// Produces the unwrapped type to hold a reference to in
// tagged_argument<>. Can't use boost::unwrap_reference<> here
// because it doesn't handle the case where T = reference_wrapper<U> cv.
template <typename T>
struct unwrap_cv_reference
: ::boost::mpl::eval_if<
::boost::parameter::aux::is_cv_reference_wrapper<T>
, ::boost::parameter::aux::unwrap_cv_reference_impl<T>
, ::boost::remove_reference<T>
>
{
};
#endif // Borland or GCC 3- workarounds needed
#endif // BOOST_PARAMETER_CAN_USE_MP11 && not MSVC-14.0
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,17 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// 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)
#ifndef BOOST_PARAMETER_AUX_USE_DEFAULT_HPP
#define BOOST_PARAMETER_AUX_USE_DEFAULT_HPP
namespace boost { namespace parameter { namespace aux {
struct use_default
{
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -0,0 +1,29 @@
// Copyright Daniel Wallin 2006.
// 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)
#ifndef BOOST_PARAMETER_USE_DEFAULT_TAG_HPP
#define BOOST_PARAMETER_USE_DEFAULT_TAG_HPP
#include <boost/config.hpp>
namespace boost { namespace parameter { namespace aux {
struct use_default_tag
{
inline BOOST_CONSTEXPR BOOST_DEFAULTED_FUNCTION(use_default_tag(), {})
inline BOOST_CONSTEXPR BOOST_DEFAULTED_FUNCTION(
use_default_tag(use_default_tag const&), {}
)
inline BOOST_CONSTEXPR use_default_tag operator()() const
{
return *this;
}
};
}}} // namespace boost::parameter::aux
#endif // include guard

49
include/boost/parameter/aux_/void.hpp Executable file → Normal file
View File

@@ -1,29 +1,38 @@
// Copyright Daniel Wallin, David Abrahams 2005. Use, modification and
// distribution is subject to the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// Copyright Daniel Wallin, David Abrahams 2005.
// 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)
#ifndef BOOST_PARAMETER_VOID_050329_HPP
#define BOOST_PARAMETER_VOID_050329_HPP
namespace boost { namespace parameter {
// A placemarker for "no argument passed."
// MAINTAINER NOTE: Do not make this into a metafunction
struct void_ {};
namespace aux
{
inline void_& void_reference()
{
static void_ instance;
return instance;
}
} // namespace aux
namespace boost { namespace parameter {
// A placemarker for "no argument passed."
// MAINTAINER NOTE: Do not make this into a metafunction
struct void_
{
};
}} // namespace boost::parameter
#endif // BOOST_PARAMETER_VOID_050329_HPP
namespace boost { namespace parameter { namespace aux {
inline ::boost::parameter::void_& void_reference()
{
static ::boost::parameter::void_ instance;
return instance;
}
}}} // namespace boost::parameter::aux
#include <boost/config/workaround.hpp>
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
namespace boost { namespace parameter { namespace aux {
typedef void* voidstar;
}}} // namespace boost::parameter::aux
#endif
#endif // include guard

Some files were not shown because too many files have changed in this diff Show More