mirror of
https://github.com/boostorg/parameter.git
synced 2026-01-19 16:32:13 +00:00
Compare commits
452 Commits
svn-tags/d
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9984eff746 | ||
|
|
2592296b41 | ||
|
|
923aedf577 | ||
|
|
67861ef6ad | ||
|
|
a526242486 | ||
|
|
c86e3e4dec | ||
|
|
253b11d0df | ||
|
|
248b911831 | ||
|
|
530564aa2a | ||
|
|
e67ba43bc9 | ||
|
|
782f1b14a9 | ||
|
|
1e842b3f34 | ||
|
|
a5a7e548db | ||
|
|
c142f7bdc2 | ||
|
|
dadb7c1222 | ||
|
|
ea493c7cd7 | ||
|
|
f31a7acfcc | ||
|
|
c07f2b8d37 | ||
|
|
c540c03077 | ||
|
|
40a1a578a0 | ||
|
|
d830d33246 | ||
|
|
0915736af0 | ||
|
|
5db4ec8318 | ||
|
|
9328dbb7c3 | ||
|
|
c4a9b94080 | ||
|
|
8fe5cf5d0d | ||
|
|
6538609cf5 | ||
|
|
02e1c566f7 | ||
|
|
b35192723c | ||
|
|
e1f75be395 | ||
|
|
fae4c2dacc | ||
|
|
665cdbc94c | ||
|
|
df9ea43b66 | ||
|
|
0376be4112 | ||
|
|
c82f2ec688 | ||
|
|
9780d8338f | ||
|
|
b06ee2bf8a | ||
|
|
d52fef9cb1 | ||
|
|
56bd845cff | ||
|
|
d95a1617a1 | ||
|
|
7192dd51a9 | ||
|
|
40f362bea3 | ||
|
|
badc449092 | ||
|
|
a1986ac445 | ||
|
|
94bfc0544a | ||
|
|
91b5d79782 | ||
|
|
aeb122089c | ||
|
|
27d0bfaf8c | ||
|
|
e38b1160ae | ||
|
|
6f4cdc939d | ||
|
|
63104db02c | ||
|
|
8f1405b880 | ||
|
|
c397e90107 | ||
|
|
b3ed2d1bcf | ||
|
|
3eada7d595 | ||
|
|
9f0b903f88 | ||
|
|
187377089a | ||
|
|
983bf6bebc | ||
|
|
e16f1025d7 | ||
|
|
7d168437b7 | ||
|
|
d59eb4aadd | ||
|
|
9fc61ba8ff | ||
|
|
fb1a25471c | ||
|
|
59306fe2ed | ||
|
|
201a7e20d0 | ||
|
|
c31433af1f | ||
|
|
0f548424a5 | ||
|
|
ba78e65f93 | ||
|
|
5a2328751a | ||
|
|
e80fba3fd9 | ||
|
|
0d482ed0cf | ||
|
|
1baff677d5 | ||
|
|
a028278ec5 | ||
|
|
3d430b22be | ||
|
|
c2f24094f1 | ||
|
|
a6024c0ec7 | ||
|
|
6037aee098 | ||
|
|
2d7414f095 | ||
|
|
a0ed362e76 | ||
|
|
015aff617b | ||
|
|
e2d589dec7 | ||
|
|
f933d797fe | ||
|
|
979d8091ad | ||
|
|
75e9295748 | ||
|
|
dc6cb9a2fd | ||
|
|
c28195f464 | ||
|
|
3876bdf4b2 | ||
|
|
0bb3ba54da | ||
|
|
8f2cd502bf | ||
|
|
914b0a32c8 | ||
|
|
0ba17c2e2a | ||
|
|
e3849687e4 | ||
|
|
e24f86a7fa | ||
|
|
384cd299ec | ||
|
|
241be29095 | ||
|
|
309dd7e1c1 | ||
|
|
dbf4dd24f5 | ||
|
|
6509aa3bad | ||
|
|
3ced1d1ac8 | ||
|
|
5e80ac9882 | ||
|
|
7812625cdd | ||
|
|
fd2ecd6924 | ||
|
|
7d1cee2cb7 | ||
|
|
352f6fb4a8 | ||
|
|
2482e7db56 | ||
|
|
52c440a5ae | ||
|
|
9f778f0d62 | ||
|
|
af3411f506 | ||
|
|
66a363b4c6 | ||
|
|
e0b16eb3e9 | ||
|
|
4170d35555 | ||
|
|
541e9ade24 | ||
|
|
3bf8242fe4 | ||
|
|
9bde4a2260 | ||
|
|
f453a586f3 | ||
|
|
7b2d3f6e41 | ||
|
|
2b796a8746 | ||
|
|
e7c2118e91 | ||
|
|
6bce8119bf | ||
|
|
fe73177b6c | ||
|
|
59616f3a0a | ||
|
|
54a3f15a57 | ||
|
|
9a84ed5cdb | ||
|
|
8d1c3f57a1 | ||
|
|
fb5683766b | ||
|
|
977ff25b1b | ||
|
|
4a5356b229 | ||
|
|
69db508992 | ||
|
|
689a9525d4 | ||
|
|
e2896116be | ||
|
|
313cde1d99 | ||
|
|
ead2cb4519 | ||
|
|
a2f68bea6c | ||
|
|
b5f02c0aaa | ||
|
|
515c80fad5 | ||
|
|
b531b64f7b | ||
|
|
1fde7ae869 | ||
|
|
cb267e5125 | ||
|
|
387449a12c | ||
|
|
c465139bc2 | ||
|
|
e5337e2503 | ||
|
|
f2083c84ec | ||
|
|
261819d9bb | ||
|
|
6451c94720 | ||
|
|
b208f3a837 | ||
|
|
cadc4ecbff | ||
|
|
7c9e79aa6e | ||
|
|
b20458faa0 | ||
|
|
f28b14e686 | ||
|
|
5c3dc99d82 | ||
|
|
55e977964a | ||
|
|
7a430fdfd0 | ||
|
|
dab935934e | ||
|
|
5d3964f4b6 | ||
|
|
26cf7a7003 | ||
|
|
0a1cd586c0 | ||
|
|
d5165a3388 | ||
|
|
81406effc8 | ||
|
|
cada51d711 | ||
|
|
a9ee94a21b | ||
|
|
af65130fa1 | ||
|
|
a876a4b400 | ||
|
|
016f949eba | ||
|
|
fe34412116 | ||
|
|
dcef517081 | ||
|
|
c228d46eaf | ||
|
|
250de8367d | ||
|
|
01be812580 | ||
|
|
cbc2663a6c | ||
|
|
dd89b991cf | ||
|
|
ee106a3aa1 | ||
|
|
a5d0ec380f | ||
|
|
28efddc033 | ||
|
|
756b98bf32 | ||
|
|
1626f23369 | ||
|
|
655fb40414 | ||
|
|
a083d58c31 | ||
|
|
6a749bcfb1 | ||
|
|
35cf0d50cd | ||
|
|
a65875a7c9 | ||
|
|
4f776ec9cb | ||
|
|
c65bbf50a3 | ||
|
|
c3c6cf76ca | ||
|
|
b565d53bf8 | ||
|
|
f41a26af82 | ||
|
|
53fa67da1c | ||
|
|
1b2840bfdb | ||
|
|
9179318680 | ||
|
|
7f046f4782 | ||
|
|
aab40aafd0 | ||
|
|
9b8a995b56 | ||
|
|
0283ec60df | ||
|
|
716ccb9d85 | ||
|
|
a93c420fc7 | ||
|
|
a4f295906f | ||
|
|
d5cd72d2fd | ||
|
|
318a460d43 | ||
|
|
c8549fc46d | ||
|
|
302e80397a | ||
|
|
f831585e63 | ||
|
|
a195406157 | ||
|
|
3c494b663f | ||
|
|
3ecf27411b | ||
|
|
e51b85d85f | ||
|
|
b72c8748a2 | ||
|
|
3bd15375ec | ||
|
|
05e7eee563 | ||
|
|
661e8a699e | ||
|
|
e5f96c8766 | ||
|
|
22129376c1 | ||
|
|
7a5d5358b9 | ||
|
|
65af83cdbe | ||
|
|
61d17aeb43 | ||
|
|
87b73e0fc8 | ||
|
|
6d9d61dd3a | ||
|
|
66b4af0125 | ||
|
|
aaf76c5759 | ||
|
|
6a53e1ac6b | ||
|
|
8ad69bc3f3 | ||
|
|
00ac706ad8 | ||
|
|
899891d1a3 | ||
|
|
80e1289bf0 | ||
|
|
9b7eef1fe3 | ||
|
|
dceef04330 | ||
|
|
5fb1ef2871 | ||
|
|
44b34e10f6 | ||
|
|
0112583599 | ||
|
|
77a9508a65 | ||
|
|
cace644c0e | ||
|
|
d526784e05 | ||
|
|
5b554b5f44 | ||
|
|
06a0cc79e5 | ||
|
|
278a728906 | ||
|
|
79e042b590 | ||
|
|
57e3674bdd | ||
|
|
7441b2e72b | ||
|
|
105bde609d | ||
|
|
1f25e851bc | ||
|
|
c54b59f8b7 | ||
|
|
8dcdeb307c | ||
|
|
3eb4c31f6f | ||
|
|
b0785c2931 | ||
|
|
0fdf92a4e3 | ||
|
|
5f5d777691 | ||
|
|
2169c5adb4 | ||
|
|
38ef081b68 | ||
|
|
3fdc70d227 | ||
|
|
8df8cb6417 | ||
|
|
7b3f03cb67 | ||
|
|
42c2996cda | ||
|
|
779fd40e4a | ||
|
|
03c1b24665 | ||
|
|
6fc8feb510 | ||
|
|
deb0c3b8a3 | ||
|
|
2364c383fa | ||
|
|
ce8ce02ef8 | ||
|
|
ff835044e2 | ||
|
|
5e332ad592 | ||
|
|
fb88905a99 | ||
|
|
5d3e39325e | ||
|
|
058b1394f5 | ||
|
|
de183a3b75 | ||
|
|
28a8f75d83 | ||
|
|
2e9b937082 | ||
|
|
61d476d4b6 | ||
|
|
02a59d2091 | ||
|
|
007a24b76c | ||
|
|
672ae1c0ce | ||
|
|
f7829bd91c | ||
|
|
3736a0581e | ||
|
|
6f747e9869 | ||
|
|
b31fc2bb17 | ||
|
|
247536c841 | ||
|
|
fd4a18d490 | ||
|
|
a2da4c32f5 | ||
|
|
a3b5ce8a93 | ||
|
|
612563e0fe | ||
|
|
904e2f5020 | ||
|
|
c303922fe9 | ||
|
|
9a8ad86fd7 | ||
|
|
0461c0a070 | ||
|
|
6ad2d6b207 | ||
|
|
45eebd0b85 | ||
|
|
d6132a7645 | ||
|
|
3462c3dc06 | ||
|
|
bc19656218 | ||
|
|
09cc5cf219 | ||
|
|
dd466e7d54 | ||
|
|
368205ab37 | ||
|
|
9821c1a5f9 | ||
|
|
d3a422ba6e | ||
|
|
aaf00c5449 | ||
|
|
a9a4287f4d | ||
|
|
e1f43668e7 | ||
|
|
3b34198a6f | ||
|
|
49ab4faa2b | ||
|
|
54854d4a3a | ||
|
|
45295c87bc | ||
|
|
0dcd40da74 | ||
|
|
a510824ee4 | ||
|
|
7465ba08d3 | ||
|
|
8dca3b7307 | ||
|
|
51a02e0822 | ||
|
|
a07961f561 | ||
|
|
4e26b448e9 | ||
|
|
b5e57e0024 | ||
|
|
b74489d477 | ||
|
|
475001a591 | ||
|
|
f9e0d1c5c3 | ||
|
|
23ed477c44 | ||
|
|
6427d82103 | ||
|
|
436209fa82 | ||
|
|
9d66bd7632 | ||
|
|
0b0ce28a8a | ||
|
|
bdcbf442bf | ||
|
|
15d8701d77 | ||
|
|
c9cf0ab0f5 | ||
|
|
ee32bc6f67 | ||
|
|
20301b3da4 | ||
|
|
c2177b122c | ||
|
|
59e172adb3 | ||
|
|
359b3a5c3a | ||
|
|
522c1e33b0 | ||
|
|
9f4334c1c1 | ||
|
|
7ff5c4b996 | ||
|
|
298108e7ed | ||
|
|
1b1499b94c | ||
|
|
ae3bfbad46 | ||
|
|
d8a61e4df7 | ||
|
|
82b5cc0208 | ||
|
|
91623e6241 | ||
|
|
4af5c63d46 | ||
|
|
1c2f56c672 | ||
|
|
08b0a74035 | ||
|
|
4c8725641d | ||
|
|
b91cd816c8 | ||
|
|
3cf03f73ca | ||
|
|
f9a2fba9ab | ||
|
|
55792af45f | ||
|
|
04cea6497d | ||
|
|
e054a75533 | ||
|
|
834f245953 | ||
|
|
ef9dfeb2d1 | ||
|
|
e6eda9a776 | ||
|
|
98bcbbad78 | ||
|
|
d9f0e42397 | ||
|
|
0a26a05500 | ||
|
|
8a404e2d67 | ||
|
|
31f9f620fe | ||
|
|
2e725894c6 | ||
|
|
a4b2742095 | ||
|
|
2af6d0439e | ||
|
|
56ddeddfaf | ||
|
|
276d786ed9 | ||
|
|
7689b5b9d0 | ||
|
|
fe43dad724 | ||
|
|
ce2d43c1b5 | ||
|
|
a28883d9ad | ||
|
|
45bac7b579 | ||
|
|
86d7201a99 | ||
|
|
e4e6ba52c4 | ||
|
|
6bb4b0ef8b | ||
|
|
e0416b8343 | ||
|
|
f8a1b652bc | ||
|
|
ccf40a29c1 | ||
|
|
f7611b8a1f | ||
|
|
28ed7b9704 | ||
|
|
493a8b28a5 | ||
|
|
6c3ee189d1 | ||
|
|
32ec272b6d | ||
|
|
4c8c0cce93 | ||
|
|
8fc7ba81cc | ||
|
|
15048a1d82 | ||
|
|
5b2b1a47f8 | ||
|
|
f3764c539e | ||
|
|
3852ff760c | ||
|
|
b67fbdff8f | ||
|
|
916b4d2c2f | ||
|
|
0e263f5602 | ||
|
|
af9b04e7ad | ||
|
|
3c815b31fe | ||
|
|
894dffe6ff | ||
|
|
dbbe37b8c1 | ||
|
|
ce712b8f30 | ||
|
|
c17ea8d26d | ||
|
|
913fa2eb44 | ||
|
|
12c873d3e4 | ||
|
|
1844c27699 | ||
|
|
164c48c018 | ||
|
|
2ac8833532 | ||
|
|
9694b76bf2 | ||
|
|
6556e278c6 | ||
|
|
7c9ddf23e0 | ||
|
|
1a9e89cb8d | ||
|
|
224d313a05 | ||
|
|
6d53a2b914 | ||
|
|
47c53efbaa | ||
|
|
57ef2b6ee9 | ||
|
|
c7296b9a05 | ||
|
|
6a5d61ce3c | ||
|
|
297e85c0f1 | ||
|
|
e887f199e0 | ||
|
|
3a59d2cea3 | ||
|
|
e7bd42b07a | ||
|
|
58bb633dc0 | ||
|
|
3397bafb4a | ||
|
|
b9248d774f | ||
|
|
cc256f0bb3 | ||
|
|
763a09c5aa | ||
|
|
e3b060b3e5 | ||
|
|
07987bc97c | ||
|
|
b59c238a83 | ||
|
|
0791667e33 | ||
|
|
9dfa5a8d9e | ||
|
|
91ffd43483 | ||
|
|
3d0bdf694c | ||
|
|
fa751e022e | ||
|
|
b5c6e05ea0 | ||
|
|
1f6c9a3034 | ||
|
|
cc2a478afc | ||
|
|
6c209395aa | ||
|
|
1dab8a1008 | ||
|
|
5231f04b27 | ||
|
|
c7258e9c9e | ||
|
|
4facdaafc3 | ||
|
|
22a1f905e9 | ||
|
|
5190f65321 | ||
|
|
0417a36693 | ||
|
|
d42b860b8d | ||
|
|
0335832574 | ||
|
|
c5168be5d7 | ||
|
|
b9f287ea52 | ||
|
|
c29a75c9df | ||
|
|
28f98ecbf0 | ||
|
|
4e8c8ced0f | ||
|
|
e18d621508 | ||
|
|
40399d3505 | ||
|
|
d6db8c6216 | ||
|
|
38817a8bb5 | ||
|
|
646c519dc0 | ||
|
|
cb501f9f38 | ||
|
|
7eb7737095 | ||
|
|
bfc5811fdc | ||
|
|
1f8f44b26c | ||
|
|
6729c38504 | ||
|
|
cf5d2c46f5 | ||
|
|
49e928273d | ||
|
|
00bbfbb20c | ||
|
|
ca120a3f04 | ||
|
|
e2b452c1f4 | ||
|
|
6695f76c5f | ||
|
|
bf25a637c8 |
607
.github/workflows/ci.yml
vendored
Normal file
607
.github/workflows/ci.yml
vendored
Normal 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
|
||||
34
CMakeLists.txt
Normal file
34
CMakeLists.txt
Normal file
@@ -0,0 +1,34 @@
|
||||
# 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
|
||||
)
|
||||
|
||||
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
|
||||
|
||||
add_subdirectory(test)
|
||||
|
||||
endif()
|
||||
|
||||
26
README.md
Normal file
26
README.md
Normal 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) | [](https://github.com/boostorg/parameter/actions?query=branch%3Amaster) | [](https://ci.appveyor.com/project/Lastique/parameter/branch/master) | [](https://regression.boost.io/master/developer/parameter.html) | [](https://pdimov.github.io/boostdep-report/master/parameter.html)
|
||||
[`develop`](https://github.com/boostorg/parameter/tree/develop) | [](https://github.com/boostorg/parameter/actions?query=branch%3Adevelop) | [](https://ci.appveyor.com/project/Lastique/parameter/branch/develop) | [](https://regression.boost.io/develop/developer/parameter.html) | [](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
75
appveyor.yml
Normal 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
32
build.jam
Normal 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
8
config/Jamfile.v2
Normal 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 ;
|
||||
18
config/graph_supported.cpp
Normal file
18
config/graph_supported.cpp
Normal 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
12
doc/Jamfile.v2
Executable file → Normal 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 ;
|
||||
|
||||
3152
doc/html/index.html
Executable file → Normal file
3152
doc/html/index.html
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,750 +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.5: http://docutils.sourceforge.net/" />
|
||||
<title>The Boost Parameter Library Python Binding Documentation</title>
|
||||
<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>
|
||||
|
||||
<p><a class="reference" href="../../../../index.htm"><img alt="Boost" src="../../../../boost.png" /></a></p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Authors:</th><td class="field-body">Daniel Wallin</td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">Contact:</th><td class="field-body"><a class="reference" href="mailto:dalwan01@student.umu.se">dalwan01@student.umu.se</a></td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">organization:</th><td class="field-body"><a class="reference" href="http://www.boost-consulting.com">Boost Consulting</a></td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">date:</th><td class="field-body">$Date$</td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">copyright:</th><td class="field-body">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" href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="contents topic">
|
||||
<p class="topic-title first"><a id="contents" name="contents">Contents</a></p>
|
||||
<ul class="simple">
|
||||
<li><a class="reference" href="#introduction" id="id7" name="id7">Introduction</a></li>
|
||||
<li><a class="reference" href="#tutorial" id="id8" name="id8">Tutorial</a></li>
|
||||
<li><a class="reference" href="#concept-keywordsspec" id="id9" name="id9">concept <span class="concept">KeywordsSpec</span></a></li>
|
||||
<li><a class="reference" href="#special-keywords" id="id10" name="id10"><em>special</em> keywords</a></li>
|
||||
<li><a class="reference" href="#class-template-init" id="id11" name="id11">class template <tt class="docutils literal"><span class="pre">init</span></tt></a></li>
|
||||
<li><a class="reference" href="#class-template-call" id="id12" name="id12">class template <tt class="docutils literal"><span class="pre">call</span></tt></a></li>
|
||||
<li><a class="reference" href="#class-template-function" id="id13" name="id13">class template <tt class="docutils literal"><span class="pre">function</span></tt></a></li>
|
||||
<li><a class="reference" href="#function-template-def" id="id14" name="id14">function template <tt class="docutils literal"><span class="pre">def</span></tt></a></li>
|
||||
<li><a class="reference" href="#portability" id="id15" name="id15">Portability</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h1><a class="toc-backref" href="#id7" id="introduction" name="introduction">Introduction</a></h1>
|
||||
<p><tt class="docutils literal"><span class="pre">boost/parameter/python.hpp</span></tt> introduces a group of <a class="reference" href="../../../python/doc/v2/def_visitor.html">def_visitors</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>
|
||||
<p>The keyword tags are specified as an <a class="reference" href="../../../mpl/doc/refmanual/sequences.html">MPL Sequence</a>, using the
|
||||
pointer qualifications described in <a class="reference" href="#concept-keywordsspec"><span class="concept">KeywordsSpec</span></a> below. The
|
||||
signature is also specifid as an <a class="reference" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> of parameter
|
||||
types. 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">
|
||||
<h1><a class="toc-backref" href="#id8" id="tutorial" name="tutorial">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" 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 <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))
|
||||
)
|
||||
{
|
||||
<em>…</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" href="../../../python/doc/v2/def_visitor.html">def_visitor</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.</p>
|
||||
<pre class="literal-block">
|
||||
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);
|
||||
}
|
||||
};
|
||||
</pre>
|
||||
<p>The first parameter, <tt class="docutils literal"><span class="pre">boost::type<void></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" 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_<window>("window")
|
||||
.def(
|
||||
"open", py::function<
|
||||
open_fwd
|
||||
, mpl::vector<
|
||||
void
|
||||
, tag::title(std::string)
|
||||
, tag::width*(unsigned)
|
||||
, tag::height*(unsigned)
|
||||
>
|
||||
>()
|
||||
);
|
||||
}
|
||||
</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 three parameters. The first one is the class
|
||||
with forwarding overloads that we defined earlier. The second one is
|
||||
an <a class="reference" href="../../../mpl/doc/refmanual/sequences.html">MPL Sequence</a> with the keyword tag types for the function. The
|
||||
pointer syntax means that the parameter is optional, so in this case
|
||||
<tt class="docutils literal"><span class="pre">width</span></tt> and <tt class="docutils literal"><span class="pre">height</span></tt> are optional parameters. The third parameter
|
||||
is an <a class="reference" href="../../../mpl/doc/refmanual/sequences.html">MPL Sequence</a> with the desired function signature. The return type comes first, and
|
||||
then the parameter types:</p>
|
||||
<pre class="literal-block">
|
||||
mpl::vector<void, std::string, unsigned, unsigned>
|
||||
<em>return type</em> <em>title</em> <em>width</em> <em>height</em>
|
||||
</pre>
|
||||
<!-- @ignore() -->
|
||||
<p>That's it! This class can now be used in Python with the expected syntax:</p>
|
||||
<pre class="literal-block">
|
||||
>>> w = my_module.window()
|
||||
>>> w.open(title = "foo", 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">
|
||||
<h1><a class="toc-backref" href="#id9" id="concept-keywordsspec" name="concept-keywordsspec">concept <span class="concept">KeywordsSpec</span></a></h1>
|
||||
<p>A <span class="concept">KeywordsSpec</span> is an <a class="reference" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element is either:</p>
|
||||
<ul class="simple">
|
||||
<li>A <em>required</em> keyword of the form <tt class="docutils literal"><span class="pre">K</span></tt></li>
|
||||
<li><strong>or</strong>, an <em>optional</em> keyword of the form <tt class="docutils literal"><span class="pre">K*</span></tt></li>
|
||||
<li><strong>or</strong>, a <em>special</em> keyword of the form <tt class="docutils literal"><span class="pre">K**</span></tt></li>
|
||||
</ul>
|
||||
<p>where <tt class="docutils literal"><span class="pre">K</span></tt> is a keyword tag type, as used in a specialization
|
||||
of boost::parameter::<a class="reference" href="../../../parameter/doc/html/reference.html#keyword">keyword</a>.</p>
|
||||
<p>The <strong>arity range</strong> of a <span class="concept">KeywordsSpec</span> is defined as the closed
|
||||
range:</p>
|
||||
<pre class="literal-block">
|
||||
[ mpl::size<S> - number of <em>special</em> keyword tags in <tt class="docutils literal"><span class="pre">S</span></tt> , mpl::size<S> ]
|
||||
</pre>
|
||||
<!-- @ignore() -->
|
||||
<p>For example, the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2<x,y></span></tt> is [2,2], the <strong>arity range</strong> of
|
||||
<tt class="docutils literal"><span class="pre">mpl::vector2<x,y*></span></tt> is [2,2] and the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2<x,y**></span></tt> is [1,2].</p>
|
||||
<!-- Don't optional keywords affect the arity range? -->
|
||||
</div>
|
||||
<div class="section">
|
||||
<h1><a class="toc-backref" href="#id10" id="special-keywords" name="special-keywords"><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. An <a class="reference" href="index.html#dispatching-based-on-the-presence-of-a-default">example</a> of this is given in the Boost.Parameter
|
||||
docs. The example uses a different technique, but could also have been written like this:</p>
|
||||
<pre class="literal-block">
|
||||
namespace core
|
||||
{
|
||||
template <class ArgumentPack>
|
||||
void dfs_dispatch(ArgumentPack const& args, mpl::false_)
|
||||
{
|
||||
<em>…compute and use default color map…</em>
|
||||
}
|
||||
|
||||
template <class ArgumentPack, class ColorMap>
|
||||
void dfs_dispatch(ArgumentPack const& args, ColorMap colormap)
|
||||
{
|
||||
<em>…use colormap…</em>
|
||||
}
|
||||
}
|
||||
|
||||
template <class ArgumentPack>
|
||||
void depth_first_search(ArgumentPack const& 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() -->
|
||||
<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. 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 <tt class="docutils literal"><span class="pre">2^N</span></tt>, 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">
|
||||
<h1><a class="toc-backref" href="#id11" id="class-template-init" name="class-template-init">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 <class Keywords, class Signature>
|
||||
struct init : python::def_visitor<init<Keywords, Signature> >
|
||||
{
|
||||
template <class Class>
|
||||
void def(Class& class_);
|
||||
};
|
||||
</pre>
|
||||
<!-- @ignore() -->
|
||||
<div class="section">
|
||||
<h2><a id="init-requirements" name="init-requirements"><tt class="docutils literal"><span class="pre">init</span></tt> requirements</a></h2>
|
||||
<ul>
|
||||
<li><p class="first"><tt class="docutils literal"><span class="pre">Keywords</span></tt> is a model of <span class="concept">KeywordsSpec</span>.</p>
|
||||
</li>
|
||||
<li><p class="first"><tt class="docutils literal"><span class="pre">Signature</span></tt> is an MPL sequence of parameter types,
|
||||
in the order dictated by <tt class="docutils literal"><span class="pre">Keywords</span></tt>.</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">Keywords</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>
|
||||
<!-- Limit the width of these table cells. Some rst backend -->
|
||||
<!-- processors actually produce different results depending on the -->
|
||||
<!-- distribution of width. -->
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="id3" name="id3">Example</a></h2>
|
||||
<pre class="literal-block">
|
||||
#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)
|
||||
{
|
||||
<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_<X>("X", no_init)
|
||||
.def(
|
||||
py::init<
|
||||
mpl::vector<tag::x(int), tag::y*(int)>
|
||||
>()
|
||||
);
|
||||
}
|
||||
</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">
|
||||
<h1><a class="toc-backref" href="#id12" id="class-template-call" name="class-template-call">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 <class Keywords, class Signature>
|
||||
struct call : python::def_visitor<call<Keywords, Signature> >
|
||||
{
|
||||
template <class Class>
|
||||
void def(Class& class_);
|
||||
};
|
||||
</pre>
|
||||
<!-- @ignore() -->
|
||||
<div class="section">
|
||||
<h2><a id="call-requirements" name="call-requirements"><tt class="docutils literal"><span class="pre">call</span></tt> requirements</a></h2>
|
||||
<ul>
|
||||
<li><p class="first"><tt class="docutils literal"><span class="pre">Keywords</span></tt> is a model of <span class="concept">KeywordsSpec</span>.</p>
|
||||
</li>
|
||||
<li><p class="first"><tt class="docutils literal"><span class="pre">Signature</span></tt> is an MPL sequence with the types of the keyword parameters,
|
||||
in the order dictated by <tt class="docutils literal"><span class="pre">Keywords</span></tt>, and the return type prepended.</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">Keywords</span></tt>.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="id4" name="id4">Example</a></h2>
|
||||
<pre class="literal-block">
|
||||
#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)
|
||||
{
|
||||
<em>…use args…</em>
|
||||
}
|
||||
|
||||
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(<em>module name</em>)
|
||||
{
|
||||
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)>
|
||||
>()
|
||||
);
|
||||
}
|
||||
</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">
|
||||
<h1><a class="toc-backref" href="#id13" id="class-template-function" name="class-template-function">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 <class Fwd, class Keywords, class Signature>
|
||||
struct function : python::def_visitor<function<Fwd, Keywords, Signature> >
|
||||
{
|
||||
template <class Class, class Options>
|
||||
void def(Class& class_, char const* name, Options const& options);
|
||||
};
|
||||
</pre>
|
||||
<!-- @ignore() -->
|
||||
<div class="section">
|
||||
<h2><a id="function-requirements" name="function-requirements"><tt class="docutils literal"><span class="pre">function</span></tt> requirements</a></h2>
|
||||
<ul>
|
||||
<li><p class="first"><tt class="docutils literal"><span class="pre">Keywords</span></tt> is a model of <span class="concept">KeywordsSpec</span>.</p>
|
||||
</li>
|
||||
<li><p class="first"><tt class="docutils literal"><span class="pre">Signature</span></tt> is an MPL sequence with the types of the keyword parameters,
|
||||
in the order dictated by <tt class="docutils literal"><span class="pre">Keywords</span></tt>, and the return type prepended.</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="40%" />
|
||||
<col width="18%" />
|
||||
<col width="42%" />
|
||||
</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<R>(),</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``…``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">Keywords</span></tt>.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="id5" name="id5">Example</a></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 <span class="concept">KeywordsSpec</span> <tt class="docutils literal"><span class="pre">mpl::vector2<tag::x,</span> <span class="pre">tag::y*></span></tt> has an <strong>arity range</strong>
|
||||
of [2,2], so we only need one forwarding overload.</p>
|
||||
<pre class="literal-block">
|
||||
#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))
|
||||
)
|
||||
{
|
||||
<em>…</em>
|
||||
}
|
||||
};
|
||||
|
||||
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(<em>module name</em>)
|
||||
{
|
||||
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)>
|
||||
>()
|
||||
);
|
||||
}
|
||||
</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">
|
||||
<h1><a class="toc-backref" href="#id14" id="function-template-def" name="function-template-def">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 <class Fwd, class Keywords, class Signature>
|
||||
void def(char const* name);
|
||||
</pre>
|
||||
<!-- @ignore() -->
|
||||
<div class="section">
|
||||
<h2><a id="def-requirements" name="def-requirements"><tt class="docutils literal"><span class="pre">def</span></tt> requirements</a></h2>
|
||||
<ul>
|
||||
<li><p class="first"><tt class="docutils literal"><span class="pre">Keywords</span></tt> is a model of <span class="concept">KeywordsSpec</span>.</p>
|
||||
</li>
|
||||
<li><p class="first"><tt class="docutils literal"><span class="pre">Signature</span></tt> is an MPL sequence of parameters types,
|
||||
in the order dictated by <tt class="docutils literal"><span class="pre">Keywords</span></tt>, with the return type
|
||||
prepended.</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="40%" />
|
||||
<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<R>(),</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``…``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">Keywords</span></tt>.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="id6" name="id6">Example</a></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 <span class="concept">KeywordsSpec</span> <tt class="docutils literal"><span class="pre">mpl::vector2<tag::x,</span> <span class="pre">tag::y*></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 <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, <a class="reference" href="tag::x(int">tag::x(int</a>), <a class="reference" href="tag::y*(int">tag::y*(int</a>)
|
||||
>
|
||||
>("f");
|
||||
}
|
||||
</pre>
|
||||
<!-- @ignore() -->
|
||||
<!-- again, the undefined ``fwd`` identifier. -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h1><a class="toc-backref" href="#id15" id="portability" name="portability">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: 2006-07-26 14:14 UTC.
|
||||
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
7436
doc/html/reference.html
Executable file → Normal file
7436
doc/html/reference.html
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
13
doc/html/rst.css
Executable file → Normal file
13
doc/html/rst.css
Executable file → Normal file
@@ -1,3 +1,8 @@
|
||||
/* 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 "../../../../rst.css";
|
||||
|
||||
div.section div.section div.section dl {
|
||||
@@ -14,8 +19,12 @@ img {
|
||||
}
|
||||
|
||||
span.vellipsis {
|
||||
line-height: 30% ;
|
||||
font-size: 200% ;
|
||||
display: block;
|
||||
width: 5px;
|
||||
height: 22px;
|
||||
background: url("vellipsis.gif");
|
||||
margin-left: 3em;
|
||||
text-indent: -1000px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BIN
doc/html/vellipsis.gif
Normal file
BIN
doc/html/vellipsis.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 62 B |
3387
doc/index.rst
Executable file → Normal file
3387
doc/index.rst
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
771
doc/python.rst
771
doc/python.rst
@@ -1,771 +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.
|
||||
|
||||
::
|
||||
|
||||
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``.
|
||||
|
||||
.. 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. 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. 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*.
|
||||
|
||||
7373
doc/reference.rst
Executable file → Normal file
7373
doc/reference.rst
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
20
include/boost/parameter.hpp
Executable file → Normal file
20
include/boost/parameter.hpp
Executable file → Normal file
@@ -1,18 +1,30 @@
|
||||
// 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.
|
||||
|
||||
#ifndef BOOST_PARAMETER_050401_HPP
|
||||
#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
|
||||
|
||||
|
||||
125
include/boost/parameter/are_tagged_arguments.hpp
Normal file
125
include/boost/parameter/are_tagged_arguments.hpp
Normal 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
|
||||
|
||||
42
include/boost/parameter/aux_/always_true_predicate.hpp
Normal file
42
include/boost/parameter/aux_/always_true_predicate.hpp
Normal 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
|
||||
|
||||
1680
include/boost/parameter/aux_/arg_list.hpp
Executable file → Normal file
1680
include/boost/parameter/aux_/arg_list.hpp
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
25
include/boost/parameter/aux_/as_lvalue.hpp
Normal file
25
include/boost/parameter/aux_/as_lvalue.hpp
Normal 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
|
||||
|
||||
198
include/boost/parameter/aux_/augment_predicate.hpp
Normal file
198
include/boost/parameter/aux_/augment_predicate.hpp
Normal 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
|
||||
|
||||
78
include/boost/parameter/aux_/cast.hpp
Executable file → Normal file
78
include/boost/parameter/aux_/cast.hpp
Executable file → Normal file
@@ -1,76 +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/type_traits/add_reference.hpp>
|
||||
# include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/parameter/aux_/preprocessor/impl/function_cast.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
# 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*>
|
||||
{
|
||||
template <class U>
|
||||
static U& execute(U& value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct cast<void*(T)>
|
||||
: cast<void*>
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct cast<void(T)>
|
||||
{
|
||||
typedef typename boost::add_reference<
|
||||
typename boost::add_const<T>::type
|
||||
>::type reference;
|
||||
|
||||
static reference execute(reference value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
# define BOOST_PARAMETER_FUNCTION_CAST(value, predicate) \
|
||||
boost::parameter::aux::cast<void predicate>::execute(value)
|
||||
|
||||
# endif
|
||||
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // BOOST_PARAMETER_CAST_060902_HPP
|
||||
#endif // include guard
|
||||
|
||||
|
||||
160
include/boost/parameter/aux_/default.hpp
Executable file → Normal file
160
include/boost/parameter/aux_/default.hpp
Executable file → Normal file
@@ -1,67 +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
|
||||
#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
|
||||
|
||||
|
||||
111
include/boost/parameter/aux_/has_nested_template_fn.hpp
Normal file
111
include/boost/parameter/aux_/has_nested_template_fn.hpp
Normal 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
|
||||
|
||||
52
include/boost/parameter/aux_/is_maybe.hpp
Normal file
52
include/boost/parameter/aux_/is_maybe.hpp
Normal 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
|
||||
|
||||
64
include/boost/parameter/aux_/is_placeholder.hpp
Normal file
64
include/boost/parameter/aux_/is_placeholder.hpp
Normal 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
|
||||
|
||||
95
include/boost/parameter/aux_/is_tagged_argument.hpp
Normal file
95
include/boost/parameter/aux_/is_tagged_argument.hpp
Normal 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
|
||||
|
||||
16
include/boost/parameter/aux_/lambda_tag.hpp
Normal file
16
include/boost/parameter/aux_/lambda_tag.hpp
Normal 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
235
include/boost/parameter/aux_/maybe.hpp
Executable file → Normal 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/type_traits/add_const.hpp>
|
||||
# include <boost/optional.hpp>
|
||||
# include <boost/python/detail/referent_storage.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 mpl::if_<
|
||||
is_reference<T>
|
||||
, T
|
||||
, typename add_reference<
|
||||
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
T const
|
||||
# else
|
||||
typename add_const<T>::type
|
||||
# endif
|
||||
>::type
|
||||
>::type reference;
|
||||
|
||||
explicit maybe(T value)
|
||||
: value(value)
|
||||
, constructed(false)
|
||||
{}
|
||||
|
||||
maybe()
|
||||
: constructed(false)
|
||||
{}
|
||||
|
||||
~maybe()
|
||||
{
|
||||
if (constructed)
|
||||
destroy((void(*)(reference))0);
|
||||
}
|
||||
|
||||
reference construct(reference value) const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
template <class U, class V>
|
||||
reference construct(U const& value, void(*)(V&)) const
|
||||
{
|
||||
new (m_storage.bytes) V(value);
|
||||
constructed = true;
|
||||
return *(V*)m_storage.bytes;
|
||||
}
|
||||
|
||||
template <class U>
|
||||
reference construct(U const& value) const
|
||||
{
|
||||
return construct(value, (void(*)(reference))0);
|
||||
}
|
||||
|
||||
template <class U>
|
||||
void destroy(void(*)(U&))
|
||||
{
|
||||
((U*)m_storage.bytes)->~U();
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
|
||||
93
include/boost/parameter/aux_/name.hpp
Normal file
93
include/boost/parameter/aux_/name.hpp
Normal 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
|
||||
|
||||
@@ -1,77 +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::make_arg_list< \
|
||||
BOOST_PP_CAT(PS, n), BOOST_PP_CAT(A, n), aux::tag_keyword_arg
|
||||
|
||||
#define BOOST_PARAMETER_close_list(z, n, text) >
|
||||
|
||||
#define BOOST_PARAMETER_arg_list(n) \
|
||||
mpl::apply_wrap1< \
|
||||
BOOST_PP_ENUM(N, BOOST_PARAMETER_open_list, _) \
|
||||
, mpl::always<aux::empty_arg_list> \
|
||||
BOOST_PP_REPEAT(N, BOOST_PARAMETER_close_list, _) \
|
||||
, unnamed_list>
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(N, class A)>
|
||||
typename BOOST_PARAMETER_arg_list(N)::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, & a)) const
|
||||
{
|
||||
typedef typename BOOST_PARAMETER_arg_list(N)::type arg_tuple;
|
||||
|
||||
return arg_tuple(
|
||||
BOOST_PP_ENUM_PARAMS(N, a)
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
217
include/boost/parameter/aux_/pack/deduce_tag.hpp
Normal file
217
include/boost/parameter/aux_/pack/deduce_tag.hpp
Normal 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
|
||||
|
||||
34
include/boost/parameter/aux_/pack/deduced_item.hpp
Normal file
34
include/boost/parameter/aux_/pack/deduced_item.hpp
Normal 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
|
||||
|
||||
23
include/boost/parameter/aux_/pack/insert_tagged.hpp
Normal file
23
include/boost/parameter/aux_/pack/insert_tagged.hpp
Normal 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
|
||||
|
||||
43
include/boost/parameter/aux_/pack/is_named_argument.hpp
Normal file
43
include/boost/parameter/aux_/pack/is_named_argument.hpp
Normal 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
|
||||
|
||||
47
include/boost/parameter/aux_/pack/item.hpp
Normal file
47
include/boost/parameter/aux_/pack/item.hpp
Normal 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
|
||||
|
||||
438
include/boost/parameter/aux_/pack/make_arg_list.hpp
Normal file
438
include/boost/parameter/aux_/pack/make_arg_list.hpp
Normal 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
|
||||
|
||||
53
include/boost/parameter/aux_/pack/make_deduced_items.hpp
Normal file
53
include/boost/parameter/aux_/pack/make_deduced_items.hpp
Normal 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
|
||||
|
||||
45
include/boost/parameter/aux_/pack/make_items.hpp
Normal file
45
include/boost/parameter/aux_/pack/make_items.hpp
Normal 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
|
||||
|
||||
244
include/boost/parameter/aux_/pack/make_parameter_spec_items.hpp
Normal file
244
include/boost/parameter/aux_/pack/make_parameter_spec_items.hpp
Normal 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
|
||||
|
||||
25
include/boost/parameter/aux_/pack/parameter_requirements.hpp
Normal file
25
include/boost/parameter/aux_/pack/parameter_requirements.hpp
Normal 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
|
||||
|
||||
87
include/boost/parameter/aux_/pack/predicate.hpp
Normal file
87
include/boost/parameter/aux_/pack/predicate.hpp
Normal 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
|
||||
|
||||
142
include/boost/parameter/aux_/pack/satisfies.hpp
Normal file
142
include/boost/parameter/aux_/pack/satisfies.hpp
Normal 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
|
||||
|
||||
59
include/boost/parameter/aux_/pack/tag_deduced.hpp
Normal file
59
include/boost/parameter/aux_/pack/tag_deduced.hpp
Normal 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
|
||||
|
||||
30
include/boost/parameter/aux_/pack/tag_keyword_arg.hpp
Normal file
30
include/boost/parameter/aux_/pack/tag_keyword_arg.hpp
Normal 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
|
||||
|
||||
67
include/boost/parameter/aux_/pack/tag_keyword_arg_ref.hpp
Normal file
67
include/boost/parameter/aux_/pack/tag_keyword_arg_ref.hpp
Normal 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
|
||||
|
||||
@@ -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
|
||||
|
||||
89
include/boost/parameter/aux_/pack/tag_type.hpp
Normal file
89
include/boost/parameter/aux_/pack/tag_type.hpp
Normal 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
|
||||
|
||||
41
include/boost/parameter/aux_/pack/unmatched_argument.hpp
Normal file
41
include/boost/parameter/aux_/pack/unmatched_argument.hpp
Normal 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
27
include/boost/parameter/aux_/parameter_requirements.hpp
Executable file → Normal 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
123
include/boost/parameter/aux_/parenthesized_type.hpp
Executable file → Normal 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
|
||||
|
||||
91
include/boost/parameter/aux_/pp_impl/argument_pack.hpp
Normal file
91
include/boost/parameter/aux_/pp_impl/argument_pack.hpp
Normal 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
|
||||
|
||||
55
include/boost/parameter/aux_/pp_impl/match.hpp
Normal file
55
include/boost/parameter/aux_/pp_impl/match.hpp
Normal 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
|
||||
|
||||
97
include/boost/parameter/aux_/pp_impl/unwrap_predicate.hpp
Normal file
97
include/boost/parameter/aux_/pp_impl/unwrap_predicate.hpp
Normal 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
|
||||
|
||||
1638
include/boost/parameter/aux_/preprocessor/binary_seq_for_each.hpp
Normal file
1638
include/boost/parameter/aux_/preprocessor/binary_seq_for_each.hpp
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
83
include/boost/parameter/aux_/preprocessor/flatten.hpp
Executable file → Normal file
83
include/boost/parameter/aux_/preprocessor/flatten.hpp
Executable file → Normal file
@@ -1,81 +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/selection/max.hpp>
|
||||
# include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_trailing.hpp>
|
||||
#include <boost/parameter/aux_/preprocessor/impl/flatten.hpp>
|
||||
|
||||
# include <boost/parameter/aux_/preprocessor/for_each.hpp>
|
||||
|
||||
# define BOOST_PARAMETER_FLATTEN_SPLIT_required required,
|
||||
# define BOOST_PARAMETER_FLATTEN_SPLIT_optional optional,
|
||||
|
||||
# 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) \
|
||||
BOOST_PARAMETER_FOR_EACH_R( \
|
||||
r \
|
||||
, arity \
|
||||
, BOOST_PARAMETER_FLATTEN_ARGS(spec) \
|
||||
, (arity, max_arity, BOOST_PARAMETER_FLATTEN_QUALIFIER(spec)) \
|
||||
, BOOST_PARAMETER_FLATTEN_SPEC0 \
|
||||
)
|
||||
|
||||
# define BOOST_PARAMETER_FLATTEN_SPEC(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 \
|
||||
)
|
||||
|
||||
# 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
105
include/boost/parameter/aux_/preprocessor/for_each.hpp
Executable file → Normal 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
|
||||
|
||||
|
||||
1029
include/boost/parameter/aux_/preprocessor/for_each_pred.hpp
Normal file
1029
include/boost/parameter/aux_/preprocessor/for_each_pred.hpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
143
include/boost/parameter/aux_/preprocessor/impl/flatten.hpp
Normal file
143
include/boost/parameter/aux_/preprocessor/impl/flatten.hpp
Normal 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
|
||||
|
||||
152
include/boost/parameter/aux_/preprocessor/impl/for_each.hpp
Normal file
152
include/boost/parameter/aux_/preprocessor/impl/for_each.hpp
Normal 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
|
||||
|
||||
@@ -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
|
||||
|
||||
730
include/boost/parameter/aux_/preprocessor/impl/function_cast.hpp
Normal file
730
include/boost/parameter/aux_/preprocessor/impl/function_cast.hpp
Normal 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
152
include/boost/parameter/aux_/preprocessor/impl/function_name.hpp
Normal file
152
include/boost/parameter/aux_/preprocessor/impl/function_name.hpp
Normal 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
109
include/boost/parameter/aux_/preprocessor/impl/specification.hpp
Normal file
109
include/boost/parameter/aux_/preprocessor/impl/specification.hpp
Normal 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
|
||||
|
||||
@@ -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
|
||||
|
||||
78
include/boost/parameter/aux_/preprocessor/inc_binary_seq.hpp
Normal file
78
include/boost/parameter/aux_/preprocessor/inc_binary_seq.hpp
Normal 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
|
||||
|
||||
31
include/boost/parameter/aux_/preprocessor/is_binary.hpp
Normal file
31
include/boost/parameter/aux_/preprocessor/is_binary.hpp
Normal 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
|
||||
|
||||
32
include/boost/parameter/aux_/preprocessor/is_nullary.hpp
Normal file
32
include/boost/parameter/aux_/preprocessor/is_nullary.hpp
Normal 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
|
||||
|
||||
@@ -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) \
|
||||
>,
|
||||
/**/
|
||||
|
||||
@@ -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
|
||||
|
||||
18
include/boost/parameter/aux_/preprocessor/nullptr.hpp
Normal file
18
include/boost/parameter/aux_/preprocessor/nullptr.hpp
Normal 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
|
||||
|
||||
92
include/boost/parameter/aux_/preprocessor/overloads.hpp
Normal file
92
include/boost/parameter/aux_/preprocessor/overloads.hpp
Normal 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
|
||||
|
||||
88
include/boost/parameter/aux_/preprocessor/qualifier.hpp
Normal file
88
include/boost/parameter/aux_/preprocessor/qualifier.hpp
Normal 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
|
||||
|
||||
26
include/boost/parameter/aux_/preprocessor/seq_enum.hpp
Normal file
26
include/boost/parameter/aux_/preprocessor/seq_enum.hpp
Normal 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
|
||||
|
||||
1807
include/boost/parameter/aux_/preprocessor/seq_merge.hpp
Normal file
1807
include/boost/parameter/aux_/preprocessor/seq_merge.hpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,131 +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/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()
|
||||
{
|
||||
return M()(boost::type<R>());
|
||||
}
|
||||
};
|
||||
|
||||
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
|
||||
|
||||
@@ -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
71
include/boost/parameter/aux_/result_of0.hpp
Executable file → Normal 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
|
||||
|
||||
118
include/boost/parameter/aux_/set.hpp
Normal file
118
include/boost/parameter/aux_/set.hpp
Normal file
@@ -0,0 +1,118 @@
|
||||
// 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
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/list.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
typedef ::boost::mp11::mp_list<> set0;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/mp11/algorithm.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename S, typename K>
|
||||
struct insert_
|
||||
{
|
||||
using type = ::boost::mp11::mp_insert_c<S,0,K>;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
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
182
include/boost/parameter/aux_/tag.hpp
Executable file → Normal 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
|
||||
|
||||
|
||||
1071
include/boost/parameter/aux_/tagged_argument.hpp
Executable file → Normal file
1071
include/boost/parameter/aux_/tagged_argument.hpp
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
38
include/boost/parameter/aux_/tagged_argument_fwd.hpp
Normal file
38
include/boost/parameter/aux_/tagged_argument_fwd.hpp
Normal 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
110
include/boost/parameter/aux_/template_keyword.hpp
Executable file → Normal 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
247
include/boost/parameter/aux_/unwrap_cv_reference.hpp
Executable file → Normal 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
|
||||
|
||||
|
||||
17
include/boost/parameter/aux_/use_default.hpp
Normal file
17
include/boost/parameter/aux_/use_default.hpp
Normal 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
|
||||
|
||||
29
include/boost/parameter/aux_/use_default_tag.hpp
Normal file
29
include/boost/parameter/aux_/use_default_tag.hpp
Normal 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
49
include/boost/parameter/aux_/void.hpp
Executable file → Normal 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
Reference in New Issue
Block a user