mirror of
https://github.com/boostorg/parameter.git
synced 2026-01-19 04:22:13 +00:00
Reinstate C++03 workarounds
Resolve merge conflicts arising from merging PR#23 into boostorg:develop.
This commit is contained in:
160
.travis.yml
160
.travis.yml
@@ -27,7 +27,45 @@ matrix:
|
||||
|
||||
include:
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=11 TEST_SUITE=parameter_all_tests
|
||||
compiler: g++-4.4
|
||||
env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98,0x TEST_SUITE=parameter_all_tests
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.4
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-4.6
|
||||
env: TOOLSET=gcc COMPILER=g++-4.6 CXXSTD=03,0x TEST_SUITE=parameter_all_tests
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11 TEST_SUITE=parameter_all_tests
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11 TEST_SUITE=parameter_all_tests_except_preproc_eval_cat_8
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11 TEST_SUITE=parameter_all_tests_except_preproc_eval_cat_8
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@@ -36,7 +74,7 @@ matrix:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=11,14 TEST_SUITE=parameter_all_tests
|
||||
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14 TEST_SUITE=parameter_all_tests
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@@ -44,6 +82,15 @@ matrix:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03 TEST_SUITE=parameter_all_tests_except_preproc_eval_cat_8
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=11,14,1z TEST_SUITE=parameter_all_tests
|
||||
addons:
|
||||
@@ -53,6 +100,15 @@ matrix:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03 CXXSTD_DIALECT=cxxstd-dialect=gnu TEST_SUITE=parameter_all_tests_except_preproc_eval_cat_8
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=11,14,1z CXXSTD_DIALECT=cxxstd-dialect=gnu TEST_SUITE=parameter_all_tests
|
||||
addons:
|
||||
@@ -62,6 +118,17 @@ matrix:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
dist: trusty
|
||||
compiler: g++-7
|
||||
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03 TEST_SUITE=parameter_all_tests_except_preproc_eval_cat_8
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
dist: trusty
|
||||
compiler: g++-7
|
||||
@@ -73,6 +140,17 @@ matrix:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
dist: trusty
|
||||
compiler: g++-7
|
||||
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03 CXXSTD_DIALECT=cxxstd-dialect=gnu TEST_SUITE=parameter_all_tests_except_preproc_eval_cat_8
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
dist: trusty
|
||||
compiler: g++-7
|
||||
@@ -84,6 +162,16 @@ matrix:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-8
|
||||
env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03 TEST_SUITE=parameter_all_tests_except_preproc_eval_cat_8
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-8
|
||||
env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=11,14,17 TEST_SUITE=parameter_all_tests
|
||||
@@ -95,7 +183,7 @@ matrix:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=11 TEST_SUITE=parameter_all_tests
|
||||
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11 TEST_SUITE=parameter_all_tests
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@@ -105,7 +193,7 @@ matrix:
|
||||
- llvm-toolchain-precise-3.5
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=11 TEST_SUITE=parameter_all_tests
|
||||
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11 TEST_SUITE=parameter_all_tests
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@@ -115,7 +203,7 @@ matrix:
|
||||
- llvm-toolchain-precise-3.6
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=11 TEST_SUITE=parameter_all_tests
|
||||
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11 TEST_SUITE=parameter_all_tests
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@@ -124,6 +212,16 @@ matrix:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.7
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03 TEST_SUITE=parameter_all_tests_cxx03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=11 TEST_SUITE=parameter_all_tests
|
||||
addons:
|
||||
@@ -144,6 +242,16 @@ matrix:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03 TEST_SUITE=parameter_all_tests_cxx03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.9
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.9
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=11 TEST_SUITE=parameter_all_tests
|
||||
addons:
|
||||
@@ -164,6 +272,17 @@ matrix:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.9
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-4.0
|
||||
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03 TEST_SUITE=parameter_all_tests_cxx03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-4.0
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-4.0
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-4.0
|
||||
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=11 TEST_SUITE=parameter_all_tests
|
||||
@@ -186,6 +305,17 @@ matrix:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-4.0
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-5.0
|
||||
env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03 TEST_SUITE=parameter_all_tests_cxx03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-5.0
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-5.0
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-5.0
|
||||
env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=11 TEST_SUITE=parameter_all_tests
|
||||
@@ -208,6 +338,16 @@ matrix:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-5.0
|
||||
|
||||
- os: linux
|
||||
compiler: clang++
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03 TEST_SUITE=parameter_all_tests_cxx03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libstdc++-5-dev
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: clang++
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=11,14,1z TEST_SUITE=parameter_all_tests
|
||||
@@ -220,7 +360,7 @@ matrix:
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-libc++
|
||||
env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=11,14,1z TEST_SUITE=parameter_all_tests
|
||||
env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z TEST_SUITE=parameter_all_tests
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@@ -228,14 +368,18 @@ matrix:
|
||||
|
||||
- os: osx
|
||||
compiler: clang++
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=11,14,1z TEST_SUITE=parameter_all_tests
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z TEST_SUITE=parameter_all_tests
|
||||
|
||||
- os: osx
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03 TEST_SUITE=parameter_slp_tests
|
||||
osx_image: xcode7.3
|
||||
|
||||
- os: osx
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=11,14,1z TEST_SUITE=parameter_all_tests
|
||||
osx_image: xcode7.3
|
||||
|
||||
- os: osx
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=11,14,1z TEST_SUITE=parameter_all_but_python_tests
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z TEST_SUITE=parameter_all_but_python_tests
|
||||
osx_image: xcode8.3
|
||||
|
||||
install:
|
||||
|
||||
19
appveyor.yml
19
appveyor.yml
@@ -15,12 +15,27 @@ branches:
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- ARGS: --toolset=gcc address-model=32
|
||||
TEST_SUITE: parameter_slp_tests
|
||||
PATH: C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin;%PATH%
|
||||
- ARGS: --toolset=gcc address-model=32 linkflags=-Wl,-allow-multiple-definition
|
||||
TEST_SUITE: parameter_slp_tests
|
||||
PATH: C:\MinGW\bin;%PATH%
|
||||
- ARGS: --toolset=gcc address-model=64
|
||||
TEST_SUITE: parameter_all_but_python_tests
|
||||
TEST_SUITE: parameter_sl_tests
|
||||
PATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;%PATH%
|
||||
- ARGS: --toolset=gcc address-model=64 cxxflags=-std=gnu++1z
|
||||
TEST_SUITE: parameter_all_but_python_tests
|
||||
TEST_SUITE: parameter_sl_tests
|
||||
PATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;%PATH%
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
ARGS: --toolset=msvc-9.0 address-model=32
|
||||
TEST_SUITE: parameter_all_tests
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
ARGS: --toolset=msvc-10.0 address-model=32
|
||||
TEST_SUITE: parameter_all_tests
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
ARGS: --toolset=msvc-11.0 address-model=32
|
||||
TEST_SUITE: parameter_msvc11_tests
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
ARGS: --toolset=msvc-12.0 address-model=32
|
||||
TEST_SUITE: parameter_msvc_tests
|
||||
|
||||
@@ -184,19 +184,27 @@ id="id38">4.3 Documentation</a></li>
|
||||
<li><a class="reference internal" href="#portability-considerations"
|
||||
id="id39">5 Portability Considerations</a>
|
||||
<ul class="auto-toc">
|
||||
<li><a class="reference internal" href="#perfect-forwarding-support"
|
||||
id="id40">5.1 Perfect Forwarding Support</a></li>
|
||||
<li><a class="reference internal" href="#no-sfinae-support"
|
||||
id="id41">5.2 No SFINAE Support</a></li>
|
||||
<li><a class="reference internal" href="#no-support-for-result-of"
|
||||
id="id40">5.1 No Support for
|
||||
id="id42">5.3 No Support for
|
||||
<tt class="docutils literal">result_of</tt></a></li>
|
||||
<li><a class="reference internal"
|
||||
href="#compiler-can-t-see-references-in-unnamed-namespace"
|
||||
id="id43">5.4 Compiler Can't See References In Unnamed
|
||||
Namespace</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#python-binding"
|
||||
id="id41">6 Python Binding</a></li>
|
||||
id="id44">6 Python Binding</a></li>
|
||||
<li><a class="reference internal" href="#reference"
|
||||
id="id42">7 Reference</a></li>
|
||||
id="id45">7 Reference</a></li>
|
||||
<li><a class="reference internal" href="#glossary"
|
||||
id="id43">8 Glossary</a></li>
|
||||
id="id46">8 Glossary</a></li>
|
||||
<li><a class="reference internal" href="#acknowledgements"
|
||||
id="id44">9 Acknowledgements</a></li>
|
||||
id="id47">9 Acknowledgements</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
@@ -760,8 +768,11 @@ corresponding names in <tt class="docutils literal">consume(…)</tt> or
|
||||
violate their category constraints, attempt to compile the
|
||||
<a class="reference external" href="../../test/compose.cpp"
|
||||
>test/compose.cpp</a> test program with either the
|
||||
<tt class="docutils literal">LIBS_PARAMETER_TEST_COMPILE_FAILURE_0</tt> macro
|
||||
or the <tt class="docutils literal">LIBS_PARAMETER_TEST_COMPILE_FAILURE_1</tt>
|
||||
<tt class="docutils literal">LIBS_PARAMETER_TEST_COMPILE_FAILURE_0</tt> macro,
|
||||
the <tt class="docutils literal">LIBS_PARAMETER_TEST_COMPILE_FAILURE_1</tt>
|
||||
macro, the
|
||||
<tt class="docutils literal">LIBS_PARAMETER_TEST_COMPILE_FAILURE_2</tt> macro,
|
||||
or the <tt class="docutils literal">LIBS_PARAMETER_TEST_COMPILE_FAILURE_3</tt>
|
||||
macro <tt class="docutils literal">#defined</tt>. You should encounter a
|
||||
compiler error caused by a specific constraint violation.</p>
|
||||
</div>
|
||||
@@ -2531,8 +2542,46 @@ href="http://www.boost.org/regression/release/user/parameter.html">regression
|
||||
test results</a> for the latest Boost release of the Parameter library to see
|
||||
how it fares on your favorite compiler. Additionally, you may need to be
|
||||
aware of the following issues and workarounds for particular compilers.</p>
|
||||
<div class="section" id="perfect-forwarding-support">
|
||||
<h2><a class="toc-backref" href="#id40">5.1 Perfect
|
||||
Forwarding Support</a></h2>
|
||||
<p>If your compiler supports <a class="reference external" href=
|
||||
"http://www.justsoftwaresolutions.co.uk/cplusplus/rvalue_references_and_perfect_forwarding.html"
|
||||
>perfect forwarding</a>, then the Parameter library will
|
||||
<tt class="docutils literal">#define</tt> the macro
|
||||
<a class="reference external"
|
||||
href="reference.html#boost-parameter-has-perfect-forwarding"
|
||||
><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a>
|
||||
unless you disable it manually. If your compiler does not provide this
|
||||
support, then <tt class="docutils literal"
|
||||
>parameter::parameters::operator()</tt> will treat rvalue references as lvalue
|
||||
const references to work around the <a class="reference external"
|
||||
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1385.htm"
|
||||
>forwarding problem</a>, so in certain cases you must wrap
|
||||
<a class="reference external" href="../../../core/doc/html/core/ref.html"
|
||||
><tt class="docutils literal">boost::ref</tt></a> or
|
||||
<a class="reference external"
|
||||
href="http://en.cppreference.com/w/cpp/utility/functional/ref"
|
||||
><tt class="docutils literal">std::ref</tt></a> around any arguments that will
|
||||
be bound to out parameters. The <a class="reference external"
|
||||
href="../../test/evaluate_category.cpp">test/evaluate_category.cpp</a> and
|
||||
<a class="reference external"
|
||||
href="../../test/preprocessor_eval_category.cpp"
|
||||
>test/preprocessor_eval_category.cpp</a> test programs demonstrate this
|
||||
support.</p>
|
||||
</div>
|
||||
<div class="section" id="no-sfinae-support">
|
||||
<h2><a class="toc-backref" href="#id41">5.2 No SFINAE
|
||||
Support</a></h2>
|
||||
<p>Some older compilers don't support SFINAE. If your compiler meets
|
||||
that criterion, then Boost headers will
|
||||
<tt class="docutils literal">#define</tt> the preprocessor symbol
|
||||
<tt class="docutils literal">BOOST_NO_SFINAE</tt>, and parameter-enabled
|
||||
functions won't be removed from the overload set based on their
|
||||
signatures.</p>
|
||||
</div>
|
||||
<div class="section" id="no-support-for-result-of">
|
||||
<h2><a class="toc-backref" href="#id40">5.1 No Support
|
||||
<h2><a class="toc-backref" href="#id42">5.3 No Support
|
||||
for</a> <a class="reference external"
|
||||
href="../../../utility/utility.htm#result_of"
|
||||
><tt class="docutils literal">result_of</tt></a></h2>
|
||||
@@ -2579,9 +2628,29 @@ are unspecified, the workaround is to use
|
||||
|
||||
.. |BOOST_PARAMETER_MATCH| replace:: ``BOOST_PARAMETER_MATCH`` -->
|
||||
</div>
|
||||
<div class="section" id="compiler-can-t-see-references-in-unnamed-namespace">
|
||||
<h2><a class="toc-backref" href="#id43">5.3 Compiler Can't
|
||||
See References In Unnamed Namespace</a></h2>
|
||||
<p>If you use Microsoft Visual C++ 6.x, you may find that the compiler has
|
||||
trouble finding your keyword objects. This problem has been observed, but
|
||||
only on this one compiler, and it disappeared as the test code evolved, so we
|
||||
suggest you use it only as a last resort rather than as a preventative
|
||||
measure. The solution is to add <em>using-declarations</em> to force the
|
||||
names to be available in the enclosing namespace without qualification:</p>
|
||||
<pre class="literal-block">
|
||||
namespace graphs {
|
||||
|
||||
using graphs::graph;
|
||||
using graphs::visitor;
|
||||
using graphs::root_vertex;
|
||||
using graphs::index_map;
|
||||
using graphs::color_map;
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="python-binding">
|
||||
<h1><a class="toc-backref" href="#id41">6 Python
|
||||
<h1><a class="toc-backref" href="#id44">6 Python
|
||||
Binding</a></h1>
|
||||
<p>Follow <a class="reference external"
|
||||
href="../../../parameter_python/doc/html/index.html">this link</a> for
|
||||
@@ -2590,12 +2659,12 @@ with <a class="reference external" href="../../../python/doc/index.html"
|
||||
>Boost.Python</a>.</p>
|
||||
</div>
|
||||
<div class="section" id="reference">
|
||||
<h1><a class="toc-backref" href="#id42">7 Reference</a></h1>
|
||||
<h1><a class="toc-backref" href="#id45">7 Reference</a></h1>
|
||||
<p>Follow <a class="reference external" href="reference.html">this link</a> to
|
||||
the Boost.Parameter reference documentation.</p>
|
||||
</div>
|
||||
<div class="section" id="glossary">
|
||||
<h1><a class="toc-backref" href="#id43">8 Glossary</a></h1>
|
||||
<h1><a class="toc-backref" href="#id46">8 Glossary</a></h1>
|
||||
<table class="docutils field-list" frame="void" id="arguments" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
@@ -2636,7 +2705,7 @@ int y = f(3);
|
||||
</table>
|
||||
</div>
|
||||
<div class="section" id="acknowledgements">
|
||||
<h1><a class="toc-backref" href="#id44"
|
||||
<h1><a class="toc-backref" href="#id47"
|
||||
>9 Acknowledgements</a></h1>
|
||||
<p>The authors would like to thank all the Boosters who participated in the
|
||||
review of this library and its documentation, most especially our review
|
||||
@@ -2721,6 +2790,33 @@ to Herb Sutter.</p>
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="docutils footnote" frame="void" id="sfinae" rules="none">
|
||||
<colgroup><col class="label" /><col /></colgroup>
|
||||
<tbody valign="top">
|
||||
<tr>
|
||||
<td class="label">[7]</td>
|
||||
<td>This capability depends on your compiler's support for
|
||||
SFINAE. <strong>SFINAE</strong>: <strong>S</strong>ubstitution
|
||||
<strong>F</strong>ailure <strong>I</strong>s <strong>N</strong>ot
|
||||
<strong>A</strong>n <strong>E</strong>rror. If type substitution during the
|
||||
instantiation of a function template results in an invalid type, no
|
||||
compilation error is emitted; instead the overload is removed from the
|
||||
overload set. By producing an invalid type in the function signature
|
||||
depending on the result of some condition, we can decide whether or not an
|
||||
overload is considered during overload resolution. The technique is
|
||||
formalized in the <a class="reference external"
|
||||
href="../../../core/doc/html/core/enable_if.html"><tt class="docutils literal"
|
||||
>enable_if</tt></a> utility. Most recent compilers support SFINAE; on
|
||||
compilers that don't support it, the Boost config library will
|
||||
<tt class="docutils literal">#define</tt> the symbol
|
||||
<tt class="docutils literal">BOOST_NO_SFINAE</tt>. See
|
||||
<a class="reference external"
|
||||
href="http://www.semantics.org/once_weakly/w02_SFINAE.pdf"
|
||||
>http://www.semantics.org/once_weakly/w02_SFINAE.pdf</a> for more information
|
||||
on SFINAE.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
117
doc/index.rst
117
doc/index.rst
@@ -674,10 +674,11 @@ names in ``consume(…)`` or ``move_from(…)``.
|
||||
|
||||
In order to see what happens when parameters are bound to arguments that
|
||||
violate their category constraints, attempt to compile the |compose_cpp|_ test
|
||||
program with the ``LIBS_PARAMETER_TEST_COMPILE_FAILURE_0`` macro or the
|
||||
``LIBS_PARAMETER_TEST_COMPILE_FAILURE_1`` macro ``#defined``. You should
|
||||
encounter at least four compiler errors, each corresponding to a specific
|
||||
constraint violation.
|
||||
program with either the ``LIBS_PARAMETER_TEST_COMPILE_FAILURE_0`` macro, the
|
||||
``LIBS_PARAMETER_TEST_COMPILE_FAILURE_1`` macro, the
|
||||
``LIBS_PARAMETER_TEST_COMPILE_FAILURE_2`` macro, or the
|
||||
``LIBS_PARAMETER_TEST_COMPILE_FAILURE_3`` macro ``#defined``. You should
|
||||
encounter a compiler error caused by a specific constraint violation.
|
||||
|
||||
.. @example.prepend('''
|
||||
#include <boost/parameter.hpp>
|
||||
@@ -2504,6 +2505,45 @@ issues and workarounds for particular compilers.
|
||||
|
||||
.. _`regression test results`: http://www.boost.org/regression/release/user/parameter.html
|
||||
|
||||
--------------------------
|
||||
Perfect Forwarding Support
|
||||
--------------------------
|
||||
|
||||
If your compiler supports `perfect forwarding`_, then the Parameter library
|
||||
will ``#define`` the macro ``BOOST_PARAMETER_HAS_PERFECT_FORWARDING`` unless
|
||||
you disable it manually. If your compiler does not provide this support, then
|
||||
``parameter::parameters::operator()`` will treat rvalue references as lvalue
|
||||
const references to work around the `forwarding problem`_, so in certain cases
|
||||
you must wrap |boost_ref|_ or |std_ref|_ around any arguments that will be
|
||||
bound to out parameters. The |evaluate_category|_ and
|
||||
|preprocessor_eval_category|_ test programs demonstrate this support.
|
||||
|
||||
.. _`perfect forwarding`: http://www.justsoftwaresolutions.co.uk/cplusplus/rvalue_references_and_perfect_forwarding.html
|
||||
.. _`forwarding problem`: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1385.htm
|
||||
.. |boost_ref| replace:: ``boost\:\:ref``
|
||||
.. _boost_ref: ../../../core/doc/html/core/ref.html
|
||||
.. |std_ref| replace:: ``std\:\:ref``
|
||||
.. _std_ref: http://en.cppreference.com/w/cpp/utility/functional/ref
|
||||
.. |evaluate_category| replace:: evaluate_category.cpp
|
||||
.. _evaluate_category: ../../test/evaluate_category.cpp
|
||||
.. |preprocessor_eval_category| replace:: preprocessor_eval_category.cpp
|
||||
.. _preprocessor_eval_category: ../../test/preprocessor_eval_category.cpp
|
||||
|
||||
-----------------
|
||||
No SFINAE Support
|
||||
-----------------
|
||||
|
||||
Some older compilers don't support SFINAE. If your compiler meets that
|
||||
criterion, then Boost headers will ``#define`` the preprocessor symbol
|
||||
``BOOST_NO_SFINAE``, and parameter-enabled functions won't be removed
|
||||
from the overload set based on their signatures. The |sfinae_cpp|_ and
|
||||
|optional_deduced_sfinae|_ test programs demonstrate SFINAE support.
|
||||
|
||||
.. |sfinae_cpp| replace:: sfinae.cpp
|
||||
.. _sfinae_cpp: ../../test/sfinae.cpp
|
||||
.. |optional_deduced_sfinae| replace:: optional_deduced_sfinae.cpp
|
||||
.. _optional_deduced_sfinae: ../../test/optional_deduced_sfinae.cpp
|
||||
|
||||
---------------------------
|
||||
No Support for |result_of|_
|
||||
---------------------------
|
||||
@@ -2522,6 +2562,58 @@ function as a default generator on those compilers, you'll need to wrap it in
|
||||
a class that provides ``result_type`` as a ``typedef`` and invokes the
|
||||
function via its ``operator()``.
|
||||
|
||||
---------------------------------------------
|
||||
Can't Declare |ParameterSpec| via ``typedef``
|
||||
---------------------------------------------
|
||||
|
||||
In principle you can declare a |ParameterSpec| as a ``typedef`` for a
|
||||
specialization of ``parameters<…>``, but Microsoft Visual C++ 6.x has been
|
||||
seen to choke on that usage. The workaround is to use inheritance and declare
|
||||
your |ParameterSpec| as a class:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
**struct dfs_parameters
|
||||
:** parameter::parameters<
|
||||
tag::graph, tag::visitor, tag::root_vertex
|
||||
, tag::index_map, tag::color_map
|
||||
>
|
||||
**{
|
||||
};**
|
||||
|
||||
-------------------------------------------------
|
||||
Default Arguments Unsupported on Nested Templates
|
||||
-------------------------------------------------
|
||||
|
||||
As of this writing, Borland compilers don't support the use of default
|
||||
template arguments on member class templates. As a result, you have to supply
|
||||
``BOOST_PARAMETER_MAX_ARITY`` arguments to every use of
|
||||
``parameters<…>::match``. Since the actual defaults used are unspecified, the
|
||||
workaround is to use |BOOST_PARAMETER_MATCH|_ to declare default arguments for
|
||||
SFINAE.
|
||||
|
||||
.. |BOOST_PARAMETER_MATCH| replace:: ``BOOST_PARAMETER_MATCH``
|
||||
|
||||
--------------------------------------------------
|
||||
Compiler Can't See References In Unnamed Namespace
|
||||
--------------------------------------------------
|
||||
|
||||
If you use Microsoft Visual C++ 6.x, you may find that the compiler has
|
||||
trouble finding your keyword objects. This problem has been observed, but
|
||||
only on this one compiler, and it disappeared as the test code evolved, so
|
||||
we suggest you use it only as a last resort rather than as a preventative
|
||||
measure. The solution is to add *using-declarations* to force the names
|
||||
to be available in the enclosing namespace without qualification::
|
||||
|
||||
namespace graphs {
|
||||
|
||||
using graphs::graph;
|
||||
using graphs::visitor;
|
||||
using graphs::root_vertex;
|
||||
using graphs::index_map;
|
||||
using graphs::color_map;
|
||||
}
|
||||
|
||||
==============
|
||||
Python Binding
|
||||
==============
|
||||
@@ -2620,4 +2712,21 @@ lives in an outer namespace by applying a *using-declaration*::
|
||||
This technique for avoiding unintentional argument-dependent lookup is due to
|
||||
Herb Sutter.
|
||||
|
||||
.. [#sfinae] This capability depends on your compiler's support for
|
||||
SFINAE. **SFINAE**: **S**\ ubstitution **F**\ ailure **I**\ s **N**\ ot
|
||||
**A**\ n **E**\ rror. If type substitution during the instantiation of a
|
||||
function template results in an invalid type, no compilation error is emitted;
|
||||
instead the overload is removed from the overload set. By producing an
|
||||
invalid type in the function signature depending on the result of some
|
||||
condition, we can decide whether or not an overload is considered during
|
||||
overload resolution. The technique is formalized in the |enable_if|_
|
||||
utility. Most recent compilers support SFINAE; on compilers that don't
|
||||
support it, the Boost config library will ``#define`` the symbol
|
||||
``BOOST_NO_SFINAE``. See
|
||||
http://www.semantics.org/once_weakly/w02_SFINAE.pdf for more information on
|
||||
SFINAE.
|
||||
|
||||
.. |enable_if| replace:: ``enable_if``
|
||||
.. _enable_if: ../../../core/doc/html/core/enable_if.html
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,9 @@
|
||||
#define BOOST_PARAMETER_050401_HPP
|
||||
|
||||
#include <boost/parameter/parameters.hpp>
|
||||
#include <boost/parameter/required.hpp>
|
||||
#include <boost/parameter/optional.hpp>
|
||||
#include <boost/parameter/deduced.hpp>
|
||||
#include <boost/parameter/keyword.hpp>
|
||||
#include <boost/parameter/binding.hpp>
|
||||
#include <boost/parameter/value_type.hpp>
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#ifndef ARG_LIST_050329_HPP
|
||||
#define ARG_LIST_050329_HPP
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
//
|
||||
@@ -29,6 +27,13 @@ namespace boost { namespace parameter { namespace aux {
|
||||
{
|
||||
typedef typename T::reference type;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
struct value_type_is_void
|
||||
{
|
||||
@@ -39,10 +44,15 @@ namespace boost { namespace parameter { namespace aux {
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/parameter/aux_/yesno.hpp>
|
||||
#include <boost/parameter/aux_/result_of0.hpp>
|
||||
#include <boost/parameter/aux_/default.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
@@ -79,22 +89,6 @@ namespace boost { namespace parameter { namespace aux {
|
||||
template <typename KW>
|
||||
static ::boost::parameter::aux::no_tag has_key(KW*);
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
// The overload set technique doesn't work with these older compilers,
|
||||
// so they need some explicit handholding.
|
||||
|
||||
// A metafunction class that, given a keyword, returns the type of the
|
||||
// base sublist whose get() function can produce the value for that key.
|
||||
struct key_owner
|
||||
{
|
||||
template <typename KW>
|
||||
struct apply
|
||||
{
|
||||
typedef ::boost::parameter::aux::empty_arg_list type;
|
||||
};
|
||||
};
|
||||
#endif // Borland workarounds needed.
|
||||
|
||||
// If either of these operators are called, it means there is no
|
||||
// argument in the list that matches the supplied keyword. Just
|
||||
// return the default value.
|
||||
@@ -149,10 +143,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
#include <boost/mpl/apply_wrap.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#include <boost/tti/detail/dnullptr.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
@@ -280,6 +271,342 @@ namespace boost { namespace parameter { namespace aux {
|
||||
};
|
||||
};
|
||||
|
||||
// Overload for key_type, so the assert below will fire
|
||||
// if the same keyword is used again.
|
||||
static ::boost::parameter::aux::yes_tag has_key(key_type*);
|
||||
using Next::has_key;
|
||||
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
sizeof(
|
||||
Next::has_key(
|
||||
static_cast<key_type*>(BOOST_TTI_DETAIL_NULLPTR)
|
||||
)
|
||||
) == sizeof(::boost::parameter::aux::no_tag)
|
||||
, duplicate_keyword
|
||||
, (key_type)
|
||||
);
|
||||
|
||||
//
|
||||
// Begin implementation of indexing operators
|
||||
// for looking up specific arguments by name.
|
||||
//
|
||||
|
||||
// Helpers that handle the case when TaggedArg is empty<T>.
|
||||
template <typename D>
|
||||
inline reference get_default(D const&, ::boost::mpl::false_) const
|
||||
{
|
||||
return this->arg.get_value();
|
||||
}
|
||||
|
||||
template <typename D>
|
||||
inline reference get_default(D const& d, ::boost::mpl::true_) const
|
||||
{
|
||||
return (
|
||||
this->arg.get_value()
|
||||
? this->arg.get_value().get()
|
||||
: this->arg.get_value().construct(d.value)
|
||||
);
|
||||
}
|
||||
|
||||
inline reference
|
||||
operator[](::boost::parameter::keyword<key_type> const&) const
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((holds_maybe));
|
||||
return this->arg.get_value();
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline reference
|
||||
operator[](
|
||||
::boost::parameter::aux::default_<key_type,Default> const& d
|
||||
) const
|
||||
{
|
||||
return this->get_default(d, holds_maybe());
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline reference
|
||||
operator[](
|
||||
::boost::parameter::aux::default_r_<key_type,Default> const& d
|
||||
) const
|
||||
{
|
||||
return this->get_default(d, holds_maybe());
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline reference
|
||||
operator[](
|
||||
BOOST_PARAMETER_lazy_default_fallback<key_type,Default> const&
|
||||
) const
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((holds_maybe));
|
||||
return this->arg.get_value();
|
||||
}
|
||||
|
||||
// Builds an overload set including operator[]s defined
|
||||
// in base classes.
|
||||
using Next::operator[];
|
||||
|
||||
//
|
||||
// End of indexing support
|
||||
//
|
||||
|
||||
// For parameter_requirements matching this node's key_type, return
|
||||
// a bool constant wrapper indicating whether the requirements are
|
||||
// satisfied by TaggedArg. Used only for compile-time computation
|
||||
// and never really called, so a declaration is enough.
|
||||
template <typename HasDefault, typename Predicate, typename ArgPack>
|
||||
static typename ::boost::mpl::apply_wrap2<
|
||||
::boost::parameter::aux
|
||||
::augment_predicate<Predicate,reference,key_type>
|
||||
, value_type
|
||||
, ArgPack
|
||||
>::type
|
||||
satisfies(
|
||||
::boost::parameter::aux::parameter_requirements<
|
||||
key_type
|
||||
, Predicate
|
||||
, HasDefault
|
||||
>*
|
||||
, ArgPack*
|
||||
);
|
||||
|
||||
// Builds an overload set including satisfies functions defined
|
||||
// in base classes.
|
||||
using Next::satisfies;
|
||||
|
||||
// Comma operator to compose argument list without using parameters<>.
|
||||
// Useful for argument lists with undetermined length.
|
||||
template <typename KW, typename T2>
|
||||
inline ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<KW,T2>
|
||||
, self
|
||||
>
|
||||
operator,(
|
||||
::boost::parameter::aux::tagged_argument<KW,T2> const& x
|
||||
) const
|
||||
{
|
||||
return ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<KW,T2>
|
||||
, self
|
||||
>(x, *this);
|
||||
}
|
||||
|
||||
template <typename KW, typename T2>
|
||||
inline ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument_rref<KW,T2>
|
||||
, self
|
||||
>
|
||||
operator,(
|
||||
::boost::parameter::aux::tagged_argument_rref<KW,T2> const& x
|
||||
) const
|
||||
{
|
||||
return ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument_rref<KW,T2>
|
||||
, self
|
||||
>(x, *this);
|
||||
}
|
||||
|
||||
// MPL sequence support
|
||||
typedef self type; // Convenience for users
|
||||
typedef Next tail_type; // For the benefit of iterators
|
||||
// For dispatching to sequence intrinsics
|
||||
typedef ::boost::parameter::aux::arg_list_tag tag;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// Terminates arg_list<> and represents an empty list. Since this is just
|
||||
// the terminating case, you might want to look at arg_list first to get a
|
||||
// feel for what's really happening here.
|
||||
struct empty_arg_list
|
||||
{
|
||||
inline empty_arg_list()
|
||||
{
|
||||
}
|
||||
|
||||
// Constructor taking BOOST_PARAMETER_MAX_ARITY empty_arg_list
|
||||
// arguments; this makes initialization.
|
||||
inline empty_arg_list(
|
||||
BOOST_PP_ENUM_PARAMS(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, ::boost::parameter::void_ BOOST_PP_INTERCEPT
|
||||
)
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
// A metafunction class that, given a keyword and a default type,
|
||||
// returns the appropriate result type for a keyword lookup given
|
||||
// that default.
|
||||
struct binding
|
||||
{
|
||||
template <typename KW, typename Default, typename Reference>
|
||||
struct apply
|
||||
{
|
||||
typedef Default type;
|
||||
};
|
||||
};
|
||||
|
||||
// Terminator for has_key, indicating that the keyword is unique.
|
||||
template <typename KW>
|
||||
static ::boost::parameter::aux::no_tag has_key(KW*);
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
// The overload set technique doesn't work with these older compilers,
|
||||
// so they need some explicit handholding.
|
||||
|
||||
// A metafunction class that, given a keyword, returns the type of the
|
||||
// base sublist whose get() function can produce the value for that key.
|
||||
struct key_owner
|
||||
{
|
||||
template <typename KW>
|
||||
struct apply
|
||||
{
|
||||
typedef ::boost::parameter::aux::empty_arg_list type;
|
||||
};
|
||||
};
|
||||
#endif // Borland workarounds needed.
|
||||
|
||||
// If either of these operators are called, it means there is no
|
||||
// argument in the list that matches the supplied keyword. Just
|
||||
// return the default value.
|
||||
template <typename K, typename Default>
|
||||
inline Default&
|
||||
operator[](::boost::parameter::aux::default_<K,Default> x) const
|
||||
{
|
||||
return x.value;
|
||||
}
|
||||
|
||||
// If this operator is called, it means there is no argument in the
|
||||
// list that matches the supplied keyword. Just evaluate and return
|
||||
// the default value.
|
||||
template <typename K, typename F>
|
||||
inline typename ::boost::parameter::aux::result_of0<F>::type
|
||||
operator[](BOOST_PARAMETER_lazy_default_fallback<K,F> x) const
|
||||
{
|
||||
return x.compute_default();
|
||||
}
|
||||
|
||||
// No argument corresponding to ParameterRequirements::key_type
|
||||
// was found if we match this overload, so unless that parameter
|
||||
// has a default, we indicate that the actual arguments don't
|
||||
// match the function's requirements.
|
||||
template <typename ParameterRequirements, typename ArgPack>
|
||||
static typename ParameterRequirements::has_default
|
||||
satisfies(ParameterRequirements*, ArgPack*);
|
||||
|
||||
// MPL sequence support
|
||||
typedef ::boost::parameter::aux::empty_arg_list type; // convenience
|
||||
// For dispatching to sequence intrinsics
|
||||
typedef ::boost::parameter::aux::arg_list_tag tag;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/aux_/yesno.hpp>
|
||||
#include <boost/parameter/aux_/is_maybe.hpp>
|
||||
#include <boost/parameter/aux_/tagged_argument_fwd.hpp>
|
||||
#include <boost/parameter/aux_/parameter_requirements.hpp>
|
||||
#include <boost/parameter/aux_/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/mpl/apply_wrap.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#include <boost/tti/detail/dnullptr.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// A tuple of tagged arguments, terminated with empty_arg_list. Every
|
||||
// TaggedArg is an instance of tagged_argument<>.
|
||||
template <
|
||||
typename TaggedArg
|
||||
, typename Next = ::boost::parameter::aux::empty_arg_list
|
||||
>
|
||||
struct arg_list : Next
|
||||
{
|
||||
typedef TaggedArg tagged_arg;
|
||||
typedef ::boost::parameter::aux::arg_list<TaggedArg,Next> self;
|
||||
typedef typename TaggedArg::key_type key_type;
|
||||
|
||||
typedef typename ::boost::parameter::aux
|
||||
::is_maybe<typename TaggedArg::value_type>::type holds_maybe;
|
||||
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
holds_maybe
|
||||
, ::boost::parameter::aux
|
||||
::get_reference<typename TaggedArg::value_type>
|
||||
, ::boost::parameter::aux::get_reference<TaggedArg>
|
||||
>::type reference;
|
||||
|
||||
typedef typename ::boost::mpl::if_<
|
||||
holds_maybe
|
||||
, reference
|
||||
, typename TaggedArg::value_type
|
||||
>::type value_type;
|
||||
|
||||
TaggedArg arg; // Stores the argument
|
||||
|
||||
// Create a new list by prepending arg to a copy of tail. Used when
|
||||
// incrementally building this structure with the comma operator.
|
||||
inline arg_list(TaggedArg const& head, Next const& tail)
|
||||
: Next(tail), arg(head)
|
||||
{
|
||||
}
|
||||
|
||||
// Store the arguments in successive nodes of this list.
|
||||
template <
|
||||
// typename A0, typename A1, ...
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, typename A)
|
||||
>
|
||||
inline arg_list(
|
||||
// A0& a0, A1& a1, ...
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PARAMETER_MAX_ARITY, A, & a)
|
||||
) : Next(
|
||||
// a1, a2, ...
|
||||
BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PARAMETER_MAX_ARITY, a)
|
||||
, ::boost::parameter::aux::void_reference()
|
||||
)
|
||||
, arg(a0)
|
||||
{
|
||||
}
|
||||
|
||||
// A metafunction class that, given a keyword and a default type,
|
||||
// returns the appropriate result type for a keyword lookup given
|
||||
// that default.
|
||||
struct binding
|
||||
{
|
||||
typedef typename Next::binding next_binding;
|
||||
|
||||
template <typename KW, typename Default, typename Reference>
|
||||
struct apply
|
||||
{
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
::boost::is_same<KW,key_type>
|
||||
, ::boost::mpl::if_<Reference,reference,value_type>
|
||||
, ::boost::mpl::apply_wrap3<
|
||||
next_binding
|
||||
, KW
|
||||
, Default
|
||||
, Reference
|
||||
>
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
// Overload for key_type, so the assert below will fire
|
||||
// if the same keyword is used again.
|
||||
@@ -375,22 +702,6 @@ namespace boost { namespace parameter { namespace aux {
|
||||
return sublist.get(x);
|
||||
}
|
||||
|
||||
template <typename KW, typename Default>
|
||||
inline typename ::boost::mpl::apply_wrap3<
|
||||
binding
|
||||
, KW
|
||||
, Default&&
|
||||
, ::boost::mpl::true_
|
||||
>::type
|
||||
operator[](
|
||||
::boost::parameter::aux::default_r_<KW,Default> const& x
|
||||
) const
|
||||
{
|
||||
typename ::boost::mpl::apply_wrap1<key_owner,KW>::type const&
|
||||
sublist = *this;
|
||||
return sublist.get(x);
|
||||
}
|
||||
|
||||
template <typename KW, typename F>
|
||||
inline typename ::boost::mpl::apply_wrap3<
|
||||
binding
|
||||
@@ -427,15 +738,6 @@ namespace boost { namespace parameter { namespace aux {
|
||||
return this->get_default(d, holds_maybe());
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline reference
|
||||
get(
|
||||
::boost::parameter::aux::default_r_<key_type,Default> const& d
|
||||
) const
|
||||
{
|
||||
return this->get_default(d, holds_maybe());
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline reference
|
||||
get(
|
||||
@@ -461,15 +763,6 @@ namespace boost { namespace parameter { namespace aux {
|
||||
return this->get_default(d, holds_maybe());
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline reference
|
||||
operator[](
|
||||
::boost::parameter::aux::default_r_<key_type,Default> const& d
|
||||
) const
|
||||
{
|
||||
return this->get_default(d, holds_maybe());
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline reference
|
||||
operator[](
|
||||
@@ -530,21 +823,6 @@ namespace boost { namespace parameter { namespace aux {
|
||||
>(x, *this);
|
||||
}
|
||||
|
||||
template <typename KW, typename T2>
|
||||
inline ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument_rref<KW,T2>
|
||||
, self
|
||||
>
|
||||
operator,(
|
||||
::boost::parameter::aux::tagged_argument_rref<KW,T2> const& x
|
||||
) const
|
||||
{
|
||||
return ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument_rref<KW,T2>
|
||||
, self
|
||||
>(x, *this);
|
||||
}
|
||||
|
||||
// MPL sequence support
|
||||
typedef self type; // Convenience for users
|
||||
typedef Next tail_type; // For the benefit of iterators
|
||||
@@ -553,6 +831,8 @@ namespace boost { namespace parameter { namespace aux {
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
|
||||
#include <boost/mpl/iterator_tags.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
25
include/boost/parameter/aux_/as_lvalue.hpp
Executable file
25
include/boost/parameter/aux_/as_lvalue.hpp
Executable 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
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#ifndef DEFAULT_050329_HPP
|
||||
#define DEFAULT_050329_HPP
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// A wrapper for the default value passed by the user when resolving
|
||||
@@ -22,6 +20,11 @@ namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
Value& value;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#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
|
||||
@@ -73,6 +76,8 @@ namespace boost { namespace parameter { namespace aux {
|
||||
/**/
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
@@ -88,5 +93,6 @@ namespace boost { namespace parameter { namespace aux {
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
#endif // include guard
|
||||
|
||||
|
||||
@@ -14,8 +14,13 @@ namespace boost { namespace parameter { namespace aux {
|
||||
};
|
||||
}}} // 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>
|
||||
@@ -27,6 +32,8 @@ namespace boost { namespace parameter { namespace aux {
|
||||
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<
|
||||
@@ -40,5 +47,35 @@ namespace boost { namespace parameter { namespace aux {
|
||||
};
|
||||
}}} // 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
|
||||
#endif // include guard
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
#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>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/pair.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
@@ -37,8 +38,6 @@ namespace boost { namespace parameter { namespace aux {
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
|
||||
61
include/boost/parameter/aux_/pack/tag_keyword_arg_ref.hpp
Executable file
61
include/boost/parameter/aux_/pack/tag_keyword_arg_ref.hpp
Executable file
@@ -0,0 +1,61 @@
|
||||
// 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>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <
|
||||
typename Keyword
|
||||
, typename ActualArg
|
||||
#if BOOST_WORKAROUND(__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(__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;
|
||||
};
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
@@ -9,9 +9,13 @@
|
||||
|
||||
#include <boost/parameter/aux_/pack/tag_keyword_arg.hpp>
|
||||
#include <boost/parameter/aux_/pack/make_arg_list.hpp>
|
||||
#include <boost/parameter/aux_/pack/make_parameter_spec_items.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
#include <boost/mpl/pair.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
#include <boost/parameter/aux_/pack/make_parameter_spec_items.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename Parameters, typename ...Args>
|
||||
@@ -30,5 +34,43 @@ namespace boost { namespace parameter { namespace aux {
|
||||
};
|
||||
}}} // 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>
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -9,10 +9,13 @@
|
||||
|
||||
#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...>
|
||||
@@ -20,5 +23,33 @@ namespace boost { namespace parameter { namespace aux {
|
||||
};
|
||||
}}} // 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
|
||||
|
||||
|
||||
@@ -27,8 +27,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
|
||||
1638
include/boost/parameter/aux_/preprocessor/binary_seq_for_each.hpp
Executable file
1638
include/boost/parameter/aux_/preprocessor/binary_seq_for_each.hpp
Executable file
File diff suppressed because it is too large
Load Diff
1796
include/boost/parameter/aux_/preprocessor/binary_seq_for_each_inc.hpp
Executable file
1796
include/boost/parameter/aux_/preprocessor/binary_seq_for_each_inc.hpp
Executable file
File diff suppressed because it is too large
Load Diff
65
include/boost/parameter/aux_/preprocessor/binary_seq_to_args.hpp
Executable file
65
include/boost/parameter/aux_/preprocessor/binary_seq_to_args.hpp
Executable file
@@ -0,0 +1,65 @@
|
||||
// Copyright Cromwell D. Enage 2017.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_BINARY_SEQ_TO_ARGS_HPP
|
||||
#define BOOST_PARAMETER_AUX_PREPROCESSOR_BINARY_SEQ_TO_ARGS_HPP
|
||||
|
||||
#include <boost/preprocessor/seq/elem.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0_1(n, prefix_seq) \
|
||||
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, prefix_seq), n) const&
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1_1(n, prefix_seq) \
|
||||
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, prefix_seq), n)&
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0_2(n, prefix_seq) \
|
||||
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0_1(n, prefix_seq) \
|
||||
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, prefix_seq), n)
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1_2(n, prefix_seq) \
|
||||
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1_1(n, prefix_seq) \
|
||||
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, prefix_seq), n)
|
||||
/**/
|
||||
|
||||
#include <boost/preprocessor/seq/size.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0(prefix_seq) \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0_ \
|
||||
, BOOST_PP_SEQ_SIZE(prefix_seq) \
|
||||
)
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1(prefix_seq) \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1_ \
|
||||
, BOOST_PP_SEQ_SIZE(prefix_seq) \
|
||||
)
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/convert_binary_seq.hpp>
|
||||
|
||||
// This macro converts the specified Boost.Preprocessor sequence of 1s and 0s
|
||||
// into a formal function parameter list.
|
||||
//
|
||||
// Example:
|
||||
// BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS((1)(0)(1)(0), (P)(p))
|
||||
// expands to
|
||||
// P0 & p0, P1 const& p1, P2 & p2, P3 const& p3
|
||||
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS(binary_seq, prefix_seq) \
|
||||
BOOST_PARAMETER_AUX_PP_CONVERT_BINARY_SEQ( \
|
||||
binary_seq \
|
||||
, BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0(prefix_seq) \
|
||||
, BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1(prefix_seq) \
|
||||
, prefix_seq \
|
||||
)
|
||||
/**/
|
||||
|
||||
#endif // include guard
|
||||
|
||||
57
include/boost/parameter/aux_/preprocessor/convert_binary_seq.hpp
Executable file
57
include/boost/parameter/aux_/preprocessor/convert_binary_seq.hpp
Executable file
@@ -0,0 +1,57 @@
|
||||
// Copyright Cromwell D. Enage 2013.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_CONVERT_BINARY_SEQ_HPP
|
||||
#define BOOST_PARAMETER_AUX_PREPROCESSOR_CONVERT_BINARY_SEQ_HPP
|
||||
|
||||
#include <boost/preprocessor/seq/size.hpp>
|
||||
#include <boost/preprocessor/seq/push_back.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_AUGMENT_BINARY_SEQ_INDEX_FOLD_OP(s, seq, idx) \
|
||||
BOOST_PP_SEQ_PUSH_BACK(seq, (idx, BOOST_PP_SEQ_SIZE(seq)))
|
||||
/**/
|
||||
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
#include <boost/preprocessor/seq/elem.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_CONVERT_BINARY_SEQ_FOLD_OP(s, seq, elem) \
|
||||
( \
|
||||
BOOST_PP_SEQ_PUSH_BACK( \
|
||||
BOOST_PP_SEQ_ELEM(0, seq) \
|
||||
, BOOST_PP_IIF( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, elem) \
|
||||
, BOOST_PP_SEQ_ELEM(2, seq) \
|
||||
, BOOST_PP_SEQ_ELEM(1, seq) \
|
||||
)(BOOST_PP_TUPLE_ELEM(2, 1, elem), BOOST_PP_SEQ_ELEM(3, seq)) \
|
||||
) \
|
||||
)(BOOST_PP_SEQ_ELEM(1, seq))(BOOST_PP_SEQ_ELEM(2, seq)) \
|
||||
(BOOST_PP_SEQ_ELEM(3, seq))
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/seq_enum.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
#include <boost/preprocessor/seq/seq.hpp>
|
||||
#include <boost/preprocessor/seq/fold_left.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_AUX_PP_CONVERT_BINARY_SEQ(seq, macro0, macro1, data) \
|
||||
BOOST_PARAMETER_SEQ_ENUM( \
|
||||
BOOST_PP_SEQ_ELEM( \
|
||||
0 \
|
||||
, BOOST_PP_SEQ_FOLD_LEFT( \
|
||||
BOOST_PARAMETER_AUX_PP_CONVERT_BINARY_SEQ_FOLD_OP \
|
||||
, (BOOST_PP_SEQ_NIL)(macro0)(macro1)(data) \
|
||||
, BOOST_PP_SEQ_FOLD_LEFT( \
|
||||
BOOST_PARAMETER_AUX_PP_AUGMENT_BINARY_SEQ_INDEX_FOLD_OP \
|
||||
, BOOST_PP_EMPTY() \
|
||||
, seq \
|
||||
) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
/**/
|
||||
|
||||
#endif // include guard
|
||||
|
||||
105
include/boost/parameter/aux_/preprocessor/for_each.hpp
Normal file → Executable file
105
include/boost/parameter/aux_/preprocessor/for_each.hpp
Normal file → Executable 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
Executable file
1029
include/boost/parameter/aux_/preprocessor/for_each_pred.hpp
Executable file
File diff suppressed because it is too large
Load Diff
@@ -6,111 +6,138 @@
|
||||
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FLATTEN_HPP
|
||||
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FLATTEN_HPP
|
||||
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/preprocessor/tuple/rem.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>
|
||||
#include <boost/preprocessor/seq/for_each.hpp>
|
||||
#include <boost/preprocessor/seq/for_each_i.hpp>
|
||||
#include <boost/preprocessor/identity.hpp>
|
||||
#include <boost/preprocessor/selection/max.hpp>
|
||||
|
||||
#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/parameter/aux_/preprocessor/for_each.hpp>
|
||||
#include <boost/preprocessor/tuple/rem.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_FLATTEN_SPLIT_required required,
|
||||
#define BOOST_PARAMETER_FLATTEN_SPLIT_optional optional,
|
||||
#define BOOST_PARAMETER_FLATTEN_SPLIT_deduced deduced,
|
||||
|
||||
#define BOOST_PARAMETER_FLATTEN_SPLIT(sub) \
|
||||
BOOST_PP_CAT(BOOST_PARAMETER_FLATTEN_SPLIT_, sub)
|
||||
|
||||
#define BOOST_PARAMETER_FLATTEN_QUALIFIER(sub) \
|
||||
BOOST_PP_SPLIT(0, BOOST_PARAMETER_FLATTEN_SPLIT(sub))
|
||||
|
||||
#define BOOST_PARAMETER_FLATTEN_ARGS(sub) \
|
||||
BOOST_PP_SPLIT(1, BOOST_PARAMETER_FLATTEN_SPLIT(sub))
|
||||
|
||||
#define BOOST_PARAMETER_FLATTEN_ARITY_optional(arities) \
|
||||
BOOST_PP_TUPLE_ELEM(3, 0, arities)
|
||||
|
||||
#define BOOST_PARAMETER_FLATTEN_ARITY_required(arities) \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, arities)
|
||||
|
||||
#define BOOST_PARAMETER_FLATTEN_SPEC0_DUMMY_ELEM(z, n, data) ~
|
||||
#define BOOST_PARAMETER_FLATTEN_SPEC0(r, n, elem, data) \
|
||||
(( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 2, data) \
|
||||
, BOOST_PP_TUPLE_REM(BOOST_PP_TUPLE_ELEM(3, 0, data)) elem \
|
||||
BOOST_PP_ENUM_TRAILING( \
|
||||
BOOST_PP_SUB( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, data) \
|
||||
, BOOST_PP_TUPLE_ELEM(3, 0, data) \
|
||||
) \
|
||||
, BOOST_PARAMETER_FLATTEN_SPEC0_DUMMY_ELEM \
|
||||
, ~ \
|
||||
) \
|
||||
#define BOOST_PARAMETER_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 \
|
||||
, ~ \
|
||||
) \
|
||||
))
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_FLATTEN_SPEC_AUX(r, arity, max_arity, spec, xform) \
|
||||
BOOST_PARAMETER_FOR_EACH_R( \
|
||||
r \
|
||||
, arity \
|
||||
, BOOST_PARAMETER_FLATTEN_ARGS(spec) \
|
||||
, (arity, max_arity, xform(BOOST_PARAMETER_FLATTEN_QUALIFIER(spec))) \
|
||||
, BOOST_PARAMETER_FLATTEN_SPEC0 \
|
||||
#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_FLATTEN_IDENTITY(x) x
|
||||
|
||||
#define BOOST_PARAMETER_FLATTEN_SPEC_optional(r, arities, spec) \
|
||||
BOOST_PARAMETER_FLATTEN_SPEC_AUX( \
|
||||
r \
|
||||
, BOOST_PP_CAT( \
|
||||
BOOST_PARAMETER_FLATTEN_ARITY_ \
|
||||
, BOOST_PARAMETER_FLATTEN_QUALIFIER(spec) \
|
||||
)(arities) \
|
||||
, BOOST_PP_TUPLE_ELEM(3, 2, arities) \
|
||||
, spec \
|
||||
, BOOST_PARAMETER_FLATTEN_IDENTITY \
|
||||
#define BOOST_PARAMETER_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_FLATTEN_SPEC_required(r, arities, spec) \
|
||||
BOOST_PARAMETER_FLATTEN_SPEC_optional(r, arities, spec)
|
||||
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_required(r, arities, spec) \
|
||||
BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_optional(r, arities, spec)
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_FLATTEN_SPEC_AS_DEDUCED(x) BOOST_PP_CAT(deduced_, x)
|
||||
|
||||
#define BOOST_PARAMETER_FLATTEN_SPEC_deduced_M(r, arities, n, spec) \
|
||||
BOOST_PARAMETER_FLATTEN_SPEC_AUX( \
|
||||
r \
|
||||
, BOOST_PP_CAT( \
|
||||
BOOST_PARAMETER_FLATTEN_ARITY_ \
|
||||
, BOOST_PARAMETER_FLATTEN_QUALIFIER(spec) \
|
||||
)(arities) \
|
||||
, BOOST_PP_TUPLE_ELEM(3, 2, arities) \
|
||||
, spec \
|
||||
, BOOST_PARAMETER_FLATTEN_SPEC_AS_DEDUCED \
|
||||
#define BOOST_PARAMETER_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 \
|
||||
)
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_FLATTEN_SPEC_deduced(r, arities, spec) \
|
||||
BOOST_PP_SEQ_FOR_EACH_I_R( \
|
||||
r \
|
||||
, BOOST_PARAMETER_FLATTEN_SPEC_deduced_M \
|
||||
, arities \
|
||||
, BOOST_PARAMETER_FLATTEN_ARGS(spec) \
|
||||
#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_FLATTEN_SPEC(r, arities, spec) \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_PARAMETER_FLATTEN_SPEC_ \
|
||||
, BOOST_PARAMETER_FLATTEN_QUALIFIER(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)
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_FLATTEN(opt_arity, req_arity, wanted_arity, specs) \
|
||||
BOOST_PP_SEQ_FOR_EACH( \
|
||||
BOOST_PARAMETER_FLATTEN_SPEC \
|
||||
, (opt_arity, req_arity, wanted_arity) \
|
||||
, specs \
|
||||
#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
Executable file
152
include/boost/parameter/aux_/preprocessor/impl/for_each.hpp
Executable 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
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
#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.
|
||||
@@ -52,8 +56,8 @@
|
||||
) \
|
||||
>::type \
|
||||
>::type \
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION_NAME(BOOST_PP_TUPLE_ELEM(3, 0, data))( \
|
||||
) BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(3, 2, data), const) \
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION_NAME(BOOST_PP_TUPLE_ELEM(3, 0, data))() \
|
||||
BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(3, 2, data), const) \
|
||||
{ \
|
||||
return BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, data) \
|
||||
@@ -90,7 +94,7 @@
|
||||
>::type \
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION_NAME(BOOST_PP_TUPLE_ELEM(3, 0, data))( \
|
||||
BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, ParameterArgumentType, && a) \
|
||||
, BOOST_PARAMETER_FUNCTION_FORWARD_MATCH_Z( \
|
||||
BOOST_PARAMETER_FUNCTION_FORWARD_MATCH_Z( \
|
||||
z \
|
||||
, BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, data) \
|
||||
@@ -125,7 +129,7 @@
|
||||
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( \
|
||||
BOOST_PARAMETER_FUNCTION_FORWARD_MATCH_Z( \
|
||||
z \
|
||||
, BOOST_PP_CAT(constructor_parameters, __LINE__) \
|
||||
, n \
|
||||
@@ -202,5 +206,247 @@
|
||||
)
|
||||
/**/
|
||||
|
||||
#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( \
|
||||
3, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
) \
|
||||
) \
|
||||
inline BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM( \
|
||||
3, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
) \
|
||||
)< \
|
||||
::boost::parameter::aux::argument_pack< \
|
||||
BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM( \
|
||||
3, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
) \
|
||||
) \
|
||||
>::type \
|
||||
>::type \
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM( \
|
||||
3, 0, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
) \
|
||||
)() BOOST_PP_EXPR_IF( \
|
||||
BOOST_PP_TUPLE_ELEM( \
|
||||
3, 2, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
) \
|
||||
, const \
|
||||
) \
|
||||
{ \
|
||||
return BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM( \
|
||||
3, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
) \
|
||||
)( \
|
||||
BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM( \
|
||||
3, 1, 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(3, 1, BOOST_PP_SEQ_HEAD(seq)) \
|
||||
) \
|
||||
inline typename BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_SEQ_HEAD(seq)) \
|
||||
)< \
|
||||
typename ::boost::parameter::aux::argument_pack< \
|
||||
BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, 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(3, 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(3, 1, BOOST_PP_SEQ_HEAD(seq)) \
|
||||
) \
|
||||
, BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
, ParameterArgumentType \
|
||||
) \
|
||||
) BOOST_PP_EXPR_IF( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_SEQ_HEAD(seq)), const \
|
||||
) \
|
||||
{ \
|
||||
return BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_SEQ_HEAD(seq)) \
|
||||
)( \
|
||||
BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, 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(name, impl, range, c) \
|
||||
BOOST_PP_REPEAT_FROM_TO( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, range) \
|
||||
, BOOST_PP_TUPLE_ELEM(2, 1, range) \
|
||||
, BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_Z \
|
||||
, (name, impl, 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, args, const_) \
|
||||
BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX( \
|
||||
name \
|
||||
, impl \
|
||||
, BOOST_PARAMETER_ARITY_RANGE(args) \
|
||||
, const_ \
|
||||
)
|
||||
/**/
|
||||
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
#endif // include guard
|
||||
|
||||
|
||||
@@ -9,27 +9,7 @@
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
|
||||
#define BOOST_PARAMETER_FUNCTION_CAST_T(value_t, predicate, args) value_t
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_FUNCTION_CAST_B(value_t, predicate, args) \
|
||||
::boost::mpl::true_
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <typename T, typename B>
|
||||
inline T&& forward(T&& t)
|
||||
{
|
||||
return ::std::forward<T>(t);
|
||||
}
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#else // !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
@@ -86,11 +66,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
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>
|
||||
{
|
||||
};
|
||||
@@ -334,6 +310,259 @@ namespace boost { namespace parameter { namespace aux {
|
||||
}
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // Borland workarounds needed.
|
||||
#elif BOOST_WORKAROUND(__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
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
// Expands to keyword_tag_type for some keyword_tag.
|
||||
#define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_TYPE(keyword_tag) \
|
||||
BOOST_PP_CAT(BOOST_PP_CAT(keyword_tag, _), type)
|
||||
BOOST_PP_CAT(keyword_tag, _type)
|
||||
/**/
|
||||
|
||||
// Expands to a template parameter for each dispatch function.
|
||||
@@ -19,6 +19,10 @@
|
||||
, 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)
|
||||
@@ -28,11 +32,29 @@
|
||||
|
||||
// Expands to an argument passed from one dispatch function to the next.
|
||||
#define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_FWD(r, macro, arg) \
|
||||
, ::std::forward< \
|
||||
, ::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>
|
||||
@@ -139,7 +161,7 @@
|
||||
// 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
|
||||
@@ -163,11 +185,29 @@
|
||||
] \
|
||||
)
|
||||
/**/
|
||||
#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
|
||||
@@ -191,6 +231,19 @@
|
||||
] \
|
||||
)
|
||||
/**/
|
||||
#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/tti/detail/dnullptr.hpp>
|
||||
|
||||
|
||||
@@ -12,30 +12,30 @@
|
||||
!BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
|
||||
|
||||
#include <boost/parameter/aux_/pp_impl/match.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.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_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_PARAMS_Z(z, 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()
|
||||
, params = params()
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_FUNCTION_FORWARD_MATCH_Z(z, params, n, prefix) \
|
||||
params = params()
|
||||
, params = params()
|
||||
/**/
|
||||
|
||||
#endif
|
||||
|
||||
78
include/boost/parameter/aux_/preprocessor/inc_binary_seq.hpp
Executable file
78
include/boost/parameter/aux_/preprocessor/inc_binary_seq.hpp
Executable 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
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#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(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#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(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
|
||||
165
include/boost/parameter/aux_/preprocessor/no_perfect_forwarding_begin.hpp
Executable file
165
include/boost/parameter/aux_/preprocessor/no_perfect_forwarding_begin.hpp
Executable file
@@ -0,0 +1,165 @@
|
||||
// Copyright David Abrahams, Daniel Wallin 2003.
|
||||
// Copyright Cromwell D. Enage 2017.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// No include guard. This file is intended for multiple inclusion.
|
||||
|
||||
#define BOOST_PARAMETER_right_angle(z, n, _) >
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_satisfies_end(z, n, false_t) ,false_t>
|
||||
/**/
|
||||
|
||||
#include <boost/preprocessor/seq/elem.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
// Generates:
|
||||
//
|
||||
// make<
|
||||
// parameter_spec##0, argument_type##0
|
||||
// , make<
|
||||
// parameter_spec##1, argument_type##1
|
||||
// , ... boost::mpl::identity<boost::parameter::aux::empty_arg_list>
|
||||
// ...>
|
||||
// >
|
||||
#define BOOST_PARAMETER_make_arg_list(z, n, names) \
|
||||
BOOST_PP_SEQ_ELEM(0, names)< \
|
||||
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, names), n), \
|
||||
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(2, names), n),
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_build_arg_list(n, make, param_spec, arg_type) \
|
||||
BOOST_PP_REPEAT( \
|
||||
n, BOOST_PARAMETER_make_arg_list, (make)(param_spec)(arg_type) \
|
||||
) \
|
||||
::boost::mpl::identity< ::boost::parameter::void_> \
|
||||
BOOST_PP_REPEAT(n, BOOST_PARAMETER_right_angle, _)
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_make_deduced_list(z, n, names) \
|
||||
BOOST_PP_SEQ_ELEM(0, names)<BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, names), n),
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_build_deduced_list(n, make, parameter_spec) \
|
||||
BOOST_PP_REPEAT( \
|
||||
n, BOOST_PARAMETER_make_deduced_list, (make)(parameter_spec) \
|
||||
) \
|
||||
::boost::mpl::identity< ::boost::parameter::void_> \
|
||||
BOOST_PP_REPEAT(n, BOOST_PARAMETER_right_angle, _)
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_forward_typedef(z, n, names) \
|
||||
typedef BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, names), n) \
|
||||
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, names), n);
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_template_args(z, n, prefix) \
|
||||
typename BOOST_PP_CAT(prefix, n) = ::boost::parameter::void_
|
||||
/**/
|
||||
|
||||
#include <boost/mpl/pair.hpp>
|
||||
|
||||
#if (0 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
|
||||
#include <boost/parameter/aux_/pack/item.hpp>
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_make_arg_items_R(r, prefix, i, elem) \
|
||||
::boost::parameter::aux::item<BOOST_PP_CAT(prefix, i), \
|
||||
BOOST_PP_CAT(A, i) BOOST_PP_IIF(elem, &, const&),
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/pack/make_arg_list.hpp>
|
||||
#include <boost/parameter/aux_/pack/tag_keyword_arg.hpp>
|
||||
#include <boost/preprocessor/seq/for_each_i.hpp>
|
||||
#include <boost/preprocessor/seq/size.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_function_call_arg_list_R(r, seq) \
|
||||
::boost::parameter::aux::make_arg_list< \
|
||||
BOOST_PP_SEQ_FOR_EACH_I_R( \
|
||||
r, BOOST_PARAMETER_make_arg_items_R, PS, seq \
|
||||
) \
|
||||
::boost::parameter::void_ \
|
||||
BOOST_PP_REPEAT( \
|
||||
BOOST_PP_SEQ_SIZE(seq), BOOST_PARAMETER_right_angle, _ \
|
||||
) \
|
||||
, deduced_list \
|
||||
, ::boost::parameter::aux::tag_keyword_arg \
|
||||
>
|
||||
/**/
|
||||
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_function_call_arg_pack_init(z, n, limit) \
|
||||
BOOST_PP_CAT(a, BOOST_PP_SUB(limit, n))
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/binary_seq_to_args.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
#include <boost/preprocessor/seq/seq.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_function_call_op_overload_R(r, seq) \
|
||||
template < \
|
||||
BOOST_PP_ENUM_PARAMS( \
|
||||
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)) \
|
||||
, typename A \
|
||||
) \
|
||||
> \
|
||||
inline typename ::boost::mpl::first< \
|
||||
typename BOOST_PARAMETER_function_call_arg_list_R( \
|
||||
r, BOOST_PP_SEQ_TAIL(seq) \
|
||||
)::type \
|
||||
>::type \
|
||||
operator()( \
|
||||
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS( \
|
||||
BOOST_PP_SEQ_TAIL(seq), (A)(a) \
|
||||
) \
|
||||
) const \
|
||||
{ \
|
||||
typedef typename BOOST_PARAMETER_function_call_arg_list_R( \
|
||||
r, BOOST_PP_SEQ_TAIL(seq) \
|
||||
)::type result; \
|
||||
typedef typename ::boost::mpl::first<result>::type result_type; \
|
||||
typedef typename ::boost::mpl::second<result>::type error; \
|
||||
error(); \
|
||||
return result_type( \
|
||||
BOOST_PP_ENUM( \
|
||||
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)) \
|
||||
, BOOST_PARAMETER_function_call_arg_pack_init \
|
||||
, BOOST_PP_DEC(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq))) \
|
||||
) \
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS( \
|
||||
BOOST_PP_SUB( \
|
||||
BOOST_PARAMETER_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) \
|
||||
>,
|
||||
/**/
|
||||
|
||||
24
include/boost/parameter/aux_/preprocessor/no_perfect_forwarding_end.hpp
Executable file
24
include/boost/parameter/aux_/preprocessor/no_perfect_forwarding_end.hpp
Executable file
@@ -0,0 +1,24 @@
|
||||
// Copyright David Abrahams, Daniel Wallin 2003.
|
||||
// Copyright Cromwell D. Enage 2017.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// No include guard. This file is intended for multiple inclusion.
|
||||
|
||||
#undef BOOST_PARAMETER_satisfies_begin
|
||||
#if (0 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
#undef BOOST_PARAMETER_function_call_op_overload_R
|
||||
#undef BOOST_PARAMETER_function_call_arg_pack_init
|
||||
#undef BOOST_PARAMETER_function_call_arg_list_R
|
||||
#undef BOOST_PARAMETER_make_arg_items_R
|
||||
#endif
|
||||
#undef BOOST_PARAMETER_template_args
|
||||
#undef BOOST_PARAMETER_forward_typedef
|
||||
#undef BOOST_PARAMETER_build_deduced_list
|
||||
#undef BOOST_PARAMETER_make_deduced_list
|
||||
#undef BOOST_PARAMETER_build_arg_list
|
||||
#undef BOOST_PARAMETER_make_arg_list
|
||||
#undef BOOST_PARAMETER_satisfies_end
|
||||
#undef BOOST_PARAMETER_right_angle
|
||||
|
||||
92
include/boost/parameter/aux_/preprocessor/overloads.hpp
Executable file
92
include/boost/parameter/aux_/preprocessor/overloads.hpp
Executable 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_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
|
||||
|
||||
26
include/boost/parameter/aux_/preprocessor/seq_enum.hpp
Executable file
26
include/boost/parameter/aux_/preprocessor/seq_enum.hpp
Executable 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
Executable file
1807
include/boost/parameter/aux_/preprocessor/seq_merge.hpp
Executable file
File diff suppressed because it is too large
Load Diff
113
include/boost/parameter/aux_/set.hpp
Normal file → Executable file
113
include/boost/parameter/aux_/set.hpp
Normal file → Executable file
@@ -1,66 +1,81 @@
|
||||
// Copyright Daniel Wallin 2006. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
// Copyright Daniel Wallin 2006.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PARAMETER_SET_060912_HPP
|
||||
# define BOOST_PARAMETER_SET_060912_HPP
|
||||
#define BOOST_PARAMETER_SET_060912_HPP
|
||||
|
||||
# include <boost/detail/workaround.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
# include <boost/mpl/insert.hpp>
|
||||
# include <boost/mpl/set/set0.hpp>
|
||||
# include <boost/mpl/has_key.hpp>
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
|
||||
#include <boost/mpl/list.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
typedef mpl::set0<> set0;
|
||||
|
||||
template <class Set, class K>
|
||||
struct insert_
|
||||
{
|
||||
typedef typename mpl::insert<Set, K>::type type;
|
||||
};
|
||||
|
||||
template <class Set, class K>
|
||||
struct has_key_
|
||||
{
|
||||
typedef typename mpl::has_key<Set, K>::type type;
|
||||
};
|
||||
|
||||
typedef ::boost::mpl::list0<> set0;
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
# else
|
||||
|
||||
# include <boost/mpl/list.hpp>
|
||||
# include <boost/mpl/end.hpp>
|
||||
# include <boost/mpl/find.hpp>
|
||||
# include <boost/mpl/not.hpp>
|
||||
# include <boost/mpl/push_front.hpp>
|
||||
#include <boost/mpl/push_front.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
typedef mpl::list0<> set0;
|
||||
|
||||
template <class Set, class K>
|
||||
struct insert_
|
||||
{
|
||||
typedef typename mpl::push_front<Set, K>::type type;
|
||||
};
|
||||
|
||||
template <class Set, class K>
|
||||
struct has_key_
|
||||
{
|
||||
typedef typename mpl::find<Set, K>::type iter;
|
||||
typedef mpl::not_<
|
||||
is_same<iter, typename mpl::end<Set>::type>
|
||||
> type;
|
||||
};
|
||||
|
||||
template <typename Set, typename K>
|
||||
struct insert_ : ::boost::mpl::push_front<Set,K>
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
# endif
|
||||
#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 {
|
||||
|
||||
#endif // BOOST_PARAMETER_SET_060912_HPP
|
||||
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_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
|
||||
#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 // Borland workarounds needed.
|
||||
#endif // include guard
|
||||
|
||||
|
||||
@@ -7,10 +7,12 @@
|
||||
#ifndef BOOST_PARAMETER_AUX_TAG_DWA2005610_HPP
|
||||
#define BOOST_PARAMETER_AUX_TAG_DWA2005610_HPP
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
#include <boost/parameter/aux_/unwrap_cv_reference.hpp>
|
||||
#include <boost/parameter/aux_/tagged_argument.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
@@ -21,26 +23,11 @@
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <
|
||||
typename Keyword
|
||||
, typename ActualArg
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
, typename = typename ::boost::parameter::aux
|
||||
::is_cv_reference_wrapper<ActualArg>::type
|
||||
#endif
|
||||
>
|
||||
template <typename Keyword, typename ActualArg>
|
||||
struct tag
|
||||
{
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
typedef ::boost::parameter::aux::tagged_argument<
|
||||
Keyword
|
||||
, typename ::boost::parameter::aux
|
||||
::unwrap_cv_reference<ActualArg>::type
|
||||
> type;
|
||||
#else
|
||||
typedef typename ::boost::parameter::aux::unwrap_cv_reference<
|
||||
ActualArg
|
||||
>::type Arg;
|
||||
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<
|
||||
@@ -58,7 +45,28 @@ namespace boost { namespace parameter { namespace aux {
|
||||
, ::boost::parameter::aux::tagged_argument_rref<Keyword,Arg>
|
||||
>
|
||||
>::type type;
|
||||
#endif // Borland workarounds needed.
|
||||
};
|
||||
}}} // namespace boost::parameter::aux_
|
||||
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <
|
||||
typename Keyword
|
||||
, typename ActualArg
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
, typename = typename ::boost::parameter::aux
|
||||
::is_cv_reference_wrapper<ActualArg>::type
|
||||
#endif
|
||||
>
|
||||
struct tag
|
||||
{
|
||||
typedef ::boost::parameter::aux::tagged_argument<
|
||||
Keyword
|
||||
, typename ::boost::parameter::aux
|
||||
::unwrap_cv_reference<ActualArg>::type
|
||||
> type;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux_
|
||||
|
||||
@@ -70,23 +78,14 @@ namespace boost { namespace parameter { namespace aux {
|
||||
template <typename Keyword, typename ActualArg>
|
||||
struct tag<Keyword,ActualArg,::boost::mpl::false_>
|
||||
{
|
||||
typedef typename ::boost::remove_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<
|
||||
::boost::is_lvalue_reference<ActualArg>
|
||||
, ::boost::mpl::identity<
|
||||
::boost::parameter::aux::tagged_argument<Keyword,Arg>
|
||||
>
|
||||
, ::boost::mpl::if_<
|
||||
::boost::is_scalar<MutArg>
|
||||
, ::boost::parameter::aux::tagged_argument<Keyword,ConstArg>
|
||||
, ::boost::parameter::aux::tagged_argument_rref<Keyword,Arg>
|
||||
>
|
||||
>::type type;
|
||||
typedef ::boost::parameter::aux::tagged_argument<
|
||||
Keyword
|
||||
, typename ::boost::remove_reference<ActualArg>::type
|
||||
> type;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux_
|
||||
|
||||
#endif // Borland workarounds needed.
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
#endif // include guard
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#ifndef BOOST_PARAMETER_TAGGED_ARGUMENT_050328_HPP
|
||||
#define BOOST_PARAMETER_TAGGED_ARGUMENT_050328_HPP
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
struct error_const_lvalue_bound_to_out_parameter;
|
||||
@@ -43,6 +41,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/parameter/aux_/arg_list.hpp>
|
||||
#include <boost/parameter/aux_/result_of0.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
@@ -51,8 +50,6 @@ namespace boost { namespace parameter { namespace aux {
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
#include <boost/type_traits/is_scalar.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <utility>
|
||||
|
||||
#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
|
||||
#include <boost/function.hpp>
|
||||
@@ -60,6 +57,10 @@ namespace boost { namespace parameter { namespace aux {
|
||||
#include <functional>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <utility>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// Holds an lvalue reference to an argument of type Arg associated with
|
||||
@@ -210,85 +211,6 @@ namespace boost { namespace parameter { namespace aux {
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
template <typename KW, typename Default>
|
||||
inline Default&
|
||||
get_with_default(
|
||||
::boost::parameter::aux::default_<KW,Default> const& x
|
||||
, int
|
||||
) const
|
||||
{
|
||||
return x.value;
|
||||
}
|
||||
|
||||
template <typename KW, typename Default>
|
||||
inline Default&&
|
||||
get_with_default(
|
||||
::boost::parameter::aux::default_r_<KW,Default> const& x
|
||||
, int
|
||||
) const
|
||||
{
|
||||
return ::std::forward<Default>(x.value);
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline reference
|
||||
get_with_default(
|
||||
::boost::parameter::aux::default_<key_type,Default> const&
|
||||
, long
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename KW, typename Default>
|
||||
inline typename ::boost::mpl::apply_wrap3<
|
||||
binding
|
||||
, KW
|
||||
, Default&
|
||||
, ::boost::mpl::true_
|
||||
>::type
|
||||
operator[](
|
||||
::boost::parameter::aux::default_<KW,Default> const& x
|
||||
) const
|
||||
{
|
||||
return this->get_with_default(x, 0L);
|
||||
}
|
||||
|
||||
template <typename KW, typename F>
|
||||
inline typename ::boost::parameter::aux::result_of0<F>::type
|
||||
get_with_lazy_default(
|
||||
::boost::parameter::aux::lazy_default<KW,F> const& x
|
||||
, int
|
||||
) const
|
||||
{
|
||||
return x.compute_default();
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
inline reference
|
||||
get_with_lazy_default(
|
||||
::boost::parameter::aux::lazy_default<key_type,F> const&
|
||||
, long
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename KW, typename F>
|
||||
inline typename ::boost::mpl::apply_wrap3<
|
||||
binding
|
||||
, KW
|
||||
, typename ::boost::parameter::aux::result_of0<F>::type
|
||||
, ::boost::mpl::true_
|
||||
>::type
|
||||
operator[](
|
||||
::boost::parameter::aux::lazy_default<KW,F> const& x
|
||||
) const
|
||||
{
|
||||
return this->get_with_lazy_default(x, 0L);
|
||||
}
|
||||
#else // !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
template <typename Default>
|
||||
inline reference
|
||||
operator[](
|
||||
@@ -347,7 +269,6 @@ namespace boost { namespace parameter { namespace aux {
|
||||
, HasDefault
|
||||
>*
|
||||
);
|
||||
#endif // Borland workarounds needed.
|
||||
|
||||
// MPL sequence support
|
||||
// Convenience for users
|
||||
@@ -356,12 +277,6 @@ namespace boost { namespace parameter { namespace aux {
|
||||
typedef ::boost::parameter::aux::empty_arg_list tail_type;
|
||||
// For dispatching to sequence intrinsics
|
||||
typedef ::boost::parameter::aux::arg_list_tag tag;
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
|
||||
// warning suppression
|
||||
private:
|
||||
void operator=(type const&);
|
||||
#endif
|
||||
};
|
||||
|
||||
// Holds an rvalue reference to an argument of type Arg associated with
|
||||
@@ -479,75 +394,6 @@ namespace boost { namespace parameter { namespace aux {
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
template <typename KW, typename Default>
|
||||
inline Default&&
|
||||
get_with_default(
|
||||
::boost::parameter::aux::default_r_<KW,Default> const& x
|
||||
, int
|
||||
) const
|
||||
{
|
||||
return ::std::forward<Default>(x.value);
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline reference
|
||||
get_with_default(
|
||||
::boost::parameter::aux::default_r_<key_type,Default> const&
|
||||
, long
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename KW, typename Default>
|
||||
inline typename ::boost::mpl::apply_wrap3<
|
||||
binding
|
||||
, KW
|
||||
, Default&&
|
||||
, ::boost::mpl::true_
|
||||
>::type
|
||||
operator[](
|
||||
::boost::parameter::aux::default_r_<KW,Default> const& x
|
||||
) const
|
||||
{
|
||||
return this->get_with_default(x, 0L);
|
||||
}
|
||||
|
||||
template <typename KW, typename F>
|
||||
inline typename ::boost::parameter::aux::result_of0<F>::type
|
||||
get_with_lazy_default(
|
||||
::boost::parameter::aux::lazy_default<KW,F> const& x
|
||||
, int
|
||||
) const
|
||||
{
|
||||
return x.compute_default();
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
inline reference
|
||||
get_with_lazy_default(
|
||||
::boost::parameter::aux::lazy_default<key_type,F> const&
|
||||
, long
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename KW, typename F>
|
||||
inline typename ::boost::mpl::apply_wrap3<
|
||||
binding
|
||||
, KW
|
||||
, typename ::boost::parameter::aux::result_of0<F>::type
|
||||
, ::boost::mpl::true_
|
||||
>::type
|
||||
operator[](
|
||||
::boost::parameter::aux::lazy_default<KW,F> const& x
|
||||
) const
|
||||
{
|
||||
return this->get_with_lazy_default(x, 0L);
|
||||
}
|
||||
#else // !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
template <typename Default>
|
||||
inline reference
|
||||
operator[](
|
||||
@@ -597,7 +443,6 @@ namespace boost { namespace parameter { namespace aux {
|
||||
, HasDefault
|
||||
>*
|
||||
);
|
||||
#endif // Borland workarounds needed.
|
||||
|
||||
// MPL sequence support
|
||||
// Convenience for users
|
||||
@@ -609,6 +454,250 @@ namespace boost { namespace parameter { namespace aux {
|
||||
typedef ::boost::parameter::aux::empty_arg_list tail_type;
|
||||
// For dispatching to sequence intrinsics
|
||||
typedef ::boost::parameter::aux::arg_list_tag tag;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// Holds an lvalue reference to an argument of type Arg associated with
|
||||
// keyword Keyword
|
||||
template <typename Keyword, typename Arg>
|
||||
class tagged_argument : ::boost::parameter::aux::tagged_argument_base
|
||||
{
|
||||
typedef typename ::boost::remove_const<Arg>::type arg_type;
|
||||
|
||||
public:
|
||||
typedef Keyword key_type;
|
||||
|
||||
// Wrap plain (non-UDT) function objects in either
|
||||
// a boost::function or a std::function. -- Cromwell D. Enage
|
||||
typedef typename ::boost::mpl::if_<
|
||||
::boost::is_function<arg_type>
|
||||
#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
|
||||
, ::boost::function<arg_type>
|
||||
#else
|
||||
, ::std::function<arg_type>
|
||||
#endif
|
||||
, Arg
|
||||
>::type value_type;
|
||||
|
||||
// If Arg is void_, then this type will evaluate to void_&. If the
|
||||
// supplied argument is a plain function, then this type will evaluate
|
||||
// to a reference-to-const function wrapper type. If the supplied
|
||||
// argument is an lvalue, then Arg will be deduced to the lvalue
|
||||
// reference. -- Cromwell D. Enage
|
||||
typedef typename ::boost::mpl::if_<
|
||||
::boost::is_function<arg_type>
|
||||
, value_type const&
|
||||
, Arg&
|
||||
>::type reference;
|
||||
|
||||
private:
|
||||
// Store plain functions by value, everything else by reference.
|
||||
// -- Cromwell D. Enage
|
||||
typename ::boost::mpl::if_<
|
||||
::boost::is_function<arg_type>
|
||||
, value_type
|
||||
, reference
|
||||
>::type value;
|
||||
|
||||
public:
|
||||
inline explicit tagged_argument(reference x) : value(x)
|
||||
{
|
||||
}
|
||||
|
||||
inline tagged_argument(tagged_argument const& copy)
|
||||
: value(copy.value)
|
||||
{
|
||||
}
|
||||
|
||||
// A metafunction class that, given a keyword and a default type,
|
||||
// returns the appropriate result type for a keyword lookup given
|
||||
// that default.
|
||||
struct binding
|
||||
{
|
||||
template <typename KW, typename Default, typename Reference>
|
||||
struct apply
|
||||
{
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
::boost::is_same<KW,key_type>
|
||||
, ::boost::mpl::if_<Reference,reference,value_type>
|
||||
, ::boost::mpl::identity<Default>
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
// Comma operator to compose argument list without using parameters<>.
|
||||
// Useful for argument lists with undetermined length.
|
||||
template <typename Keyword2, typename Arg2>
|
||||
inline ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword,Arg>
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword2,Arg2>
|
||||
>
|
||||
>
|
||||
operator,(
|
||||
::boost::parameter::aux
|
||||
::tagged_argument<Keyword2,Arg2> const& x
|
||||
) const
|
||||
{
|
||||
return ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword,Arg>
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword2,Arg2>
|
||||
>
|
||||
>(
|
||||
*this
|
||||
, ::boost::parameter::aux::arg_list<
|
||||
::boost::parameter::aux::tagged_argument<Keyword2,Arg2>
|
||||
>(x, ::boost::parameter::aux::empty_arg_list())
|
||||
);
|
||||
}
|
||||
|
||||
// Accessor interface.
|
||||
inline reference get_value() const
|
||||
{
|
||||
return this->value;
|
||||
}
|
||||
|
||||
inline reference
|
||||
operator[](::boost::parameter::keyword<Keyword> const&) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) || \
|
||||
BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
template <typename KW, typename Default>
|
||||
inline Default&
|
||||
get_with_default(
|
||||
::boost::parameter::aux::default_<KW,Default> const& x
|
||||
, int
|
||||
) const
|
||||
{
|
||||
return x.value;
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline reference
|
||||
get_with_default(
|
||||
::boost::parameter::aux::default_<key_type,Default> const&
|
||||
, long
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename KW, typename Default>
|
||||
inline typename ::boost::mpl::apply_wrap3<
|
||||
binding
|
||||
, KW
|
||||
, Default&
|
||||
, ::boost::mpl::true_
|
||||
>::type
|
||||
operator[](
|
||||
::boost::parameter::aux::default_<KW,Default> const& x
|
||||
) const
|
||||
{
|
||||
return this->get_with_default(x, 0L);
|
||||
}
|
||||
|
||||
template <typename KW, typename F>
|
||||
inline typename ::boost::parameter::aux::result_of0<F>::type
|
||||
get_with_lazy_default(
|
||||
::boost::parameter::aux::lazy_default<KW,F> const& x
|
||||
, int
|
||||
) const
|
||||
{
|
||||
return x.compute_default();
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
inline reference
|
||||
get_with_lazy_default(
|
||||
::boost::parameter::aux::lazy_default<key_type,F> const&
|
||||
, long
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename KW, typename F>
|
||||
inline typename ::boost::mpl::apply_wrap3<
|
||||
binding
|
||||
, KW
|
||||
, typename ::boost::parameter::aux::result_of0<F>::type
|
||||
, ::boost::mpl::true_
|
||||
>::type
|
||||
operator[](
|
||||
::boost::parameter::aux::lazy_default<KW,F> const& x
|
||||
) const
|
||||
{
|
||||
return this->get_with_lazy_default(x, 0L);
|
||||
}
|
||||
#else
|
||||
//#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) && \
|
||||
// !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
template <typename Default>
|
||||
inline reference
|
||||
operator[](
|
||||
::boost::parameter::aux::default_<key_type,Default> const&
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
inline reference
|
||||
operator[](
|
||||
::boost::parameter::aux::lazy_default<key_type,F> const&
|
||||
) const
|
||||
{
|
||||
return this->get_value();
|
||||
}
|
||||
|
||||
template <typename KW, typename Default>
|
||||
inline Default&
|
||||
operator[](
|
||||
::boost::parameter::aux::default_<KW,Default> const& x
|
||||
) const
|
||||
{
|
||||
return x.value;
|
||||
}
|
||||
|
||||
template <typename KW, typename F>
|
||||
inline typename ::boost::parameter::aux::result_of0<F>::type
|
||||
operator[](
|
||||
::boost::parameter::aux::lazy_default<KW,F> const& x
|
||||
) const
|
||||
{
|
||||
return x.compute_default();
|
||||
}
|
||||
|
||||
template <typename ParameterRequirements>
|
||||
static typename ParameterRequirements::has_default
|
||||
satisfies(ParameterRequirements*);
|
||||
|
||||
template <typename HasDefault, typename Predicate>
|
||||
static typename ::boost::mpl::apply_wrap1<Predicate,value_type>::type
|
||||
satisfies(
|
||||
::boost::parameter::aux::parameter_requirements<
|
||||
key_type
|
||||
, Predicate
|
||||
, HasDefault
|
||||
>*
|
||||
);
|
||||
#endif // Function template ordering, Borland workarounds needed.
|
||||
|
||||
// MPL sequence support
|
||||
// Convenience for users
|
||||
typedef ::boost::parameter::aux::tagged_argument<Keyword,Arg> type;
|
||||
// For the benefit of iterators
|
||||
typedef ::boost::parameter::aux::empty_arg_list tail_type;
|
||||
// For dispatching to sequence intrinsics
|
||||
typedef ::boost::parameter::aux::arg_list_tag tag;
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
|
||||
// warning suppression
|
||||
@@ -618,5 +707,6 @@ namespace boost { namespace parameter { namespace aux {
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
#endif // include guard
|
||||
|
||||
|
||||
@@ -11,10 +11,18 @@ 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
|
||||
#endif // include guard
|
||||
|
||||
|
||||
@@ -17,15 +17,39 @@ namespace boost { namespace parameter { namespace aux {
|
||||
#include <boost/parameter/config.hpp>
|
||||
#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>
|
||||
|
||||
#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 { namespace parameter { namespace aux {
|
||||
|
||||
#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<
|
||||
@@ -34,6 +58,11 @@ namespace boost { namespace parameter { namespace aux {
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::mpl::false_
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
::boost::is_lvalue_reference<T>
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::parameter::aux::is_template_keyword_aux<T>
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
2
include/boost/parameter/aux_/unwrap_cv_reference.hpp
Normal file → Executable file
2
include/boost/parameter/aux_/unwrap_cv_reference.hpp
Normal file → Executable file
@@ -103,7 +103,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
struct unwrap_cv_reference<T,::boost::mpl::true_> : T
|
||||
{
|
||||
};
|
||||
#else // !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#else // !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
// 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>
|
||||
|
||||
@@ -10,27 +10,40 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
|
||||
// Require correct SFINAE support, needed explicitly by tagged_argument &
|
||||
// keyword & cast; correct function template ordering, needed by the code
|
||||
// generation macros; and the ability to handle multiple parameter packs,
|
||||
// needed by parameters. Older versions of GCC either don't have the latter
|
||||
// ability or cannot disambiguate between keyword's overloaded
|
||||
// operators.
|
||||
// Allow projects to #define BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING to
|
||||
// turn off perfect forwarding as necessary. Otherwise, also require correct
|
||||
// SFINAE support, needed explicitly by tagged_argument & keyword & cast;
|
||||
// correct function template ordering, needed by the code generation macros;
|
||||
// rvalue references, needed throughout; variadic templates, needed by
|
||||
// parameters; and the ability to handle multiple parameter packs, needed by
|
||||
// parameters. Older versions of GCC either don't have the latter ability or
|
||||
// cannot disambiguate between keyword's overloaded operators.
|
||||
// -- Cromwell D. Enage
|
||||
#if defined(BOOST_NO_SFINAE) || \
|
||||
defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) || \
|
||||
defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
|
||||
defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || \
|
||||
BOOST_WORKAROUND(BOOST_GCC, < 40900)
|
||||
#error Your compiler does not support perfect forwarding.
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
!defined(BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING) && \
|
||||
!defined(BOOST_NO_SFINAE) && \
|
||||
!defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) && \
|
||||
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
|
||||
!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
|
||||
!BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
|
||||
!BOOST_WORKAROUND(BOOST_GCC, < 40900)
|
||||
#define BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/limits/vector.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if !defined(BOOST_PARAMETER_MAX_ARITY)
|
||||
// Unlike the variadic MPL sequences provided by Boost.Fusion,
|
||||
// boost::mpl::vector has a size limit. -- Cromwell D. Enage
|
||||
#if !defined(BOOST_PARAMETER_MAX_ARITY)
|
||||
#include <boost/mpl/limits/vector.hpp>
|
||||
#define BOOST_PARAMETER_MAX_ARITY BOOST_MPL_LIMIT_VECTOR_SIZE
|
||||
#endif
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if !defined(BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
#define BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY 11
|
||||
#endif
|
||||
#if !defined(BOOST_PARAMETER_MAX_ARITY)
|
||||
#define BOOST_PARAMETER_MAX_ARITY 8
|
||||
#endif
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
#endif // include guard
|
||||
|
||||
|
||||
@@ -7,10 +7,13 @@
|
||||
#ifndef KEYWORD_050328_HPP
|
||||
#define KEYWORD_050328_HPP
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
#include <boost/parameter/keyword_fwd.hpp>
|
||||
#include <boost/parameter/aux_/tag.hpp>
|
||||
#include <boost/parameter/aux_/default.hpp>
|
||||
#include <boost/parameter/keyword_fwd.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
@@ -309,6 +312,207 @@ namespace boost { namespace parameter {
|
||||
::keyword<Tag>::instance = ::boost::parameter::keyword<Tag>();
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_scalar.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#endif // BOOST_NO_SFINAE
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
// Instances of unique specializations of keyword<...> serve to
|
||||
// associate arguments with parameter names. For example:
|
||||
//
|
||||
// struct rate_; // parameter names
|
||||
// struct skew_;
|
||||
//
|
||||
// namespace
|
||||
// {
|
||||
// keyword<rate_> rate; // keywords
|
||||
// keyword<skew_> skew;
|
||||
// }
|
||||
//
|
||||
// ...
|
||||
//
|
||||
// f(rate = 1, skew = 2.4);
|
||||
template <typename Tag>
|
||||
struct keyword
|
||||
{
|
||||
template <typename T>
|
||||
#if defined(BOOST_NO_SFINAE)
|
||||
inline typename ::boost::parameter::aux::tag<Tag,T const&>::type
|
||||
#else
|
||||
inline typename ::boost::lazy_enable_if<
|
||||
typename ::boost::mpl::eval_if<
|
||||
::boost::is_scalar<T>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::mpl::eval_if<
|
||||
::boost::is_same<
|
||||
typename Tag::qualifier
|
||||
, ::boost::parameter::in_reference
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::mpl::if_<
|
||||
::boost::is_same<
|
||||
typename Tag::qualifier
|
||||
, ::boost::parameter::forward_reference
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::mpl::false_
|
||||
>
|
||||
>
|
||||
>::type
|
||||
, ::boost::parameter::aux::tag<Tag,T const&>
|
||||
>::type BOOST_CONSTEXPR
|
||||
#endif // BOOST_NO_SFINAE
|
||||
operator=(T const& x) const
|
||||
{
|
||||
typedef typename ::boost::parameter::aux
|
||||
::tag<Tag,T const&>::type result;
|
||||
return result(x);
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
#if defined(BOOST_NO_SFINAE)
|
||||
inline ::boost::parameter::aux::default_<Tag,Default const>
|
||||
#else
|
||||
inline typename ::boost::enable_if<
|
||||
typename ::boost::mpl::eval_if<
|
||||
::boost::is_scalar<Default>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::mpl::eval_if<
|
||||
::boost::is_same<
|
||||
typename Tag::qualifier
|
||||
, ::boost::parameter::in_reference
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::mpl::if_<
|
||||
::boost::is_same<
|
||||
typename Tag::qualifier
|
||||
, ::boost::parameter::forward_reference
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::mpl::false_
|
||||
>
|
||||
>
|
||||
>::type
|
||||
, ::boost::parameter::aux::default_<Tag,Default const>
|
||||
>::type
|
||||
#endif // BOOST_NO_SFINAE
|
||||
operator|(Default const& d) const
|
||||
{
|
||||
return ::boost::parameter::aux::default_<Tag,Default const>(d);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
#if defined(BOOST_NO_SFINAE)
|
||||
inline typename ::boost::parameter::aux::tag<Tag,T&>::type
|
||||
#else
|
||||
inline typename ::boost::lazy_enable_if<
|
||||
typename ::boost::mpl::eval_if<
|
||||
typename ::boost::mpl::if_<
|
||||
::boost::is_same<
|
||||
typename Tag::qualifier
|
||||
, ::boost::parameter::out_reference
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::is_same<
|
||||
typename Tag::qualifier
|
||||
, ::boost::parameter::forward_reference
|
||||
>
|
||||
>::type
|
||||
, ::boost::mpl::if_<
|
||||
::boost::is_const<T>
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::mpl::true_
|
||||
>
|
||||
, ::boost::mpl::false_
|
||||
>::type
|
||||
, ::boost::parameter::aux::tag<Tag,T&>
|
||||
>::type BOOST_CONSTEXPR
|
||||
#endif // BOOST_NO_SFINAE
|
||||
operator=(T& x) const
|
||||
{
|
||||
typedef typename ::boost::parameter::aux
|
||||
::tag<Tag,T&>::type result;
|
||||
return result(x);
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
#if defined(BOOST_NO_SFINAE)
|
||||
inline ::boost::parameter::aux::default_<Tag,Default>
|
||||
#else
|
||||
inline typename ::boost::enable_if<
|
||||
typename ::boost::mpl::eval_if<
|
||||
typename ::boost::mpl::if_<
|
||||
::boost::is_same<
|
||||
typename Tag::qualifier
|
||||
, ::boost::parameter::out_reference
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
, ::boost::is_same<
|
||||
typename Tag::qualifier
|
||||
, ::boost::parameter::forward_reference
|
||||
>
|
||||
>::type
|
||||
, ::boost::mpl::if_<
|
||||
::boost::is_const<Default>
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::mpl::true_
|
||||
>
|
||||
, ::boost::mpl::false_
|
||||
>::type
|
||||
, ::boost::parameter::aux::default_<Tag,Default>
|
||||
>::type
|
||||
#endif // BOOST_NO_SFINAE
|
||||
operator|(Default& d) const
|
||||
{
|
||||
return ::boost::parameter::aux::default_<Tag,Default>(d);
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline ::boost::parameter::aux::lazy_default<Tag,Default const>
|
||||
operator||(Default const& d) const
|
||||
{
|
||||
return ::boost::parameter::aux
|
||||
::lazy_default<Tag,Default const>(d);
|
||||
}
|
||||
|
||||
template <typename Default>
|
||||
inline ::boost::parameter::aux::lazy_default<Tag,Default>
|
||||
operator||(Default& d) const
|
||||
{
|
||||
return ::boost::parameter::aux::lazy_default<Tag,Default>(d);
|
||||
}
|
||||
|
||||
public: // Insurance against ODR violations
|
||||
// Users will need to define their keywords in header files. To
|
||||
// prevent ODR violations, it's important that the keyword used in
|
||||
// every instantiation of a function template is the same object.
|
||||
// We provide a reference to a common instance of each keyword
|
||||
// object and prevent construction by users.
|
||||
static ::boost::parameter::keyword<Tag> const instance;
|
||||
|
||||
// This interface is deprecated.
|
||||
static ::boost::parameter::keyword<Tag>& get()
|
||||
{
|
||||
return const_cast< ::boost::parameter::keyword<Tag>&>(instance);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Tag>
|
||||
::boost::parameter::keyword<Tag> const ::boost::parameter
|
||||
::keyword<Tag>::instance = ::boost::parameter::keyword<Tag>();
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
|
||||
#include <boost/parameter/aux_/name.hpp>
|
||||
|
||||
// Reduces boilerplate required to declare and initialize keywords without
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
#define BOOST_PARAMETER_FUN_0(z, n, params) \
|
||||
BOOST_PP_TUPLE_ELEM(3, 0, params) BOOST_PP_TUPLE_ELEM(3, 1, params)() \
|
||||
{ \
|
||||
@@ -85,6 +87,101 @@
|
||||
)(z, n, params)
|
||||
/**/
|
||||
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
#define BOOST_PARAMETER_FUN_DEFN_0(z, n, params) \
|
||||
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename T)> \
|
||||
BOOST_PP_TUPLE_ELEM(3, 0, params) \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, params)( \
|
||||
BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, T, const& p) \
|
||||
BOOST_PARAMETER_MATCH_TYPE_Z( \
|
||||
z, n, BOOST_PP_TUPLE_ELEM(3, 2, params) \
|
||||
) \
|
||||
) \
|
||||
{ \
|
||||
return BOOST_PP_CAT( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, params) \
|
||||
, _with_named_params \
|
||||
)(kw(BOOST_PP_ENUM_PARAMS_Z(z, n, p))); \
|
||||
}
|
||||
/**/
|
||||
|
||||
#include <boost/preprocessor/seq/seq.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_FUN_0(z, n, seq) \
|
||||
BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq))) \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)))() \
|
||||
{ \
|
||||
return BOOST_PP_CAT( \
|
||||
BOOST_PP_TUPLE_ELEM( \
|
||||
3, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
) \
|
||||
, _with_named_params \
|
||||
)( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq))) \
|
||||
()() \
|
||||
); \
|
||||
}
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/binary_seq_to_args.hpp>
|
||||
#include <boost/preprocessor/seq/size.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_FUN_DEFN_R(r, seq) \
|
||||
template < \
|
||||
BOOST_PP_ENUM_PARAMS( \
|
||||
BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
, typename T \
|
||||
) \
|
||||
> BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_SEQ_HEAD(seq)) \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_SEQ_HEAD(seq))( \
|
||||
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS( \
|
||||
BOOST_PP_SEQ_TAIL(seq), (T)(p) \
|
||||
) \
|
||||
BOOST_PARAMETER_MATCH_TYPE( \
|
||||
BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
, BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_SEQ_HEAD(seq)) \
|
||||
) \
|
||||
) \
|
||||
{ \
|
||||
return BOOST_PP_CAT( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_SEQ_HEAD(seq)) \
|
||||
, _with_named_params \
|
||||
)( \
|
||||
kw( \
|
||||
BOOST_PP_ENUM_PARAMS( \
|
||||
BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)), p \
|
||||
) \
|
||||
) \
|
||||
); \
|
||||
}
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/binary_seq_for_each.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_FUN_DEFN_1(z, n, params) \
|
||||
BOOST_PP_IF( \
|
||||
n \
|
||||
, BOOST_PARAMETER_AUX_PP_BINARY_SEQ_FOR_EACH_Z \
|
||||
, BOOST_PARAMETER_FUN_0 \
|
||||
)(z, n, (BOOST_PARAMETER_FUN_DEFN_R)(params))
|
||||
/**/
|
||||
|
||||
#include <boost/preprocessor/comparison/less.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_FUN_DECL(z, n, params) \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_PARAMETER_FUN_DEFN_ \
|
||||
, BOOST_PP_LESS( \
|
||||
n \
|
||||
, BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY \
|
||||
) \
|
||||
)(z, n, params)
|
||||
/**/
|
||||
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
|
||||
#include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
|
||||
|
||||
73
include/boost/parameter/match.hpp
Normal file → Executable file
73
include/boost/parameter/match.hpp
Normal file → Executable file
@@ -1,42 +1,34 @@
|
||||
// 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_MATCH_DWA2005714_HPP
|
||||
# define BOOST_PARAMETER_MATCH_DWA2005714_HPP
|
||||
#define BOOST_PARAMETER_MATCH_DWA2005714_HPP
|
||||
|
||||
# include <boost/detail/workaround.hpp>
|
||||
# include <boost/preprocessor/seq/enum.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
# if BOOST_WORKAROUND(__MWERKS__, <= 0x3003)
|
||||
// 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
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
#include <boost/preprocessor/seq/size.hpp>
|
||||
|
||||
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#define BOOST_PARAMETER_MATCH_DEFAULTS(ArgTypes) \
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS( \
|
||||
BOOST_PP_SUB( \
|
||||
BOOST_PARAMETER_MAX_ARITY \
|
||||
, BOOST_PP_SEQ_SIZE(ArgTypes) \
|
||||
) \
|
||||
, ::boost::parameter::void_ BOOST_PP_INTERCEPT \
|
||||
)
|
||||
/**/
|
||||
#else
|
||||
#define BOOST_PARAMETER_MATCH_DEFAULTS(ArgTypes)
|
||||
#endif
|
||||
|
||||
# include <boost/parameter/config.hpp>
|
||||
# include <boost/parameter/aux_/void.hpp>
|
||||
# include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
# include <boost/preprocessor/facilities/intercept.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
|
||||
# define BOOST_PARAMETER_MATCH_DEFAULTS(ArgTypes) \
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS( \
|
||||
BOOST_PP_SUB( \
|
||||
BOOST_PARAMETER_MAX_ARITY \
|
||||
, BOOST_PP_SEQ_SIZE(ArgTypes) \
|
||||
) \
|
||||
, ::boost::parameter::void_ BOOST_PP_INTERCEPT \
|
||||
)
|
||||
|
||||
# else
|
||||
|
||||
# define BOOST_PARAMETER_MATCH_DEFAULTS(ArgTypes)
|
||||
|
||||
# endif
|
||||
#include <boost/parameter/aux_/preprocessor/seq_enum.hpp>
|
||||
|
||||
//
|
||||
// Generates, e.g.
|
||||
@@ -45,11 +37,12 @@
|
||||
//
|
||||
// with workarounds for Borland compatibility.
|
||||
//
|
||||
#define BOOST_PARAMETER_MATCH(ParameterSpec, ArgTypes, name) \
|
||||
typename ParameterSpec::match< \
|
||||
BOOST_PARAMETER_SEQ_ENUM(ArgTypes) \
|
||||
BOOST_PARAMETER_MATCH_DEFAULTS(ArgTypes) \
|
||||
>::type name = ParameterSpec()
|
||||
/**/
|
||||
|
||||
# define BOOST_PARAMETER_MATCH(ParameterSpec, ArgTypes, name) \
|
||||
typename ParameterSpec ::match< \
|
||||
BOOST_PARAMETER_SEQ_ENUM(ArgTypes) \
|
||||
BOOST_PARAMETER_MATCH_DEFAULTS(ArgTypes) \
|
||||
>::type name = ParameterSpec ()
|
||||
#endif // include guard
|
||||
|
||||
#endif // BOOST_PARAMETER_MATCH_DWA2005714_HPP
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
// The make_arg_list<> metafunction produces a reversed arg_list,
|
||||
@@ -208,5 +210,322 @@ namespace boost { namespace parameter {
|
||||
};
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/parameter/aux_/arg_list.hpp>
|
||||
#include <boost/parameter/aux_/pack/make_arg_list.hpp>
|
||||
#include <boost/parameter/aux_/pack/make_items.hpp>
|
||||
#include <boost/parameter/aux_/pack/make_deduced_items.hpp>
|
||||
#include <boost/parameter/aux_/pack/tag_template_keyword_arg.hpp>
|
||||
#include <boost/parameter/aux_/preprocessor/binary_seq_for_each.hpp>
|
||||
#include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/selection/min.hpp>
|
||||
|
||||
#if ( \
|
||||
BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < \
|
||||
BOOST_PARAMETER_MAX_ARITY \
|
||||
)
|
||||
#include <boost/parameter/aux_/pack/tag_keyword_arg_ref.hpp>
|
||||
#include <boost/mpl/pair.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE) && \
|
||||
!BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
|
||||
#include <boost/parameter/aux_/pack/tag_keyword_arg.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#else
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/no_perfect_forwarding_begin.hpp>
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
template <
|
||||
typename PS0
|
||||
, BOOST_PP_ENUM_SHIFTED(
|
||||
BOOST_PARAMETER_MAX_ARITY, BOOST_PARAMETER_template_args, PS
|
||||
)
|
||||
>
|
||||
struct parameters
|
||||
{
|
||||
typedef typename BOOST_PARAMETER_build_deduced_list(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, ::boost::parameter::aux::make_deduced_items
|
||||
, PS
|
||||
)::type deduced_list;
|
||||
|
||||
// If the elements of NamedList match the criteria of overload
|
||||
// resolution, returns a type which can be constructed from
|
||||
// parameters. Otherwise, this is not a valid metafunction
|
||||
// (no nested ::type).
|
||||
#if !defined(BOOST_NO_SFINAE) && \
|
||||
!BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
|
||||
// If NamedList satisfies the PS0, PS1, ..., this is a metafunction
|
||||
// returning parameters. Otherwise it has no nested ::type.
|
||||
template <typename ArgumentPackAndError>
|
||||
struct match_base
|
||||
: ::boost::mpl::if_<
|
||||
// ::boost::mpl::and_<
|
||||
// aux::satisfies_requirements_of<NamedList,PS0>
|
||||
// , ::boost::mpl::and_<
|
||||
// aux::satisfies_requirements_of<NamedList,PS1>...
|
||||
// ..., ::boost::mpl::true_
|
||||
// ...> >
|
||||
typename BOOST_PP_REPEAT(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, BOOST_PARAMETER_satisfies_begin
|
||||
, PS
|
||||
)
|
||||
::boost::is_same<
|
||||
typename ::boost::mpl
|
||||
::second<ArgumentPackAndError>::type
|
||||
, ::boost::parameter::void_
|
||||
>
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, BOOST_PARAMETER_satisfies_end
|
||||
, ::boost::mpl::false_
|
||||
)::type
|
||||
, ::boost::mpl::identity<
|
||||
::boost::parameter::parameters<
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, PS)
|
||||
>
|
||||
>
|
||||
, ::boost::parameter::void_
|
||||
>
|
||||
{
|
||||
};
|
||||
#endif // SFINAE enabled, not Borland.
|
||||
|
||||
// Specializations are to be used as an optional argument
|
||||
// to eliminate overloads via SFINAE.
|
||||
template <
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
// Borland simply can't handle default arguments in member
|
||||
// class templates. People wishing to write portable code can
|
||||
// explicitly specify BOOST_PARAMETER_MAX_ARITY arguments.
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, typename A)
|
||||
#else
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, typename A
|
||||
, = ::boost::parameter::void_ BOOST_PP_INTERCEPT
|
||||
)
|
||||
#endif
|
||||
>
|
||||
struct match
|
||||
#if !defined(BOOST_NO_SFINAE) && \
|
||||
!BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
|
||||
: ::boost::parameter::parameters<
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, PS)
|
||||
>::BOOST_NESTED_TEMPLATE match_base<
|
||||
typename ::boost::parameter::aux::make_arg_list<
|
||||
typename BOOST_PARAMETER_build_arg_list(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, ::boost::parameter::aux::make_items
|
||||
, PS
|
||||
, A
|
||||
)::type
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_keyword_arg
|
||||
// Don't emit errors when doing SFINAE.
|
||||
, ::boost::mpl::false_
|
||||
>::type
|
||||
>::type
|
||||
{
|
||||
};
|
||||
#else
|
||||
{
|
||||
typedef ::boost::parameter::parameters<
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, PS)
|
||||
> type;
|
||||
};
|
||||
#endif // SFINAE enabled, not Borland.
|
||||
|
||||
// Metafunction that returns an ArgumentPack.
|
||||
|
||||
// TODO, bind has to instantiate the error type in the result
|
||||
// of make_arg_list.
|
||||
|
||||
template <
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
// Borland simply can't handle default arguments in member
|
||||
// class templates. People wishing to write portable code can
|
||||
// explicitly specify BOOST_PARAMETER_MAX_ARITY arguments
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, typename A)
|
||||
#else
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, typename A
|
||||
, = ::boost::parameter::void_ BOOST_PP_INTERCEPT
|
||||
)
|
||||
#endif
|
||||
>
|
||||
struct bind
|
||||
{
|
||||
typedef typename ::boost::parameter::aux::make_arg_list<
|
||||
typename BOOST_PARAMETER_build_arg_list(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, ::boost::parameter::aux::make_items
|
||||
, PS
|
||||
, A
|
||||
)::type
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_template_keyword_arg
|
||||
>::type result;
|
||||
|
||||
typedef typename ::boost::mpl::first<result>::type type;
|
||||
};
|
||||
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_PARAMETER_MAX_ARITY
|
||||
, BOOST_PARAMETER_forward_typedef
|
||||
, (PS)(parameter_spec)
|
||||
)
|
||||
|
||||
// The function call operator is used to build an arg_list that
|
||||
// labels the positional parameters and maintains whatever other
|
||||
// tags may have been specified by the caller.
|
||||
//
|
||||
// !!!NOTE!!!
|
||||
//
|
||||
// The make_arg_list<> metafunction produces a reversed arg_list,
|
||||
// so pass the arguments to the arg_list constructor reversed in turn.
|
||||
inline ::boost::parameter::aux::empty_arg_list operator()() const
|
||||
{
|
||||
return ::boost::parameter::aux::empty_arg_list();
|
||||
}
|
||||
|
||||
#if (0 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_PP_MIN(
|
||||
BOOST_PP_INC(BOOST_PARAMETER_MAX_ARITY)
|
||||
, BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY
|
||||
)
|
||||
, BOOST_PARAMETER_AUX_PP_BINARY_SEQ_FOR_EACH_Z
|
||||
, (BOOST_PARAMETER_function_call_op_overload_R)(_)
|
||||
)
|
||||
#if ( \
|
||||
BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < \
|
||||
BOOST_PARAMETER_MAX_ARITY \
|
||||
)
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3,( \
|
||||
BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY \
|
||||
, BOOST_PARAMETER_MAX_ARITY \
|
||||
, <boost/parameter/aux_/preprocessor/overloads.hpp> \
|
||||
))
|
||||
#include BOOST_PP_ITERATE()
|
||||
#endif
|
||||
#else // (0 == BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
template <typename A0>
|
||||
typename ::boost::mpl::first<
|
||||
typename ::boost::parameter::aux::make_arg_list<
|
||||
::boost::parameter::aux::item<
|
||||
PS0,A0
|
||||
>
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_keyword_arg_ref
|
||||
>::type
|
||||
>::type
|
||||
operator()(A0& a0) const
|
||||
{
|
||||
typedef typename ::boost::parameter::aux::make_arg_list<
|
||||
::boost::parameter::aux::item<
|
||||
PS0,A0
|
||||
>
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_keyword_arg_ref
|
||||
>::type result;
|
||||
|
||||
typedef typename ::boost::mpl::first<result>::type result_type;
|
||||
typedef typename ::boost::mpl::second<result>::type error;
|
||||
error();
|
||||
|
||||
return result_type(
|
||||
a0
|
||||
// , void_(), void_(), void_() ...
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(
|
||||
BOOST_PP_SUB(BOOST_PARAMETER_MAX_ARITY, 1)
|
||||
, ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
typename ::boost::mpl::first<
|
||||
typename ::boost::parameter::aux::make_arg_list<
|
||||
::boost::parameter::aux::item<
|
||||
PS0,A0
|
||||
, ::boost::parameter::aux::item<
|
||||
PS1,A1
|
||||
>
|
||||
>
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_keyword_arg_ref
|
||||
>::type
|
||||
>::type
|
||||
operator()(A0& a0, A1& a1) const
|
||||
{
|
||||
typedef typename ::boost::parameter::aux::make_arg_list<
|
||||
::boost::parameter::aux::item<
|
||||
PS0,A0
|
||||
, ::boost::parameter::aux::item<
|
||||
PS1,A1
|
||||
>
|
||||
>
|
||||
, deduced_list
|
||||
, ::boost::parameter::aux::tag_keyword_arg
|
||||
>::type result;
|
||||
|
||||
typedef typename ::boost::mpl::first<result>::type result_type;
|
||||
typedef typename ::boost::mpl::second<result>::type error;
|
||||
error();
|
||||
|
||||
return result_type(
|
||||
a1
|
||||
, a0
|
||||
// , void_(), void_() ...
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(
|
||||
BOOST_PP_SUB(BOOST_PARAMETER_MAX_ARITY, 2)
|
||||
, ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#if (2 < BOOST_PARAMETER_MAX_ARITY)
|
||||
// Higher arities are handled by the preprocessor
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3,( \
|
||||
3 \
|
||||
, BOOST_PARAMETER_MAX_ARITY \
|
||||
, <boost/parameter/aux_/preprocessor/overloads.hpp> \
|
||||
))
|
||||
#include BOOST_PP_ITERATE()
|
||||
#endif
|
||||
#endif // exponential overloads
|
||||
};
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/no_perfect_forwarding_end.hpp>
|
||||
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
#endif // include guard
|
||||
|
||||
|
||||
23
include/boost/parameter/preprocessor.hpp
Normal file → Executable file
23
include/boost/parameter/preprocessor.hpp
Normal file → Executable file
@@ -65,7 +65,8 @@
|
||||
// accessible via args and keywords only.
|
||||
#define BOOST_PARAMETER_CONSTRUCTOR(class_, base, tag_namespace, args) \
|
||||
BOOST_PARAMETER_CONSTRUCTOR_AUX( \
|
||||
class_, base, tag_namespace, BOOST_PARAMETER_FLATTEN(2, 2, 3, args) \
|
||||
class_, base, tag_namespace \
|
||||
, BOOST_PARAMETER_AUX_PP_FLATTEN(2, 2, 3, args) \
|
||||
)
|
||||
/**/
|
||||
|
||||
@@ -73,7 +74,8 @@
|
||||
// accessible via args and keywords only.
|
||||
#define BOOST_PARAMETER_BASIC_FUNCTION(result, name, tag_namespace, args) \
|
||||
BOOST_PARAMETER_BASIC_FUNCTION_AUX( \
|
||||
result, name, tag_namespace, BOOST_PARAMETER_FLATTEN(2, 2, 3, args) \
|
||||
result, name, tag_namespace \
|
||||
, BOOST_PARAMETER_AUX_PP_FLATTEN(2, 2, 3, args) \
|
||||
)
|
||||
/**/
|
||||
|
||||
@@ -81,7 +83,8 @@
|
||||
// are accessible via args and keywords only.
|
||||
#define BOOST_PARAMETER_BASIC_MEMBER_FUNCTION(result, name, tag_ns, args) \
|
||||
BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX( \
|
||||
result, name, tag_ns, BOOST_PARAMETER_FLATTEN(2, 2, 3, args), 0 \
|
||||
result, name, tag_ns \
|
||||
, BOOST_PARAMETER_AUX_PP_FLATTEN(2, 2, 3, args), 0 \
|
||||
)
|
||||
/**/
|
||||
|
||||
@@ -89,7 +92,8 @@
|
||||
// header. All arguments are accessible via args and keywords only.
|
||||
#define BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION(r, name, tag_ns, args) \
|
||||
BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX( \
|
||||
r, name, tag_ns, BOOST_PARAMETER_FLATTEN(2, 2, 3, args), 1 \
|
||||
r, name, tag_ns \
|
||||
, BOOST_PARAMETER_AUX_PP_FLATTEN(2, 2, 3, args), 1 \
|
||||
)
|
||||
/**/
|
||||
|
||||
@@ -109,7 +113,8 @@
|
||||
// accessible via args and keywords, as well as by name.
|
||||
#define BOOST_PARAMETER_FUNCTION(result, name, tag_namespace, args) \
|
||||
BOOST_PARAMETER_FUNCTION_AUX( \
|
||||
result, name, tag_namespace, BOOST_PARAMETER_FLATTEN(3, 2, 3, args) \
|
||||
result, name, tag_namespace \
|
||||
, BOOST_PARAMETER_AUX_PP_FLATTEN(3, 2, 3, args) \
|
||||
)
|
||||
/**/
|
||||
|
||||
@@ -130,7 +135,7 @@
|
||||
#define BOOST_PARAMETER_MEMBER_FUNCTION(result, name, tag_ns, args) \
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION_AUX( \
|
||||
result, name, name, tag_ns, 0 \
|
||||
, BOOST_PARAMETER_FLATTEN(3, 2, 3, args) \
|
||||
, BOOST_PARAMETER_AUX_PP_FLATTEN(3, 2, 3, args) \
|
||||
)
|
||||
/**/
|
||||
|
||||
@@ -140,7 +145,7 @@
|
||||
#define BOOST_PARAMETER_CONST_MEMBER_FUNCTION(result, name, tag_ns, args) \
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION_AUX( \
|
||||
result, name, name, tag_ns, 1 \
|
||||
, BOOST_PARAMETER_FLATTEN(3, 2, 3, args) \
|
||||
, BOOST_PARAMETER_AUX_PP_FLATTEN(3, 2, 3, args) \
|
||||
)
|
||||
/**/
|
||||
|
||||
@@ -149,7 +154,7 @@
|
||||
#define BOOST_PARAMETER_FUNCTION_CALL_OPERATOR(result, tag_ns, args) \
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION_AUX( \
|
||||
result, operator(), operator, tag_ns, 0 \
|
||||
, BOOST_PARAMETER_FLATTEN(3, 2, 3, args) \
|
||||
, BOOST_PARAMETER_AUX_PP_FLATTEN(3, 2, 3, args) \
|
||||
)
|
||||
/**/
|
||||
|
||||
@@ -159,7 +164,7 @@
|
||||
#define BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR(result, tag_ns, args) \
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION_AUX( \
|
||||
result, operator(), operator, tag_ns, 1 \
|
||||
, BOOST_PARAMETER_FLATTEN(3, 2, 3, args) \
|
||||
, BOOST_PARAMETER_AUX_PP_FLATTEN(3, 2, 3, args) \
|
||||
)
|
||||
/**/
|
||||
|
||||
|
||||
424
test/Jamfile.v2
424
test/Jamfile.v2
@@ -22,8 +22,24 @@ alias parameter_standard_tests
|
||||
[ run singular.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run tutorial.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run compose.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run sfinae.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run optional_deduced_sfinae.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run sfinae.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=2
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run optional_deduced_sfinae.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run efficiency.cpp
|
||||
:
|
||||
:
|
||||
@@ -33,12 +49,32 @@ alias parameter_standard_tests
|
||||
<variant>release
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run evaluate_category.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run evaluate_category_16.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run evaluate_category.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=5
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run evaluate_category_16.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=16
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=0
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run preprocessor_eval_category.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=5
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
@@ -47,32 +83,102 @@ alias parameter_standard_tests
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=2
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run basics.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run mpl.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run earwicker.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run macros.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run preprocessor.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run preprocessor_deduced.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run deduced.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run basics.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run mpl.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run earwicker.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run macros.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run preprocessor.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run preprocessor_deduced.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run deduced.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run deduced_dependent_predicate.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ compile unwrap_cv_reference.cpp ]
|
||||
[ compile ntp.cpp ]
|
||||
[ compile ntp.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
]
|
||||
[ compile function_type_tpl_param.cpp ]
|
||||
[ compile-fail duplicates.cpp : : duplicates_fail ]
|
||||
[ compile-fail deduced_unmatched_arg.cpp : : deduced_unmatched_arg_fail ]
|
||||
[ compile-fail duplicates.cpp
|
||||
:
|
||||
:
|
||||
duplicates_fail
|
||||
]
|
||||
[ compile-fail deduced_unmatched_arg.cpp
|
||||
:
|
||||
:
|
||||
deduced_unmatched_arg_fail
|
||||
]
|
||||
[ compile-fail basics.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE
|
||||
:
|
||||
basics_fail
|
||||
@@ -91,6 +197,8 @@ alias parameter_standard_tests
|
||||
]
|
||||
[ compile-fail evaluate_category.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=5
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE
|
||||
:
|
||||
evaluate_category_fail
|
||||
@@ -121,11 +229,20 @@ alias parameter_literate_tests
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run literate/top-level0.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run literate/top-level0.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=3
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run literate/predicate-requirements0.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=5
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
@@ -134,6 +251,7 @@ alias parameter_literate_tests
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=2
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
@@ -154,14 +272,47 @@ alias parameter_literate_tests
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run literate/namespaces0.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run literate/namespaces1.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run literate/namespaces2.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run literate/namespaces3.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run literate/namespaces0.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=2
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run literate/namespaces1.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=2
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run literate/namespaces2.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=2
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run literate/namespaces3.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=2
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run literate/parameter-enabled-constructors0.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=2
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
@@ -170,6 +321,7 @@ alias parameter_literate_tests
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
@@ -178,6 +330,7 @@ alias parameter_literate_tests
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=5
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
@@ -186,6 +339,7 @@ alias parameter_literate_tests
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=5
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
@@ -194,6 +348,7 @@ alias parameter_literate_tests
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=2
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
@@ -201,17 +356,44 @@ alias parameter_literate_tests
|
||||
[ compile literate/template-keywords0.cpp ]
|
||||
[ compile literate/template-keywords1.cpp ]
|
||||
[ compile literate/headers-and-namespaces0.cpp ]
|
||||
[ compile literate/handling-out-parameters0.cpp ]
|
||||
[ compile literate/writing-the-function0.cpp ]
|
||||
[ compile literate/handling-out-parameters0.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=5
|
||||
]
|
||||
[ compile literate/writing-the-function0.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=5
|
||||
]
|
||||
[ compile literate/defining-the-keywords0.cpp ]
|
||||
[ compile literate/defining-the-keywords1.cpp ]
|
||||
[ compile literate/exercising-the-code-so-far0.cpp ]
|
||||
[ compile literate/optional-parameters0.cpp ]
|
||||
[ compile literate/static-member-functions0.cpp ]
|
||||
[ compile literate/required-parameters0.cpp ]
|
||||
[ compile literate/class-template-skeleton0.cpp ]
|
||||
[ compile literate/parameter-enabled-member-functions0.cpp ]
|
||||
[ compile literate/parameter-enabled-member-functions1.cpp ]
|
||||
[ compile literate/exercising-the-code-so-far0.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
]
|
||||
[ compile literate/optional-parameters0.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=5
|
||||
]
|
||||
[ compile literate/static-member-functions0.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=2
|
||||
]
|
||||
[ compile literate/required-parameters0.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=2
|
||||
]
|
||||
[ compile literate/class-template-skeleton0.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
]
|
||||
[ compile literate/parameter-enabled-member-functions0.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=2
|
||||
]
|
||||
[ compile literate/parameter-enabled-member-functions1.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=2
|
||||
]
|
||||
;
|
||||
|
||||
alias parameter_python_test
|
||||
@@ -221,92 +403,106 @@ alias parameter_python_test
|
||||
|
||||
alias parameter_macros_eval_category
|
||||
:
|
||||
[ run macros_eval_category.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run macros_eval_category.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=10
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=11
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
;
|
||||
|
||||
alias parameter_macros_eval_category_cxx03
|
||||
:
|
||||
[ run macros_eval_category.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=10
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=0
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
;
|
||||
|
||||
alias parameter_evaluate_category_10
|
||||
:
|
||||
[ run evaluate_category_10.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run evaluate_category_10.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=10
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=11
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
;
|
||||
|
||||
alias parameter_evaluate_category_10_cxx03
|
||||
:
|
||||
[ run evaluate_category_10.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=10
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=0
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
;
|
||||
|
||||
alias parameter_preprocessor_eval_cat_8
|
||||
:
|
||||
[ run preprocessor_eval_cat_8.cpp : : : : : <preserve-target-tests>off ]
|
||||
[ run preprocessor_eval_cat_8.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=8
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=9
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
;
|
||||
|
||||
alias parameter_preprocessor_eval_cat_fail
|
||||
:
|
||||
[ compile-fail preprocessor_eval_category.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=8
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=9
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE
|
||||
:
|
||||
preproc_eval_cat_fail
|
||||
]
|
||||
;
|
||||
|
||||
alias parameter_0011_stress_tests
|
||||
:
|
||||
parameter_preprocessor_eval_cat_8
|
||||
parameter_preprocessor_eval_cat_fail
|
||||
;
|
||||
|
||||
alias parameter_0101_stress_tests
|
||||
:
|
||||
parameter_evaluate_category_10
|
||||
parameter_preprocessor_eval_cat_fail
|
||||
;
|
||||
|
||||
alias parameter_0110_stress_tests
|
||||
:
|
||||
parameter_evaluate_category_10
|
||||
parameter_preprocessor_eval_cat_8
|
||||
;
|
||||
|
||||
alias parameter_0111_stress_tests
|
||||
:
|
||||
parameter_0110_stress_tests
|
||||
parameter_preprocessor_eval_cat_fail
|
||||
;
|
||||
|
||||
alias parameter_1001_stress_tests
|
||||
:
|
||||
parameter_macros_eval_category
|
||||
parameter_preprocessor_eval_cat_fail
|
||||
;
|
||||
|
||||
alias parameter_1010_stress_tests
|
||||
:
|
||||
parameter_macros_eval_category
|
||||
parameter_preprocessor_eval_cat_8
|
||||
;
|
||||
|
||||
alias parameter_1011_stress_tests
|
||||
:
|
||||
parameter_1010_stress_tests
|
||||
parameter_preprocessor_eval_cat_fail
|
||||
;
|
||||
|
||||
alias parameter_1100_stress_tests
|
||||
:
|
||||
parameter_macros_eval_category
|
||||
parameter_evaluate_category_10
|
||||
;
|
||||
|
||||
alias parameter_1101_stress_tests
|
||||
:
|
||||
parameter_1100_stress_tests
|
||||
parameter_preprocessor_eval_cat_fail
|
||||
;
|
||||
|
||||
alias parameter_1110_stress_tests
|
||||
:
|
||||
parameter_1100_stress_tests
|
||||
parameter_preprocessor_eval_cat_8
|
||||
;
|
||||
|
||||
alias parameter_all_stress_tests
|
||||
:
|
||||
parameter_1110_stress_tests
|
||||
parameter_macros_eval_category
|
||||
parameter_evaluate_category_10
|
||||
parameter_preprocessor_eval_cat_8
|
||||
parameter_preprocessor_eval_cat_fail
|
||||
;
|
||||
|
||||
alias parameter_all_stress_tests_except_preproc_eval_cat_8
|
||||
:
|
||||
parameter_macros_eval_category_cxx03
|
||||
parameter_evaluate_category_10_cxx03
|
||||
parameter_preprocessor_eval_cat_fail
|
||||
;
|
||||
|
||||
alias parameter_all_stress_tests_cxx03
|
||||
:
|
||||
parameter_macros_eval_category_cxx03
|
||||
parameter_evaluate_category_10_cxx03
|
||||
parameter_preprocessor_eval_cat_8
|
||||
parameter_preprocessor_eval_cat_fail
|
||||
;
|
||||
|
||||
@@ -316,24 +512,12 @@ alias parameter_sl_tests
|
||||
parameter_literate_tests
|
||||
;
|
||||
|
||||
alias parameter_sp_tests
|
||||
:
|
||||
parameter_standard_tests
|
||||
parameter_python_test
|
||||
;
|
||||
|
||||
alias parameter_slp_tests
|
||||
:
|
||||
parameter_sl_tests
|
||||
parameter_python_test
|
||||
;
|
||||
|
||||
alias parameter_all_but_preproc_eval_cat_fail_tests
|
||||
:
|
||||
parameter_1110_stress_tests
|
||||
parameter_slp_tests
|
||||
;
|
||||
|
||||
alias parameter_all_but_python_tests
|
||||
:
|
||||
parameter_all_stress_tests
|
||||
@@ -346,16 +530,32 @@ alias parameter_all_tests
|
||||
parameter_slp_tests
|
||||
;
|
||||
|
||||
alias parameter_all_tests_except_preproc_eval_cat_8
|
||||
:
|
||||
parameter_all_stress_tests_except_preproc_eval_cat_8
|
||||
parameter_slp_tests
|
||||
;
|
||||
|
||||
alias parameter_all_tests_cxx03
|
||||
:
|
||||
parameter_all_stress_tests_cxx03
|
||||
parameter_slp_tests
|
||||
;
|
||||
|
||||
alias parameter_msvc_fail_tests
|
||||
:
|
||||
[ compile-fail evaluate_category.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=5
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC
|
||||
:
|
||||
evaluate_category_msvc_fail
|
||||
]
|
||||
[ compile-fail preprocessor_eval_category.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=8
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=9
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC
|
||||
:
|
||||
preproc_eval_cat_msvc_fail
|
||||
@@ -374,3 +574,19 @@ alias parameter_msvc_tests
|
||||
parameter_msvc_fail_tests
|
||||
;
|
||||
|
||||
alias parameter_msvc11_fail_tests
|
||||
:
|
||||
[ compile-fail compose.cpp
|
||||
:
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC
|
||||
:
|
||||
compose_msvc11_fail
|
||||
]
|
||||
;
|
||||
|
||||
alias parameter_msvc11_tests
|
||||
:
|
||||
parameter_all_tests
|
||||
parameter_msvc11_fail_tests
|
||||
;
|
||||
|
||||
|
||||
22
test/basics.cpp
Normal file → Executable file
22
test/basics.cpp
Normal file → Executable file
@@ -40,11 +40,31 @@ namespace test {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
template <typename ...Args>
|
||||
int f(Args const&... args)
|
||||
{
|
||||
return test::f_impl(test::f_parameters()(args...));
|
||||
}
|
||||
#else
|
||||
template <typename A0, typename A1, typename A2, typename A3>
|
||||
int f(A0 const& a0, A1 const& a1, A2 const& a2, A3 const& a3)
|
||||
{
|
||||
return test::f_impl(test::f_parameters()(a0, a1, a2, a3));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
int f(A0 const& a0, A1 const& a1, A2 const& a2)
|
||||
{
|
||||
return test::f_impl(test::f_parameters()(a0, a1, a2));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
int f(A0 const& a0, A1 const& a1)
|
||||
{
|
||||
return test::f_impl(test::f_parameters()(a0, a1));
|
||||
}
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
|
||||
template <typename Params>
|
||||
int f_list(Params const& params)
|
||||
@@ -53,7 +73,7 @@ namespace test {
|
||||
}
|
||||
}
|
||||
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/core/ref.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
#include <string>
|
||||
|
||||
|
||||
6
test/basics.hpp
Normal file → Executable file
6
test/basics.hpp
Normal file → Executable file
@@ -8,6 +8,12 @@
|
||||
#define BASICS_050424_HPP
|
||||
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(BOOST_PARAMETER_MAX_ARITY < 4)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 4 or greater.
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
37
test/compose.cpp
Normal file → Executable file
37
test/compose.cpp
Normal file → Executable file
@@ -14,7 +14,11 @@ namespace param {
|
||||
BOOST_PARAMETER_NAME(a3)
|
||||
BOOST_PARAMETER_NAME(in(lrc))
|
||||
BOOST_PARAMETER_NAME(out(lr))
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_PARAMETER_NAME(consume(rr))
|
||||
#else
|
||||
BOOST_PARAMETER_NAME(rr)
|
||||
#endif
|
||||
}
|
||||
|
||||
#include <boost/config.hpp>
|
||||
@@ -32,7 +36,7 @@ namespace test {
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
|
||||
template <typename ArgPack>
|
||||
A(ArgPack const& args) : i(args[param::_a0]), j(args[param::_a1])
|
||||
{
|
||||
@@ -129,15 +133,46 @@ namespace test {
|
||||
|
||||
int main()
|
||||
{
|
||||
#if !defined(LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC) && \
|
||||
BOOST_WORKAROUND(BOOST_MSVC, >= 1700) && \
|
||||
BOOST_WORKAROUND(BOOST_MSVC, < 1800)
|
||||
// MSVC 11.0 on AppVeyor fails without this workaround.
|
||||
test::A a((
|
||||
param::_a0 = 1
|
||||
, param::_a1 = 13
|
||||
, param::_a2 = std::function<double()>(test::D)
|
||||
));
|
||||
#else
|
||||
test::A a((param::_a0 = 1, param::_a1 = 13, param::_a2 = test::D));
|
||||
#endif
|
||||
BOOST_TEST_EQ(1, a.i);
|
||||
BOOST_TEST_EQ(13, a.j);
|
||||
#if !defined(LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC) && \
|
||||
BOOST_WORKAROUND(BOOST_MSVC, >= 1700) && \
|
||||
BOOST_WORKAROUND(BOOST_MSVC, < 1800)
|
||||
// MSVC 11.0 on AppVeyor fails without this workaround.
|
||||
test::B b0((
|
||||
param::_a1 = 13
|
||||
, param::_a2 = std::function<float()>(test::F)
|
||||
));
|
||||
#else
|
||||
test::B b0((param::_a1 = 13, param::_a2 = test::F));
|
||||
#endif
|
||||
BOOST_TEST_EQ(1, b0.i);
|
||||
BOOST_TEST_EQ(13, b0.j);
|
||||
BOOST_TEST_EQ(4.0f, b0.k());
|
||||
BOOST_TEST_EQ(2.5, b0.l());
|
||||
#if !defined(LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC) && \
|
||||
BOOST_WORKAROUND(BOOST_MSVC, >= 1700) && \
|
||||
BOOST_WORKAROUND(BOOST_MSVC, < 1800)
|
||||
// MSVC 11.0 on AppVeyor fails without this workaround.
|
||||
test::B b1((
|
||||
param::_a3 = std::function<double()>(test::D)
|
||||
, param::_a1 = 13
|
||||
));
|
||||
#else
|
||||
test::B b1((param::_a3 = test::D, param::_a1 = 13));
|
||||
#endif
|
||||
BOOST_TEST_EQ(1, b1.i);
|
||||
BOOST_TEST_EQ(13, b1.j);
|
||||
BOOST_TEST_EQ(4.625f, b1.k());
|
||||
|
||||
20
test/deduced.hpp
Normal file → Executable file
20
test/deduced.hpp
Normal file → Executable file
@@ -69,11 +69,31 @@ namespace test {
|
||||
boost::mpl::for_each<E>(test::assert_expected<E,ArgPack>(e, args));
|
||||
}
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
template <typename P, typename E, typename ...Args>
|
||||
void check(E const& e, Args const&... args)
|
||||
{
|
||||
test::check0(e, P()(args...));
|
||||
}
|
||||
#else
|
||||
template <typename P, typename E, typename A0>
|
||||
void check(E const& e, A0 const& a0)
|
||||
{
|
||||
test::check0(e, P()(a0));
|
||||
}
|
||||
|
||||
template <typename P, typename E, typename A0, typename A1>
|
||||
void check(E const& e, A0 const& a0, A1 const& a1)
|
||||
{
|
||||
test::check0(e, P()(a0, a1));
|
||||
}
|
||||
|
||||
template <typename P, typename E, typename A0, typename A1, typename A2>
|
||||
void check(E const& e, A0 const& a0, A1 const& a1, A2 const& a2)
|
||||
{
|
||||
test::check0(e, P()(a0, a1, a2));
|
||||
}
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
} // namespace test
|
||||
|
||||
#endif // include guard
|
||||
|
||||
7
test/earwicker.cpp
Normal file → Executable file
7
test/earwicker.cpp
Normal file → Executable file
@@ -3,6 +3,13 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(BOOST_PARAMETER_MAX_ARITY < 4)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 4 or greater.
|
||||
#endif
|
||||
|
||||
#include <boost/parameter/name.hpp>
|
||||
|
||||
namespace test {
|
||||
|
||||
@@ -3,6 +3,18 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if (BOOST_PARAMETER_MAX_ARITY < 4)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 4 or greater.
|
||||
#endif
|
||||
#if (BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < 5)
|
||||
#error Define BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY \
|
||||
as 5 or greater.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
namespace test {
|
||||
@@ -10,7 +22,11 @@ namespace test {
|
||||
BOOST_PARAMETER_NAME((_lrc0, keywords) in(lrc0))
|
||||
BOOST_PARAMETER_NAME((_lr0, keywords) in_out(lr0))
|
||||
BOOST_PARAMETER_NAME((_rrc0, keywords) in(rrc0))
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_PARAMETER_NAME((_rr0, keywords) consume(rr0))
|
||||
#else
|
||||
BOOST_PARAMETER_NAME((_rr0, keywords) rr0)
|
||||
#endif
|
||||
|
||||
struct f_parameters
|
||||
: boost::parameter::parameters<
|
||||
@@ -43,6 +59,7 @@ namespace test {
|
||||
test::passed_by_lvalue_reference
|
||||
, A<T>::evaluate_category(args[test::_lr0])
|
||||
);
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
if (boost::is_scalar<T>::value)
|
||||
{
|
||||
@@ -66,6 +83,16 @@ namespace test {
|
||||
, A<T>::evaluate_category(args[test::_rr0])
|
||||
);
|
||||
}
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, A<T>::evaluate_category(args[test::_rrc0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, A<T>::evaluate_category(args[test::_rr0])
|
||||
);
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
}
|
||||
};
|
||||
} // namespace test
|
||||
@@ -133,6 +160,8 @@ namespace test {
|
||||
>::type
|
||||
>::evaluate_category(args[test::_lr0])
|
||||
));
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST((
|
||||
test::passed_by_rvalue_reference == test::A<
|
||||
typename boost::remove_const<
|
||||
@@ -143,6 +172,18 @@ namespace test {
|
||||
>::type
|
||||
>::evaluate_category(args[test::_rr0])
|
||||
));
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST((
|
||||
test::passed_by_lvalue_reference_to_const == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::keywords::rr0
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(args[test::_rr0])
|
||||
));
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
}
|
||||
};
|
||||
} // namespace test
|
||||
@@ -203,14 +244,24 @@ int main()
|
||||
test::f_parameters()(
|
||||
"crg"
|
||||
, baz_arr
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
, static_cast<char_arr const&&>("uir")
|
||||
, static_cast<char_arr&&>(baz_arr)
|
||||
#else
|
||||
, "grl"
|
||||
, "grp"
|
||||
#endif
|
||||
)
|
||||
);
|
||||
test::B<char_arr>::evaluate((
|
||||
test::_lr0 = baz_arr
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
, test::_rrc0 = static_cast<char_arr const&&>("wld")
|
||||
, test::_rr0 = static_cast<char_arr&&>(baz_arr)
|
||||
#else
|
||||
, test::_rrc0 = "frd"
|
||||
, test::_rr0 = "plg"
|
||||
#endif
|
||||
, test::_lrc0 = "mos"
|
||||
));
|
||||
#endif // MSVC
|
||||
|
||||
@@ -161,6 +161,11 @@ namespace test {
|
||||
return test::rvalue_const_bitset<N>();
|
||||
}
|
||||
};
|
||||
} // namespace test
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
namespace test {
|
||||
|
||||
template <typename T>
|
||||
struct A
|
||||
@@ -175,6 +180,7 @@ namespace test {
|
||||
return test::passed_by_lvalue_reference;
|
||||
}
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
static test::invoked evaluate_category(T const&&)
|
||||
{
|
||||
return test::passed_by_rvalue_reference_to_const;
|
||||
@@ -184,6 +190,7 @@ namespace test {
|
||||
{
|
||||
return test::passed_by_rvalue_reference;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
struct U
|
||||
@@ -200,6 +207,7 @@ namespace test {
|
||||
return test::passed_by_lvalue_reference;
|
||||
}
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
template <std::size_t N>
|
||||
static test::invoked evaluate_category(std::bitset<N + 1> const&&)
|
||||
{
|
||||
@@ -211,11 +219,11 @@ namespace test {
|
||||
{
|
||||
return test::passed_by_rvalue_reference;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
} // namespace test
|
||||
|
||||
#include <boost/parameter/value_type.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(BOOST_PARAMETER_MAX_ARITY < 10)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 10 or greater.
|
||||
#endif
|
||||
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
namespace test {
|
||||
@@ -10,7 +17,11 @@ namespace test {
|
||||
BOOST_PARAMETER_NAME((_lrc0, keywords) in(lrc0))
|
||||
BOOST_PARAMETER_NAME((_lr0, keywords) in_out(lr0))
|
||||
BOOST_PARAMETER_NAME((_rrc0, keywords) in(rrc0))
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_PARAMETER_NAME((_rr0, keywords) consume(rr0))
|
||||
#else
|
||||
BOOST_PARAMETER_NAME((_rr0, keywords) rr0)
|
||||
#endif
|
||||
BOOST_PARAMETER_NAME((_lrc1, keywords) in(lrc1))
|
||||
BOOST_PARAMETER_NAME((_lr1, keywords) out(lr1))
|
||||
BOOST_PARAMETER_NAME((_rrc1, keywords) in(rrc1))
|
||||
@@ -73,6 +84,7 @@ namespace test {
|
||||
args[test::_lr2 || test::lvalue_bitset_function<2>()]
|
||||
)
|
||||
);
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_rvalue_reference_to_const
|
||||
, U::evaluate_category<0>(args[test::_rrc0])
|
||||
@@ -91,12 +103,39 @@ namespace test {
|
||||
args[test::_rr2 || test::rvalue_bitset_function<2>()]
|
||||
)
|
||||
);
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<0>(args[test::_rrc0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<0>(args[test::_rr0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<1>(args[test::_rrc1])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<2>(
|
||||
args[test::_rr2 || test::rvalue_bitset_function<2>()]
|
||||
)
|
||||
);
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
}
|
||||
};
|
||||
} // namespace test
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#include <boost/parameter/as_lvalue.hpp>
|
||||
#include <boost/core/ref.hpp>
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) || \
|
||||
(10 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
test::C::evaluate(
|
||||
test::g_parameters()(
|
||||
test::lvalue_const_bitset<0>()
|
||||
@@ -122,6 +161,33 @@ int main()
|
||||
, test::rvalue_bitset<2>()
|
||||
)
|
||||
);
|
||||
#else // no perfect forwarding support and no exponential overloads
|
||||
test::C::evaluate(
|
||||
test::g_parameters()(
|
||||
test::lvalue_const_bitset<0>()
|
||||
, boost::ref(test::lvalue_bitset<0>())
|
||||
, test::rvalue_const_bitset<0>()
|
||||
, boost::parameter::as_lvalue(test::rvalue_bitset<0>())
|
||||
, test::lvalue_const_bitset<1>()
|
||||
, boost::ref(test::lvalue_bitset<1>())
|
||||
, test::rvalue_const_bitset<1>()
|
||||
)
|
||||
);
|
||||
test::C::evaluate(
|
||||
test::g_parameters()(
|
||||
test::lvalue_const_bitset<0>()
|
||||
, boost::ref(test::lvalue_bitset<0>())
|
||||
, test::rvalue_const_bitset<0>()
|
||||
, boost::parameter::as_lvalue(test::rvalue_bitset<0>())
|
||||
, test::lvalue_const_bitset<1>()
|
||||
, boost::ref(test::lvalue_bitset<1>())
|
||||
, test::rvalue_const_bitset<1>()
|
||||
, test::lvalue_const_bitset<2>()
|
||||
, boost::ref(test::lvalue_bitset<2>())
|
||||
, boost::parameter::as_lvalue(test::rvalue_bitset<2>())
|
||||
)
|
||||
);
|
||||
#endif // perfect forwarding support, or exponential overloads
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(BOOST_PARAMETER_MAX_ARITY < 16)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 16 or greater.
|
||||
#endif
|
||||
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
namespace test {
|
||||
@@ -101,6 +108,7 @@ namespace test {
|
||||
]
|
||||
)
|
||||
);
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_rvalue_reference_to_const
|
||||
, U::evaluate_category<0>(args[test::_rrc0])
|
||||
@@ -145,6 +153,52 @@ namespace test {
|
||||
]
|
||||
)
|
||||
);
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<0>(args[test::_rrc0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<1>(args[test::_rrc1])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<2>(args[test::_rrc2])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<3>(args[test::_rrc3])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<4>(
|
||||
args[test::_rrc4 | test::rvalue_const_bitset<4>()]
|
||||
)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<5>(
|
||||
args[
|
||||
test::_rrc5 || test::rvalue_const_bitset_function<5>()
|
||||
]
|
||||
)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<6>(
|
||||
args[test::_rrc6 | test::rvalue_const_bitset<6>()]
|
||||
)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<7>(
|
||||
args[
|
||||
test::_rrc7 || test::rvalue_const_bitset_function<7>()
|
||||
]
|
||||
)
|
||||
);
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
}
|
||||
};
|
||||
} // namespace test
|
||||
|
||||
19
test/literate/extracting-parameter-types0.cpp
Normal file → Executable file
19
test/literate/extracting-parameter-types0.cpp
Normal file → Executable file
@@ -5,17 +5,36 @@ BOOST_PARAMETER_NAME(name)
|
||||
BOOST_PARAMETER_NAME(index)
|
||||
|
||||
template <typename T>
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
void noop(T&&)
|
||||
#else
|
||||
void noop(T&)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#include <utility>
|
||||
#endif
|
||||
|
||||
template <typename Name, typename Index>
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
int deduce_arg_types_impl(Name&& name, Index&& index)
|
||||
{
|
||||
noop(std::forward<Name>(name));
|
||||
noop(std::forward<Index>(index));
|
||||
return index;
|
||||
}
|
||||
#else
|
||||
int deduce_arg_types_impl(Name& name, Index& index)
|
||||
{
|
||||
Name& n2 = name; // we know the types
|
||||
Index& i2 = index;
|
||||
noop(n2);
|
||||
noop(i2);
|
||||
return index;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename ArgumentPack>
|
||||
int deduce_arg_types(ArgumentPack const& args)
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(BOOST_PARAMETER_MAX_ARITY < 10)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 10 or greater.
|
||||
#endif
|
||||
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
namespace test {
|
||||
@@ -10,7 +17,11 @@ namespace test {
|
||||
BOOST_PARAMETER_NAME(in(lrc0))
|
||||
BOOST_PARAMETER_NAME(out(lr0))
|
||||
BOOST_PARAMETER_NAME(in(rrc0))
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_PARAMETER_NAME(consume(rr0))
|
||||
#else
|
||||
BOOST_PARAMETER_NAME(rr0)
|
||||
#endif
|
||||
BOOST_PARAMETER_NAME(in(lrc1))
|
||||
BOOST_PARAMETER_NAME(out(lr1))
|
||||
BOOST_PARAMETER_NAME(in(rrc1))
|
||||
@@ -73,6 +84,7 @@ namespace test {
|
||||
p[test::_lr2 || test::lvalue_bitset_function<2>()]
|
||||
)
|
||||
);
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_rvalue_reference_to_const
|
||||
, U::evaluate_category<0>(p[test::_rrc0])
|
||||
@@ -91,14 +103,40 @@ namespace test {
|
||||
p[test::_rr2 || test::rvalue_bitset_function<2>()]
|
||||
)
|
||||
);
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<0>(p[test::_rrc0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<0>(p[test::_rr0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<1>(p[test::_rrc1])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<2>(
|
||||
p[test::_rr2 || test::rvalue_bitset_function<2>()]
|
||||
)
|
||||
);
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
} // namespace test
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#include <boost/core/ref.hpp>
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) || \
|
||||
(10 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
test::C::evaluate(
|
||||
test::lvalue_const_bitset<0>()
|
||||
, test::lvalue_bitset<0>()
|
||||
@@ -120,6 +158,29 @@ int main()
|
||||
, test::lvalue_bitset<2>()
|
||||
, test::rvalue_bitset<2>()
|
||||
);
|
||||
#else // no perfect forwarding support and no exponential overloads
|
||||
test::C::evaluate(
|
||||
test::lvalue_const_bitset<0>()
|
||||
, boost::ref(test::lvalue_bitset<0>())
|
||||
, test::rvalue_const_bitset<0>()
|
||||
, test::rvalue_bitset<0>()
|
||||
, test::lvalue_const_bitset<1>()
|
||||
, boost::ref(test::lvalue_bitset<1>())
|
||||
, test::rvalue_const_bitset<1>()
|
||||
);
|
||||
test::C::evaluate(
|
||||
test::lvalue_const_bitset<0>()
|
||||
, boost::ref(test::lvalue_bitset<0>())
|
||||
, test::rvalue_const_bitset<0>()
|
||||
, test::rvalue_bitset<0>()
|
||||
, test::lvalue_const_bitset<1>()
|
||||
, boost::ref(test::lvalue_bitset<1>())
|
||||
, test::rvalue_const_bitset<1>()
|
||||
, test::lvalue_const_bitset<2>()
|
||||
, boost::ref(test::lvalue_bitset<2>())
|
||||
, test::rvalue_bitset<2>()
|
||||
);
|
||||
#endif // perfect forwarding support, or exponential overloads
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
7
test/normalized_argument_types.cpp
Normal file → Executable file
7
test/normalized_argument_types.cpp
Normal file → Executable file
@@ -3,6 +3,13 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(BOOST_PARAMETER_MAX_ARITY < 2)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 2 or greater.
|
||||
#endif
|
||||
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
namespace test {
|
||||
|
||||
5
test/ntp.cpp
Normal file → Executable file
5
test/ntp.cpp
Normal file → Executable file
@@ -5,6 +5,11 @@
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(BOOST_PARAMETER_MAX_ARITY < 4)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 4 or greater.
|
||||
#endif
|
||||
|
||||
namespace test {
|
||||
|
||||
struct X
|
||||
|
||||
1
test/optional_deduced_sfinae.cpp
Normal file → Executable file
1
test/optional_deduced_sfinae.cpp
Normal file → Executable file
@@ -3,7 +3,6 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
#include <boost/parameter/preprocessor.hpp>
|
||||
#include <boost/parameter/name.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
22
test/preprocessor.cpp
Normal file → Executable file
22
test/preprocessor.cpp
Normal file → Executable file
@@ -155,10 +155,13 @@ namespace test {
|
||||
}
|
||||
} // namespace test
|
||||
|
||||
#include <string>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
#include <boost/tti/detail/dnullptr.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
namespace test {
|
||||
|
||||
@@ -170,6 +173,7 @@ namespace test {
|
||||
template <typename Args>
|
||||
explicit base_0(
|
||||
Args const& args
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
, typename boost::disable_if<
|
||||
typename boost::mpl::if_<
|
||||
boost::is_base_of<base_0,Args>
|
||||
@@ -177,6 +181,7 @@ namespace test {
|
||||
, boost::mpl::false_
|
||||
>::type
|
||||
>::type* = BOOST_TTI_DETAIL_NULLPTR
|
||||
#endif // BOOST_NO_SFINAE
|
||||
) : f(args[test::_value | 1.f]), i(args[test::_index | 2])
|
||||
{
|
||||
}
|
||||
@@ -197,6 +202,7 @@ namespace test {
|
||||
template <typename Args>
|
||||
explicit base_1(
|
||||
Args const& args
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
, typename boost::disable_if<
|
||||
typename boost::mpl::if_<
|
||||
boost::is_base_of<base_1,Args>
|
||||
@@ -204,6 +210,7 @@ namespace test {
|
||||
, boost::mpl::false_
|
||||
>::type
|
||||
>::type* = BOOST_TTI_DETAIL_NULLPTR
|
||||
#endif // BOOST_NO_SFINAE
|
||||
)
|
||||
{
|
||||
args[test::_tester](
|
||||
@@ -352,10 +359,12 @@ namespace test {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
// On compilers that actually support SFINAE, add another overload
|
||||
// that is an equally good match and can only be in the overload set
|
||||
// when the others are not. This tests that the SFINAE is actually
|
||||
// working.
|
||||
// working. On all other compilers we're just checking that everything
|
||||
// about SFINAE-enabled code will work, except of course the SFINAE.
|
||||
template <typename A0>
|
||||
typename boost::enable_if<
|
||||
typename boost::mpl::if_<
|
||||
@@ -369,6 +378,7 @@ namespace test {
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif // BOOST_NO_SFINAE
|
||||
|
||||
struct predicate
|
||||
{
|
||||
@@ -392,10 +402,12 @@ namespace test {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
// On compilers that actually support SFINAE, add another overload
|
||||
// that is an equally good match and can only be in the overload set
|
||||
// when the others are not. This tests that the SFINAE is actually
|
||||
// working.
|
||||
// working. On all other compilers we're just checking that everything
|
||||
// about SFINAE-enabled code will work, except of course the SFINAE.
|
||||
template <typename A0>
|
||||
typename boost::enable_if<
|
||||
typename boost::mpl::if_<
|
||||
@@ -409,6 +421,7 @@ namespace test {
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif // BOOST_NO_SFINAE
|
||||
|
||||
template <typename T>
|
||||
T const& as_lvalue(T const& x)
|
||||
@@ -550,7 +563,8 @@ int main()
|
||||
, test::_name = std::string("foo")
|
||||
);
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
|
||||
#if !defined(BOOST_NO_SFINAE) && \
|
||||
!BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
|
||||
BOOST_TEST(test::sfinae("foo") == 1);
|
||||
BOOST_TEST(test::sfinae(1) == 0);
|
||||
|
||||
|
||||
13
test/preprocessor_deduced.cpp
Normal file → Executable file
13
test/preprocessor_deduced.cpp
Normal file → Executable file
@@ -9,11 +9,14 @@
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <string>
|
||||
#include "basics.hpp"
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#endif
|
||||
|
||||
namespace test {
|
||||
|
||||
BOOST_PARAMETER_NAME(expected)
|
||||
@@ -184,10 +187,12 @@ namespace test {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
// On compilers that actually support SFINAE, add another overload
|
||||
// that is an equally good match and can only be in the overload set
|
||||
// when the others are not. This tests that the SFINAE is actually
|
||||
// working.
|
||||
// working. On all other compilers we're just checking that everything
|
||||
// about SFINAE-enabled code will work, except of course the SFINAE.
|
||||
template <typename A0>
|
||||
typename boost::enable_if<
|
||||
typename boost::mpl::if_<
|
||||
@@ -201,6 +206,7 @@ namespace test {
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif // BOOST_NO_SFINAE
|
||||
} // namespace test
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
@@ -279,8 +285,11 @@ int main()
|
||||
, 0
|
||||
, test::_y = std::string("foo")
|
||||
);
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
BOOST_TEST(test::sfinae("foo") == 1);
|
||||
BOOST_TEST(test::sfinae(0) == 0);
|
||||
#endif
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(BOOST_PARAMETER_MAX_ARITY < 8)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 8 or greater.
|
||||
#endif
|
||||
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
namespace test {
|
||||
@@ -10,7 +17,11 @@ namespace test {
|
||||
BOOST_PARAMETER_NAME((_lrc0, kw) in(lrc0))
|
||||
BOOST_PARAMETER_NAME((_lr0, kw) in_out(lr0))
|
||||
BOOST_PARAMETER_NAME((_rrc0, kw) in(rrc0))
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_PARAMETER_NAME((_rr0, kw) consume(rr0))
|
||||
#else
|
||||
BOOST_PARAMETER_NAME((_rr0, kw) rr0)
|
||||
#endif
|
||||
BOOST_PARAMETER_NAME((_lrc1, kw) in(lrc1))
|
||||
BOOST_PARAMETER_NAME((_lr1, kw) out(lr1))
|
||||
BOOST_PARAMETER_NAME((_rrc1, kw) in(rrc1))
|
||||
@@ -22,9 +33,12 @@ namespace test {
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <utility>
|
||||
#include "evaluate_category.hpp"
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#include <utility>
|
||||
#endif
|
||||
|
||||
namespace test {
|
||||
|
||||
struct C
|
||||
@@ -103,6 +117,7 @@ namespace test {
|
||||
passed_by_lvalue_reference
|
||||
, U::evaluate_category<5>(lr1)
|
||||
);
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_rvalue_reference_to_const
|
||||
, U::evaluate_category<2>(std::forward<rrc0_type>(rrc0))
|
||||
@@ -119,6 +134,24 @@ namespace test {
|
||||
passed_by_rvalue_reference
|
||||
, U::evaluate_category<7>(std::forward<rr1_type>(rr1))
|
||||
);
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<2>(rrc0)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<3>(rr0)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<6>(rrc1)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<7>(rr1)
|
||||
);
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,18 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if (BOOST_PARAMETER_MAX_ARITY < 4)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 4 or greater.
|
||||
#endif
|
||||
#if (BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < 5)
|
||||
#error Define BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY \
|
||||
as 5 or greater.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
namespace test {
|
||||
@@ -10,16 +22,23 @@ namespace test {
|
||||
BOOST_PARAMETER_NAME((_lrc0, kw) in(lrc0))
|
||||
BOOST_PARAMETER_NAME((_lr0, kw) in_out(lr0))
|
||||
BOOST_PARAMETER_NAME((_rrc0, kw) in(rrc0))
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_PARAMETER_NAME((_rr0, kw) consume(rr0))
|
||||
#else
|
||||
BOOST_PARAMETER_NAME((_rr0, kw) rr0)
|
||||
#endif
|
||||
} // namespace test
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/type_traits/is_scalar.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <utility>
|
||||
#include "evaluate_category.hpp"
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#include <utility>
|
||||
#endif
|
||||
|
||||
namespace test {
|
||||
|
||||
BOOST_PARAMETER_FUNCTION((bool), evaluate, kw,
|
||||
@@ -68,6 +87,7 @@ namespace test {
|
||||
>::evaluate_category(lr0)
|
||||
);
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
if (
|
||||
boost::is_scalar<
|
||||
typename boost::remove_const<
|
||||
@@ -152,6 +172,44 @@ namespace test {
|
||||
>::evaluate_category(std::forward<rr0_type>(rr0))
|
||||
);
|
||||
}
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST((
|
||||
test::passed_by_lvalue_reference_to_const == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw::rrc0
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(args[test::_rrc0])
|
||||
));
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::remove_reference<rrc0_type>::type
|
||||
>::type
|
||||
>::evaluate_category(rrc0)
|
||||
);
|
||||
BOOST_TEST((
|
||||
test::passed_by_lvalue_reference_to_const == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw::rr0
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(args[test::_rr0])
|
||||
));
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::remove_reference<rr0_type>::type
|
||||
>::type
|
||||
>::evaluate_category(rr0)
|
||||
);
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -159,9 +217,12 @@ namespace test {
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
#include <boost/tti/detail/dnullptr.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
#endif
|
||||
|
||||
namespace test {
|
||||
|
||||
@@ -179,6 +240,7 @@ namespace test {
|
||||
template <typename Args>
|
||||
explicit B(
|
||||
Args const& args
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
, typename boost::disable_if<
|
||||
typename boost::mpl::if_<
|
||||
boost::is_base_of<B,Args>
|
||||
@@ -186,6 +248,7 @@ namespace test {
|
||||
, boost::mpl::false_
|
||||
>::type
|
||||
>::type* = BOOST_TTI_DETAIL_NULLPTR
|
||||
#endif // BOOST_NO_SFINAE
|
||||
)
|
||||
{
|
||||
test::evaluate(
|
||||
@@ -283,6 +346,8 @@ namespace test {
|
||||
>::type
|
||||
>::evaluate_category(rrc0)
|
||||
);
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST((
|
||||
test::passed_by_rvalue_reference == test::A<
|
||||
typename boost::remove_const<
|
||||
@@ -301,6 +366,26 @@ namespace test {
|
||||
>::type
|
||||
>::evaluate_category(std::forward<rr0_type>(rr0))
|
||||
);
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST((
|
||||
test::passed_by_lvalue_reference_to_const == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw::rr0
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(args[test::_rr0])
|
||||
));
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::remove_reference<rr0_type>::type
|
||||
>::type
|
||||
>::evaluate_category(rr0)
|
||||
);
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -412,13 +497,23 @@ int main()
|
||||
test::evaluate(
|
||||
"q2x"
|
||||
, baz_arr
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
, static_cast<char_arr const&&>("mos")
|
||||
, static_cast<char_arr&&>(baz_arr)
|
||||
#else
|
||||
, "crg"
|
||||
, "uir"
|
||||
#endif
|
||||
);
|
||||
test::evaluate(
|
||||
test::_lr0 = baz_arr
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
, test::_rrc0 = static_cast<char_arr const&&>("def")
|
||||
, test::_rr0 = static_cast<char_arr&&>(baz_arr)
|
||||
#else
|
||||
, test::_rrc0 = "grl"
|
||||
, test::_rr0 = "grp"
|
||||
#endif
|
||||
, test::_lrc0 = "wld"
|
||||
);
|
||||
#endif // MSVC
|
||||
@@ -437,13 +532,23 @@ int main()
|
||||
test::C cp0(
|
||||
"frd"
|
||||
, baz_arr
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
, static_cast<char_arr const&&>("dfs")
|
||||
, static_cast<char_arr&&>(baz_arr)
|
||||
#else
|
||||
, "plg"
|
||||
, "thd"
|
||||
#endif
|
||||
);
|
||||
test::C cp1(
|
||||
test::_lr0 = baz_arr
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
, test::_rrc0 = static_cast<char_arr const&&>("dgx")
|
||||
, test::_rr0 = static_cast<char_arr&&>(baz_arr)
|
||||
#else
|
||||
, test::_rrc0 = "hnk"
|
||||
, test::_rr0 = "xzz"
|
||||
#endif
|
||||
, test::_lrc0 = "zts"
|
||||
);
|
||||
#endif // MSVC
|
||||
|
||||
19
test/sfinae.cpp
Normal file → Executable file
19
test/sfinae.cpp
Normal file → Executable file
@@ -3,6 +3,13 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(BOOST_PARAMETER_MAX_ARITY < 2)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 2 or greater.
|
||||
#endif
|
||||
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
namespace test {
|
||||
@@ -102,7 +109,8 @@ namespace test {
|
||||
}
|
||||
} // namespace test
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
|
||||
#if !defined(BOOST_NO_SFINAE) && \
|
||||
!BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
|
||||
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
@@ -111,7 +119,9 @@ namespace test {
|
||||
|
||||
// On compilers that actually support SFINAE, add another overload that is
|
||||
// an equally good match and can only be in the overload set when the
|
||||
// others are not. This tests that the SFINAE is actually working.
|
||||
// others are not. This tests that the SFINAE is actually working. On
|
||||
// all other compilers we're just checking that everything about
|
||||
// SFINAE-enabled code will work, except of course the SFINAE.
|
||||
template <typename A0, typename A1>
|
||||
typename boost::enable_if<
|
||||
typename boost::mpl::if_<
|
||||
@@ -127,14 +137,15 @@ namespace test {
|
||||
}
|
||||
} // namespace test
|
||||
|
||||
#endif // no Borland workarounds needed.
|
||||
#endif // SFINAE enabled, no Borland workarounds needed.
|
||||
|
||||
int main()
|
||||
{
|
||||
test::f("foo");
|
||||
test::f("foo", 3.f);
|
||||
test::f(test::value = 3.f, test::name = "foo");
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
|
||||
#if !defined(BOOST_NO_SFINAE) && \
|
||||
!BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
|
||||
BOOST_TEST_EQ(0, test::f(3, 4));
|
||||
#endif
|
||||
return boost::report_errors();
|
||||
|
||||
Reference in New Issue
Block a user