Compare commits

..

1 Commits

Author SHA1 Message Date
Ronald Garcia
7981ef509c Created a branch from trunk
[SVN r38959]
2007-08-26 05:34:35 +00:00
186 changed files with 12258 additions and 46487 deletions

View File

@@ -1,286 +0,0 @@
# Copyright 2016 Edward Diener
# Copyright 2017 Cromwell D. Enage
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://boost.org/LICENSE_1_0.txt)
dist: xenial
language: cpp
python: "2.7"
branches:
only:
- master
- develop
- /feature\/.*/
env:
matrix:
- BOGUS_JOB=true
matrix:
exclude:
- env: BOGUS_JOB=true
include:
- os: linux
compiler: g++-4.4
env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98,0x
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
addons:
apt:
packages:
- g++-4.6
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11
addons:
apt:
packages:
- g++-4.7
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11
addons:
apt:
packages:
- g++-4.8
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11
addons:
apt:
packages:
- g++-4.9
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z CXXSTD_DIALECT=cxxstd-dialect=gnu
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17 CXXSTD_DIALECT=cxxstd-dialect=gnu
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-8
env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17
addons:
apt:
packages:
- g++-8
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11
addons:
apt:
packages:
- clang-3.5
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.5
- os: linux
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11
addons:
apt:
packages:
- clang-3.6
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
- os: linux
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11
addons:
apt:
packages:
- clang-3.7
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
- os: linux
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-3.8
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
- os: linux
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-3.9
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- os: linux
compiler: clang++-4.0
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-4.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-4.0
- os: linux
compiler: clang++-5.0
env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-5.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-5.0
- os: linux
compiler: clang++-6.0
env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,1z,2a
addons:
apt:
packages:
- clang-6.0
- libc6-dbg
- libc++-dev
- libstdc++-8-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-6.0
- os: linux
compiler: clang++-7
env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=14,1z,2a
addons:
apt:
packages:
- clang-7
- libc6-dbg
- libc++-dev
- libstdc++-8-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-7
- os: linux
compiler: clang++-8
env: TOOLSET=clang COMPILER=clang++-8 CXXSTD=14,1z,2a
addons:
apt:
packages:
- clang-8
- libc6-dbg
- libc++-dev
- libstdc++-8-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-8
- os: osx
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
osx_image: xcode7.3
- os: osx
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
osx_image: xcode8.3
- os: osx
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
osx_image: xcode9.4.1
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- cd ..
- git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
- git submodule update --init libs/parameter_python
- git submodule update --init tools/boost_install
- git submodule update --init libs/headers
- cp -r $TRAVIS_BUILD_DIR/* libs/parameter
- python tools/boostdep/depinst/depinst.py parameter
- ./bootstrap.sh
- ./b2 headers
script:
- |-
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
- ./b2 --verbose-test libs/config/test//config_info toolset=$TOOLSET cxxstd=$CXXSTD || true
- cd libs/parameter/test
- ../../../b2 -j`(nproc || sysctl -n hw.ncpu) 2> /dev/null` toolset=$TOOLSET cxxstd=$CXXSTD $CXXSTD_DIALECT
- cd ../../..
notifications:
email:
on_success: always

View File

@@ -1,36 +0,0 @@
# Copyright 2019 Mike Dev
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
#
# NOTE: CMake support for Boost.Parameter is currently experimental at best
# and the interface is likely to change in the future
cmake_minimum_required( VERSION 3.5 )
project( BoostParameter LANGUAGES CXX)
option(BOOST_PARAMETER_INCLUDE_TESTS OFF "Include Boost.Parameter tests")
add_library( boost_parameter INTERFACE )
add_library( Boost::parameter ALIAS boost_parameter )
target_include_directories( boost_parameter INTERFACE include )
target_link_libraries( boost_parameter
INTERFACE
Boost::config
Boost::core
Boost::function
Boost::fusion
# TODO: we only need mp11 or mpl
Boost::mp11
Boost::mpl
Boost::optional
Boost::preprocessor
Boost::type_traits
Boost::utility
)
if(BOOST_PARAMETER_INCLUDE_TESTS)
enable_testing()
add_subdirectory(test)
endif()

View File

@@ -1,69 +0,0 @@
# Copyright 2017 Edward Diener
# Copyright 2017 Cromwell D. Enage
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://boost.org/LICENSE_1_0.txt)
version: 1.0.{build}-{branch}
shallow_clone: true
branches:
only:
- master
- develop
environment:
matrix:
- ARGS: --toolset=gcc address-model=32
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
PATH: C:\MinGW\bin;%PATH%
- ARGS: --toolset=gcc address-model=64
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
PATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;%PATH%
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ARGS: --toolset=msvc-9.0 address-model=32
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ARGS: --toolset=msvc-10.0 address-model=32
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ARGS: --toolset=msvc-11.0 address-model=32
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ARGS: --toolset=msvc-12.0 address-model=32
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ARGS: --toolset=msvc-12.0 address-model=64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ARGS: --toolset=msvc-14.0 address-model=32
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ARGS: --toolset=msvc-14.0 address-model=64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ARGS: --toolset=msvc-14.0 address-model=64 cxxflags=-std:c++latest
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
ARGS: --toolset=msvc-14.1 address-model=32
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
ARGS: --toolset=msvc-14.1 address-model=64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
ARGS: --toolset=msvc-14.1 address-model=64 cxxflags=-std:c++latest
install:
- cd ..
- git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
- git submodule update --init libs/parameter_python
- git submodule update --init tools/boost_install
- git submodule update --init libs/headers
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\parameter
- python tools/boostdep/depinst/depinst.py parameter
- bootstrap
- b2 headers
build: off
test_script:
- cd libs\parameter\test
- ..\..\..\b2 -j%NUMBER_OF_PROCESSORS% --hash %ARGS%
- cd ..\..\..

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

@@ -1,12 +1,12 @@
# Copyright David Abrahams 2006. Distributed under the Boost
# Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
import docutils ;
sources = [ glob *.rst ] ;
import path ;
sources = [ path.glob . : *.rst ] ;
bases = $(sources:S=) ;
# This is a path relative to the html/ subdirectory where the
# generated output will eventually be moved.
stylesheet = "--stylesheet=rst.css" ;
@@ -22,9 +22,3 @@ for local b in $(bases)
alias htmls : $(bases) ;
stage html : $(bases) ;
###############################################################################
alias boostdoc ;
explicit boostdoc ;
alias boostrelease : html ;
explicit boostrelease ;

2996
doc/html/index.html Normal file → Executable file

File diff suppressed because it is too large Load Diff

787
doc/html/python.html Normal file
View File

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

7596
doc/html/reference.html Normal file → Executable file

File diff suppressed because it is too large Load Diff

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

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

Before

Width:  |  Height:  |  Size: 62 B

After

Width:  |  Height:  |  Size: 62 B

3518
doc/index.rst Normal file → Executable file

File diff suppressed because it is too large Load Diff

778
doc/python.rst Executable file
View File

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

7351
doc/reference.rst Normal file → Executable file

File diff suppressed because it is too large Load Diff

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

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

View File

@@ -1,125 +0,0 @@
// Copyright Cromwell D. Enage 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_HPP
#define BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_HPP
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
namespace boost { namespace parameter {
template <typename TaggedArg0, typename ...TaggedArgs>
struct are_tagged_arguments;
}} // namespace boost::parameter
#include <boost/parameter/aux_/is_tagged_argument.hpp>
namespace boost { namespace parameter {
template <typename TaggedArg0>
struct are_tagged_arguments<TaggedArg0>
: ::boost::parameter::aux::is_tagged_argument<TaggedArg0>
{
};
}} // namespace boost::parameter
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
namespace boost { namespace parameter {
template <typename TaggedArg0, typename ...TaggedArgs>
struct are_tagged_arguments
: ::boost::mpl::if_<
::boost::parameter::aux::is_tagged_argument<TaggedArg0>
, ::boost::parameter::are_tagged_arguments<TaggedArgs...>
, ::boost::mpl::false_
>::type
{
};
}} // namespace boost::parameter
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#define BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_END_Z(z, n, false_t) , false_t>
/**/
#include <boost/parameter/aux_/is_tagged_argument.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/preprocessor/cat.hpp>
#define BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_BEGIN_Z(z, n, prefix) \
::boost::mpl::eval_if< \
::boost::parameter::aux::is_tagged_argument<BOOST_PP_CAT(prefix, n)>,
/**/
#include <boost/parameter/aux_/void.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/preprocessor/arithmetic/sub.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
#define BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_OVERLOADS_Z(z, n, prefix) \
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename prefix)> \
struct are_tagged_arguments< \
BOOST_PP_ENUM_PARAMS_Z(z, n, prefix) \
BOOST_PP_ENUM_TRAILING_PARAMS_Z( \
z \
, BOOST_PP_SUB(BOOST_PARAMETER_COMPOSE_MAX_ARITY, n) \
, ::boost::parameter::void_ BOOST_PP_INTERCEPT \
) \
> : BOOST_PP_CAT(BOOST_PP_REPEAT_, z)( \
n \
, BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_BEGIN_Z \
, prefix \
) \
::boost::mpl::true_ \
BOOST_PP_CAT(BOOST_PP_REPEAT_, z)( \
n \
, BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_END_Z \
, ::boost::mpl::false_ \
)::type \
{ \
};
/**/
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
namespace boost { namespace parameter {
template <
BOOST_PP_ENUM_BINARY_PARAMS(
BOOST_PP_INC(BOOST_PARAMETER_COMPOSE_MAX_ARITY)
, typename TaggedArg
, = ::boost::parameter::void_ BOOST_PP_INTERCEPT
)
>
struct are_tagged_arguments;
}} // namespace boost::parameter
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
namespace boost { namespace parameter {
BOOST_PP_REPEAT_FROM_TO(
1
, BOOST_PP_INC(BOOST_PARAMETER_COMPOSE_MAX_ARITY)
, BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_OVERLOADS_Z
, TaggedArg
)
}} // namespace boost::parameter
#undef BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_OVERLOADS_Z
#undef BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_BEGIN_Z
#undef BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_END_Z
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
#endif // include guard

View File

@@ -1,42 +0,0 @@
// Copyright Cromwell D. Enage 2019.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_ALWAYS_TRUE_PREDICATE_HPP
#define BOOST_PARAMETER_AUX_ALWAYS_TRUE_PREDICATE_HPP
#include <boost/parameter/config.hpp>
#include <boost/mpl/bool.hpp>
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#endif
#else
#include <boost/mpl/always.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
struct always_true_predicate
{
template <typename ...>
struct apply
{
typedef ::boost::mpl::true_ type;
};
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <typename ...>
using fn = ::boost::mp11::mp_true;
#endif
};
#else
typedef ::boost::mpl::always< ::boost::mpl::true_> always_true_predicate;
#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES
}}} // namespace boost::parameter::aux
#endif // include guard

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,25 +0,0 @@
// Copyright Daniel Wallin 2006.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_AS_LVALUE_HPP
#define BOOST_PARAMETER_AUX_AS_LVALUE_HPP
namespace boost { namespace parameter { namespace aux {
template <typename T>
T const& as_lvalue(T const& value)
{
return value;
}
template <typename T>
T& as_lvalue(T& value)
{
return value;
}
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -1,198 +0,0 @@
// Copyright Cromwell D. Enage 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUGMENT_PREDICATE_HPP
#define BOOST_PARAMETER_AUGMENT_PREDICATE_HPP
#include <boost/parameter/keyword_fwd.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/type_traits/is_lvalue_reference.hpp>
#include <boost/type_traits/is_scalar.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename V, typename R, typename Tag>
struct augment_predicate_check_consume_ref
: ::boost::mpl::eval_if<
::boost::is_scalar<V>
, ::boost::mpl::true_
, ::boost::mpl::eval_if<
::boost::is_same<
typename Tag::qualifier
, ::boost::parameter::consume_reference
>
, ::boost::mpl::if_<
::boost::is_lvalue_reference<R>
, ::boost::mpl::false_
, ::boost::mpl::true_
>
, boost::mpl::true_
>
>::type
{
};
}}} // namespace boost::parameter::aux
#include <boost/type_traits/is_const.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename V, typename R, typename Tag>
struct augment_predicate_check_out_ref
: ::boost::mpl::eval_if<
::boost::is_same<
typename Tag::qualifier
, ::boost::parameter::out_reference
>
, ::boost::mpl::eval_if<
::boost::is_lvalue_reference<R>
, ::boost::mpl::if_<
::boost::is_const<V>
, ::boost::mpl::false_
, ::boost::mpl::true_
>
, ::boost::mpl::false_
>
, ::boost::mpl::true_
>::type
{
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/lambda_tag.hpp>
#include <boost/mpl/apply_wrap.hpp>
#include <boost/mpl/lambda.hpp>
namespace boost { namespace parameter { namespace aux {
template <
typename Predicate
, typename R
, typename Tag
, typename T
, typename Args
>
class augment_predicate
{
typedef typename ::boost::mpl::lambda<
Predicate
, ::boost::parameter::aux::lambda_tag
>::type _actual_predicate;
public:
typedef typename ::boost::mpl::eval_if<
typename ::boost::mpl::if_<
::boost::parameter::aux
::augment_predicate_check_consume_ref<T,R,Tag>
, ::boost::parameter::aux
::augment_predicate_check_out_ref<T,R,Tag>
, ::boost::mpl::false_
>::type
, ::boost::mpl::apply_wrap2<_actual_predicate,T,Args>
, ::boost::mpl::false_
>::type type;
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#include <boost/mp11/utility.hpp>
#include <type_traits>
namespace boost { namespace parameter { namespace aux {
template <typename V, typename R, typename Tag>
using augment_predicate_check_consume_ref_mp11 = ::boost::mp11::mp_if<
::std::is_scalar<V>
, ::boost::mp11::mp_true
, ::boost::mp11::mp_if<
::std::is_same<
typename Tag::qualifier
, ::boost::parameter::consume_reference
>
, ::boost::mp11::mp_if<
::std::is_lvalue_reference<R>
, ::boost::mp11::mp_false
, ::boost::mp11::mp_true
>
, boost::mp11::mp_true
>
>;
template <typename V, typename R, typename Tag>
using augment_predicate_check_out_ref_mp11 = ::boost::mp11::mp_if<
::std::is_same<
typename Tag::qualifier
, ::boost::parameter::out_reference
>
, ::boost::mp11::mp_if<
::std::is_lvalue_reference<R>
, ::boost::mp11::mp_if<
::std::is_const<V>
, ::boost::mp11::mp_false
, ::boost::mp11::mp_true
>
, ::boost::mp11::mp_false
>
, ::boost::mp11::mp_true
>;
}}} // namespace boost::parameter::aux
#include <boost/mp11/list.hpp>
namespace boost { namespace parameter { namespace aux {
template <
typename Predicate
, typename R
, typename Tag
, typename T
, typename Args
>
struct augment_predicate_mp11_impl
{
using type = ::boost::mp11::mp_if<
::boost::mp11::mp_if<
::boost::parameter::aux
::augment_predicate_check_consume_ref_mp11<T,R,Tag>
, ::boost::parameter::aux
::augment_predicate_check_out_ref_mp11<T,R,Tag>
, ::boost::mp11::mp_false
>
, ::boost::mp11
::mp_apply_q<Predicate,::boost::mp11::mp_list<T,Args> >
, ::boost::mp11::mp_false
>;
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/has_nested_template_fn.hpp>
namespace boost { namespace parameter { namespace aux {
template <
typename Predicate
, typename R
, typename Tag
, typename T
, typename Args
>
using augment_predicate_mp11 = ::boost::mp11::mp_if<
::boost::parameter::aux::has_nested_template_fn<Predicate>
, ::boost::parameter::aux
::augment_predicate_mp11_impl<Predicate,R,Tag,T,Args>
, ::boost::parameter::aux
::augment_predicate<Predicate,R,Tag,T,Args>
>;
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_CAN_USE_MP11
#endif // include guard

131
include/boost/parameter/aux_/cast.hpp Normal file → Executable file
View File

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

141
include/boost/parameter/aux_/default.hpp Normal file → Executable file
View File

@@ -1,100 +1,67 @@
// Copyright Daniel Wallin, David Abrahams 2005.
// Copyright Cromwell D. Enage 2017.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// Copyright Daniel Wallin, David Abrahams 2005. Use, modification and
// distribution is subject to the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_DEFAULT_HPP
#define BOOST_PARAMETER_AUX_DEFAULT_HPP
#ifndef DEFAULT_050329_HPP
#define DEFAULT_050329_HPP
namespace boost { namespace parameter { namespace aux {
// A wrapper for the default value passed by the user when resolving
// the value of the parameter with the given Keyword
template <typename Keyword, typename Value>
struct default_
{
inline BOOST_CONSTEXPR default_(Value& x) : value(x)
{
}
// A wrapper for the default value passed by the user when resolving
// the value of the parameter with the given Keyword
template <class Keyword, class Value>
struct default_
{
default_(Value& x)
: value(x)
{}
Value& value;
};
}}} // namespace boost::parameter::aux
Value& value;
};
#include <boost/parameter/config.hpp>
namespace boost { namespace parameter { namespace aux {
// lazy_default -- A wrapper for the default value computation function
// passed by the user when resolving the value of the parameter with the
// given keyword.
//
// lazy_default --
//
// A wrapper for the default value computation function passed by
// the user when resolving the value of the parameter with the
// given keyword
//
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
// These compilers need a little extra help with overload resolution;
// we have empty_arg_list's operator[] accept a base class
// to make that overload less preferable.
template <typename KW, typename DefaultComputer>
struct lazy_default_base
{
inline BOOST_CONSTEXPR lazy_default_base(DefaultComputer& x)
: compute_default(x)
{
}
// These compilers need a little extra help with overload
// resolution; we have empty_arg_list's operator[] accept a base
// class to make that overload less preferable.
template <class KW, class DefaultComputer>
struct lazy_default_base
{
lazy_default_base(DefaultComputer const& x)
: compute_default(x)
{}
DefaultComputer const& compute_default;
};
DefaultComputer& compute_default;
};
template <class KW, class DefaultComputer>
struct lazy_default
: lazy_default_base<KW,DefaultComputer>
{
lazy_default(DefaultComputer const & x)
: lazy_default_base<KW,DefaultComputer>(x)
{}
};
# define BOOST_PARAMETER_lazy_default_fallback lazy_default_base
#else
template <class KW, class DefaultComputer>
struct lazy_default
{
lazy_default(const DefaultComputer& x)
: compute_default(x)
{}
DefaultComputer const& compute_default;
};
# define BOOST_PARAMETER_lazy_default_fallback lazy_default
#endif
template <typename KW, typename DefaultComputer>
struct lazy_default
: ::boost::parameter::aux::lazy_default_base<KW,DefaultComputer>
{
inline BOOST_CONSTEXPR lazy_default(DefaultComputer& x)
: ::boost::parameter::aux::lazy_default_base<KW,DefaultComputer>(x)
{
}
};
#else // !BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
template <typename KW, typename DefaultComputer>
struct lazy_default
{
inline BOOST_CONSTEXPR lazy_default(DefaultComputer& x)
: compute_default(x)
{
}
DefaultComputer& compute_default;
};
#endif // EDG workarounds needed.
}}} // namespace boost::parameter::aux
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
#define BOOST_PARAMETER_lazy_default_fallback \
::boost::parameter::aux::lazy_default_base
/**/
#else
#define BOOST_PARAMETER_lazy_default_fallback \
::boost::parameter::aux::lazy_default
/**/
#endif
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#include <utility>
namespace boost { namespace parameter { namespace aux {
template <typename Keyword, typename Value>
struct default_r_
{
inline BOOST_CONSTEXPR default_r_(Value&& x)
: value(::std::forward<Value>(x))
{
}
Value&& value;
};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
#endif // include guard
#endif // DEFAULT_050329_HPP

View File

@@ -1,111 +0,0 @@
// Copyright Cromwell D. Enage 2019.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_HAS_NESTED_TEMPLATE_FN_HPP
#define BOOST_PARAMETER_AUX_HAS_NESTED_TEMPLATE_FN_HPP
#include <boost/parameter/aux_/yesno.hpp>
#include <boost/parameter/aux_/preprocessor/nullptr.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#include <boost/mp11/utility.hpp>
#else
#include <boost/mpl/bool.hpp>
#include <boost/mpl/identity.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <template <typename ...> class F>
struct has_nested_template_fn_variadic
{
};
#else
template <template <typename P0, typename P1> class F>
struct has_nested_template_fn_arity_2
{
};
#endif
template <typename T>
class has_nested_template_fn_impl
{
template <typename U>
static ::boost::parameter::aux::no_tag _check(...);
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <typename U>
static ::boost::parameter::aux::yes_tag
_check(
::boost::mp11::mp_identity<U> const volatile*
, ::boost::parameter::aux::has_nested_template_fn_variadic<
U::template fn
>* = BOOST_PARAMETER_AUX_PP_NULLPTR
);
#else
template <typename U>
static BOOST_CONSTEXPR ::boost::parameter::aux::yes_tag
_check(
::boost::mpl::identity<U> const volatile*
, ::boost::parameter::aux::has_nested_template_fn_arity_2<
U::template fn
>* = BOOST_PARAMETER_AUX_PP_NULLPTR
);
#endif
public:
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using type = ::boost::mp11::mp_bool<
#else
typedef ::boost::mpl::bool_<
#endif
sizeof(
::boost::parameter::aux::has_nested_template_fn_impl<T>
::template _check<T>(
static_cast<
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
::boost::mp11::mp_identity<T> const volatile*
#else
::boost::mpl::identity<T> const volatile*
#endif
>(BOOST_PARAMETER_AUX_PP_NULLPTR)
)
) == sizeof(::boost::parameter::aux::yes_tag)
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
>;
#else
> type;
#endif
};
}}} // namespace boost::parameter::aux
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <type_traits>
#else
#include <boost/type_traits/remove_const.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename T>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using has_nested_template_fn = typename ::boost::parameter::aux
::has_nested_template_fn_impl<typename ::std::remove_const<T>::type>
::type;
#else
struct has_nested_template_fn
: ::boost::parameter::aux::has_nested_template_fn_impl<
typename ::boost::remove_const<T>::type
>::type
{
};
#endif
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -1,52 +0,0 @@
// Copyright Daniel Wallin, David Abrahams 2010.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_IS_MAYBE_050329_HPP
#define BOOST_PARAMETER_IS_MAYBE_050329_HPP
namespace boost { namespace parameter { namespace aux {
struct maybe_base
{
};
}}} // namespace boost::parameter::aux
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <type_traits>
namespace boost { namespace parameter { namespace aux {
template <typename T>
using is_maybe = ::std::is_base_of<
::boost::parameter::aux::maybe_base
, typename ::std::remove_const<T>::type
>;
}}} // namespace boost::parameter::aux
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct is_maybe
: ::boost::mpl::if_<
::boost::is_base_of<
::boost::parameter::aux::maybe_base
, typename ::boost::remove_const<T>::type
>
, ::boost::mpl::true_
, ::boost::mpl::false_
>::type
{
};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_CAN_USE_MP11
#endif // include guard

View File

@@ -1,64 +0,0 @@
// Copyright Cromwell D. Enage 2019.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_IS_PLACEHOLDER_HPP
#define BOOST_PARAMETER_AUX_IS_PLACEHOLDER_HPP
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#else
#include <boost/mpl/bool.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct is_mpl_placeholder
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
: ::boost::mp11::mp_false
#else
: ::boost::mpl::false_
#endif
{
};
}}} // namespace boost::parameter::aux
#include <boost/mpl/arg_fwd.hpp>
namespace boost { namespace parameter { namespace aux {
template <int I>
struct is_mpl_placeholder< ::boost::mpl::arg<I> >
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
: ::boost::mp11::mp_true
#else
: ::boost::mpl::true_
#endif
{
};
}}} // namespace boost::parameter::aux
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/bind.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct is_mp11_placeholder : ::boost::mp11::mp_false
{
};
template < ::std::size_t I>
struct is_mp11_placeholder< ::boost::mp11::mp_arg<I> >
: ::boost::mp11::mp_true
{
};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_CAN_USE_MP11
#endif // include guard

View File

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

View File

@@ -1,16 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_LAMBDA_TAG_HPP
#define BOOST_PARAMETER_AUX_LAMBDA_TAG_HPP
namespace boost { namespace parameter { namespace aux {
// Tag type passed to MPL lambda.
struct lambda_tag;
}}} // namespace boost::parameter::aux
#endif // include guard

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

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

View File

@@ -1,93 +0,0 @@
// Copyright Daniel Wallin 2006.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_NAME_HPP
#define BOOST_PARAMETER_AUX_NAME_HPP
namespace boost { namespace parameter { namespace aux {
struct name_tag_base
{
};
template <typename Tag>
struct name_tag
{
};
}}} // namespace boost::parameter::aux
#include <boost/mpl/bool.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct is_name_tag : ::boost::mpl::false_
{
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/value_type.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#if !defined(BOOST_NO_SFINAE) && \
!BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x592))
#include <boost/parameter/aux_/lambda_tag.hpp>
#include <boost/mpl/lambda.hpp>
#include <boost/mpl/bind.hpp>
#include <boost/mpl/quote.hpp>
#include <boost/core/enable_if.hpp>
namespace boost { namespace mpl {
template <typename T>
struct lambda<
T
, typename ::boost::enable_if<
::boost::parameter::aux::is_name_tag<T>
, ::boost::parameter::aux::lambda_tag
>::type
>
{
typedef ::boost::mpl::true_ is_le;
typedef ::boost::mpl::bind3<
::boost::mpl::quote3< ::boost::parameter::value_type>
, ::boost::mpl::arg<2>
, T
, void
> result_;
typedef result_ type;
};
}} // namespace boost::mpl
#endif // SFINAE enabled, not Borland.
#include <boost/parameter/aux_/void.hpp>
#define BOOST_PARAMETER_TAG_PLACEHOLDER_TYPE(tag) \
::boost::parameter::value_type< \
::boost::mpl::_2,tag,::boost::parameter::void_ \
>
/**/
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#define BOOST_PARAMETER_TAG_MP11_PLACEHOLDER_VALUE(name, tag) \
template <typename ArgumentPack> \
using name = typename ::boost::parameter \
::value_type<ArgumentPack,tag,::boost::parameter::void_>::type
/**/
#include <boost/parameter/binding.hpp>
#define BOOST_PARAMETER_TAG_MP11_PLACEHOLDER_BINDING(name, tag) \
template <typename ArgumentPack> \
using name = typename ::boost::parameter \
::binding<ArgumentPack,tag,::boost::parameter::void_>::type
/**/
#endif // BOOST_PARAMETER_CAN_USE_MP11
#endif // include guard

View File

@@ -0,0 +1,88 @@
// Copyright David Abrahams, Daniel Wallin 2003. Use, modification and
// distribution is subject to the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// This file generates overloads in this format:
//
// template<class A0, class A1>
// typename mpl::apply_wrap1<
// aux::make_arg_list<
// PS0,A0
// , aux::make_arg_list<
// PS1,A1
// , mpl::identity<aux::empty_arg_list>
// >
// >
// , unnamed_list
// >::type
// operator()(A0 const& a0, A1 const& a1) const
// {
// typedef typename mpl::apply_wrap1<
// aux::make_arg_list<
// PS0,A0
// , aux::make_arg_list<
// PS1,A1
// , mpl::identity<aux::empty_arg_list>
// >
// >
// >::type arg_tuple;
//
// return arg_tuple(
// a0
// , a1
// , aux::void_()
// ...
// );
// }
//
#if !defined(BOOST_PP_IS_ITERATING)
# error Boost.Parameters - do not include this file!
#endif
#define N BOOST_PP_ITERATION()
#define BOOST_PARAMETER_open_list(z, n, text) \
aux::item< \
BOOST_PP_CAT(PS, n), BOOST_PP_CAT(A, n)
#define BOOST_PARAMETER_close_list(z, n, text) >
#define BOOST_PARAMETER_arg_list(n) \
aux::make_arg_list< \
BOOST_PP_ENUM(N, BOOST_PARAMETER_open_list, _) \
, void_ \
BOOST_PP_REPEAT(N, BOOST_PARAMETER_close_list, _) \
, deduced_list \
, aux::tag_keyword_arg \
>
#define BOOST_PARAMETER_arg_pack_init(z, n, limit) \
BOOST_PP_CAT(a, BOOST_PP_SUB(limit,n))
template<BOOST_PP_ENUM_PARAMS(N, class A)>
typename mpl::first<
typename BOOST_PARAMETER_arg_list(N)::type
>::type
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, & a)) const
{
typedef typename BOOST_PARAMETER_arg_list(N)::type result;
typedef typename mpl::first<result>::type result_type;
typedef typename mpl::second<result>::type error;
error();
return result_type(
BOOST_PP_ENUM(N, BOOST_PARAMETER_arg_pack_init, BOOST_PP_DEC(N))
BOOST_PP_ENUM_TRAILING_PARAMS(
BOOST_PP_SUB(BOOST_PARAMETER_MAX_ARITY, N)
, aux::void_reference() BOOST_PP_INTERCEPT
));
}
#undef BOOST_PARAMETER_arg_list
#undef BOOST_PARAMETER_open_list
#undef BOOST_PARAMETER_close_list
#undef N

View File

@@ -1,32 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PACK_AS_PARAMETER_REQUIREMENTS_HPP
#define BOOST_PARAMETER_AUX_PACK_AS_PARAMETER_REQUIREMENTS_HPP
#include <boost/parameter/aux_/pack/parameter_requirements.hpp>
#include <boost/parameter/aux_/pack/tag_type.hpp>
#include <boost/parameter/aux_/pack/predicate.hpp>
#include <boost/parameter/deduced.hpp>
namespace boost { namespace parameter { namespace aux {
// Converts a ParameterSpec into a specialization of
// parameter_requirements. We need to do this in order to get the
// tag_type into the type in a way that can be conveniently matched
// by a satisfies(...) member function in arg_list.
template <typename ParameterSpec>
struct as_parameter_requirements
{
typedef ::boost::parameter::aux::parameter_requirements<
typename ::boost::parameter::aux::tag_type<ParameterSpec>::type
, typename ::boost::parameter::aux::predicate<ParameterSpec>::type
, ::boost::parameter::aux::has_default<ParameterSpec>
> type;
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

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

View File

@@ -1,34 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PACK_DEDUCED_ITEM_HPP
#define BOOST_PARAMETER_AUX_PACK_DEDUCED_ITEM_HPP
#include <boost/parameter/aux_/void.hpp>
namespace boost { namespace parameter { namespace aux {
// A typelist that stored deduced parameter specs.
template <
typename ParameterSpec
, typename Tail = ::boost::parameter::void_
>
struct deduced_item
{
typedef ParameterSpec spec;
typedef Tail tail;
};
// Evaluate Tail and construct deduced_item list.
template <typename Spec, typename Tail>
struct make_deduced_item
{
typedef ::boost::parameter::aux
::deduced_item<Spec,typename Tail::type> type;
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -1,23 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PACK_INSERT_TAGGED_HPP
#define BOOST_PARAMETER_AUX_PACK_INSERT_TAGGED_HPP
#include <boost/parameter/aux_/set.hpp>
namespace boost { namespace parameter { namespace aux {
// Inserts Tagged::key_type into the UserArgs set.
// Extra indirection to lazily evaluate Tagged::key_type.
template <typename UsedArgs, typename Tagged>
struct insert_tagged
: ::boost::parameter::aux::insert_<UsedArgs,typename Tagged::key_type>
{
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -1,43 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PACK_IS_NAMED_ARGUMENT_HPP
#define BOOST_PARAMETER_AUX_PACK_IS_NAMED_ARGUMENT_HPP
#include <boost/parameter/aux_/template_keyword.hpp>
#include <boost/parameter/aux_/is_tagged_argument.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#include <boost/mp11/utility.hpp>
#else
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename T>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using is_named_argument = ::boost::mp11::mp_if<
::boost::parameter::aux::is_template_keyword<T>
, ::boost::mp11::mp_true
, ::boost::parameter::aux::is_tagged_argument_mp11<T>
>;
#else
struct is_named_argument
: ::boost::mpl::if_<
::boost::parameter::aux::is_template_keyword<T>
, ::boost::mpl::true_
, ::boost::parameter::aux::is_tagged_argument<T>
>::type
{
};
#endif
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -1,47 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PACK_ITEM_HPP
#define BOOST_PARAMETER_AUX_PACK_ITEM_HPP
#include <boost/parameter/aux_/void.hpp>
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
// A parameter spec item typelist.
template <
typename Spec
, typename Arg
, typename Tail = ::boost::parameter::void_
>
struct item
{
typedef Spec spec;
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
typedef ::boost::is_const<
typename ::boost::remove_reference<Arg>::type
> is_arg_const;
#endif
typedef Arg arg;
typedef Tail tail;
};
template <typename Spec, typename Arg, typename Tail>
struct make_item
{
typedef boost::parameter::aux
::item<Spec,Arg,typename Tail::type> type;
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

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

View File

@@ -1,53 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PACK_MAKE_DEDUCED_ITEMS_HPP
#define BOOST_PARAMETER_AUX_PACK_MAKE_DEDUCED_ITEMS_HPP
#include <boost/parameter/aux_/void.hpp>
#include <boost/parameter/aux_/pack/deduced_item.hpp>
#include <boost/parameter/deduced.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/utility.hpp>
#include <type_traits>
#else
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename Spec, typename Tail>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using make_deduced_items = ::boost::mp11::mp_if<
::std::is_same<Spec,::boost::parameter::void_>
, ::boost::mp11::mp_identity< ::boost::parameter::void_>
, ::boost::mp11::mp_if<
::boost::parameter::aux::is_deduced<Spec>
, ::boost::parameter::aux::make_deduced_item<Spec,Tail>
, Tail
>
>;
#else
struct make_deduced_items
: ::boost::mpl::eval_if<
::boost::is_same<Spec,::boost::parameter::void_>
, ::boost::mpl::identity< ::boost::parameter::void_>
, ::boost::mpl::eval_if<
::boost::parameter::aux::is_deduced<Spec>
, ::boost::parameter::aux::make_deduced_item<Spec,Tail>
, Tail
>
>
{
};
#endif // BOOST_PARAMETER_CAN_USE_MP11
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -1,45 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PACK_MAKE_ITEMS_HPP
#define BOOST_PARAMETER_AUX_PACK_MAKE_ITEMS_HPP
#include <boost/parameter/aux_/void.hpp>
#include <boost/parameter/aux_/pack/item.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/utility.hpp>
#include <type_traits>
#else
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
// Creates a item typelist.
template <typename Spec, typename Arg, typename Tail>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using make_items = ::boost::mp11::mp_if<
::std::is_same<Arg,::boost::parameter::void_>
, ::boost::mp11::mp_identity< ::boost::parameter::void_>
, ::boost::parameter::aux::make_item<Spec,Arg,Tail>
>;
#else
struct make_items
: ::boost::mpl::eval_if<
::boost::is_same<Arg,::boost::parameter::void_>
, ::boost::mpl::identity< ::boost::parameter::void_>
, ::boost::parameter::aux::make_item<Spec,Arg,Tail>
>
{
};
#endif
}}} // namespace boost::parameter::aux
#endif // include guard

View File

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

View File

@@ -1,25 +0,0 @@
// Copyright Daniel Wallin, David Abrahams 2005.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PACK_PARAMETER_REQUIREMENTS_HPP
#define BOOST_PARAMETER_AUX_PACK_PARAMETER_REQUIREMENTS_HPP
namespace boost { namespace parameter { namespace aux {
// Used to pass static information about parameter requirements through
// the satisfies() overload set (below). The matched function is never
// invoked, but its type indicates whether a parameter matches at
// compile-time.
template <typename Keyword, typename Predicate, typename HasDefault>
struct parameter_requirements
{
typedef Keyword keyword;
typedef Predicate predicate;
typedef HasDefault has_default;
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -1,87 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PACK_PREDICATE_HPP
#define BOOST_PARAMETER_AUX_PACK_PREDICATE_HPP
namespace boost { namespace parameter { namespace aux {
// helper for get_predicate<...>, below
template <typename T>
struct get_predicate_or_default
{
typedef T type;
};
// helper for predicate<...>, below
template <typename T>
struct get_predicate
: ::boost::parameter::aux
::get_predicate_or_default<typename T::predicate>
{
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/use_default.hpp>
#include <boost/parameter/aux_/always_true_predicate.hpp>
namespace boost { namespace parameter { namespace aux {
template <>
struct get_predicate_or_default< ::boost::parameter::aux::use_default>
{
typedef ::boost::parameter::aux::always_true_predicate type;
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/required.hpp>
#include <boost/parameter/optional.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#include <boost/mp11/utility.hpp>
#else
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename T>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using predicate = ::boost::mp11::mp_if<
::boost::mp11::mp_if<
::boost::parameter::aux::is_optional<T>
, ::boost::mp11::mp_true
, ::boost::parameter::aux::is_required<T>
>
, ::boost::parameter::aux::get_predicate<T>
, ::boost::mp11::mp_identity<
::boost::parameter::aux::always_true_predicate
>
>;
#else
struct predicate
: ::boost::mpl::eval_if<
typename ::boost::mpl::if_<
::boost::parameter::aux::is_optional<T>
, ::boost::mpl::true_
, ::boost::parameter::aux::is_required<T>
>::type
, ::boost::parameter::aux::get_predicate<T>
, ::boost::mpl::identity<
::boost::parameter::aux::always_true_predicate
>
>
{
};
#endif // BOOST_PARAMETER_CAN_USE_MP11
}}} // namespace boost::parameter::aux
#endif // include guard

View File

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

View File

@@ -1,59 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PACK_TAG_DEDUCED_HPP
#define BOOST_PARAMETER_AUX_PACK_TAG_DEDUCED_HPP
#include <boost/parameter/aux_/set.hpp>
#include <boost/parameter/aux_/pack/tag_type.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/list.hpp>
#include <boost/mp11/utility.hpp>
#else
#include <boost/mpl/pair.hpp>
#include <boost/mpl/apply_wrap.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
// Tags a deduced argument Arg with the keyword tag of Spec using TagFn.
// Returns the tagged argument and the mpl::set<> UsedArgs with the
// tag of Spec inserted.
template <typename UsedArgs, typename Spec, typename Arg, typename TagFn>
struct tag_deduced
{
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using type = ::boost::mp11::mp_list<
::boost::mp11::mp_apply_q<
TagFn
, ::boost::mp11::mp_list<
typename ::boost::parameter::aux::tag_type<Spec>::type
, Arg
>
>
#else
typedef ::boost::mpl::pair<
typename ::boost::mpl::apply_wrap2<
TagFn
, typename ::boost::parameter::aux::tag_type<Spec>::type
, Arg
>::type
#endif // BOOST_PARAMETER_CAN_USE_MP11
, typename ::boost::parameter::aux::insert_<
UsedArgs
, typename ::boost::parameter::aux::tag_type<Spec>::type
>::type
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
>;
#else
> type;
#endif
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -1,30 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PACK_TAG_KEYWORD_ARG_HPP
#define BOOST_PARAMETER_AUX_PACK_TAG_KEYWORD_ARG_HPP
#include <boost/parameter/aux_/tag.hpp>
#include <boost/parameter/config.hpp>
namespace boost { namespace parameter { namespace aux {
struct tag_keyword_arg
{
template <typename K, typename T>
struct apply
{
typedef typename ::boost::parameter::aux::tag<K,T>::type type;
};
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <typename K, typename T>
using fn = typename ::boost::parameter::aux::tag<K,T>::type;
#endif
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -1,67 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PACK_TAG_KEYWORD_ARG_REF_HPP
#define BOOST_PARAMETER_AUX_PACK_TAG_KEYWORD_ARG_REF_HPP
#include <boost/parameter/aux_/unwrap_cv_reference.hpp>
#include <boost/parameter/aux_/tagged_argument.hpp>
#include <boost/parameter/config.hpp>
namespace boost { namespace parameter { namespace aux {
template <
typename Keyword
, typename ActualArg
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
, typename = typename ::boost::parameter::aux
::is_cv_reference_wrapper<ActualArg>::type
#endif
>
struct tag_ref
{
typedef ::boost::parameter::aux::tagged_argument<
Keyword
, typename ::boost::parameter::aux
::unwrap_cv_reference<ActualArg>::type
> type;
};
}}} // namespace boost::parameter::aux_
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
#include <boost/mpl/bool.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename Keyword, typename ActualArg>
struct tag_ref<Keyword,ActualArg,::boost::mpl::false_>
{
typedef ::boost::parameter::aux
::tagged_argument<Keyword,ActualArg> type;
};
}}} // namespace boost::parameter::aux_
#endif // Borland workarounds needed.
namespace boost { namespace parameter { namespace aux {
struct tag_keyword_arg_ref
{
template <typename K, typename T>
struct apply
{
typedef typename ::boost::parameter::aux::tag_ref<K,T>::type type;
};
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <typename K, typename T>
using fn = typename ::boost::parameter::aux::tag_ref<K,T>::type;
#endif
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -1,30 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PACK_TAG_TEMPLATE_KEYWORD_ARG_HPP
#define BOOST_PARAMETER_AUX_PACK_TAG_TEMPLATE_KEYWORD_ARG_HPP
#include <boost/parameter/template_keyword.hpp>
#include <boost/parameter/config.hpp>
namespace boost { namespace parameter { namespace aux {
struct tag_template_keyword_arg
{
template <typename K, typename T>
struct apply
{
typedef ::boost::parameter::template_keyword<K,T> type;
};
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <typename K, typename T>
using fn = ::boost::parameter::template_keyword<K,T>;
#endif
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -1,89 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PACK_TAG_TYPE_HPP
#define BOOST_PARAMETER_AUX_PACK_TAG_TYPE_HPP
namespace boost { namespace parameter { namespace aux {
// helper for tag_type<...>, below.
template <typename T>
struct get_tag_type0
{
typedef typename T::key_type type;
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/deduced.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/utility.hpp>
#else
#include <boost/mpl/eval_if.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct get_tag_type
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
: ::boost::mp11::mp_if<
#else
: ::boost::mpl::eval_if<
#endif
::boost::parameter::aux::is_deduced0<T>
, ::boost::parameter::aux::get_tag_type0<typename T::key_type>
, ::boost::parameter::aux::get_tag_type0<T>
>
{
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/required.hpp>
#include <boost/parameter/optional.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename T>
using tag_type = ::boost::mp11::mp_if<
::boost::mp11::mp_if<
::boost::parameter::aux::is_optional<T>
, ::boost::mp11::mp_true
, ::boost::parameter::aux::is_required<T>
>
, ::boost::parameter::aux::get_tag_type<T>
, ::boost::mp11::mp_identity<T>
>;
}}} // namespace boost::parameter::aux
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/identity.hpp>
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct tag_type
: ::boost::mpl::eval_if<
typename ::boost::mpl::if_<
::boost::parameter::aux::is_optional<T>
, ::boost::mpl::true_
, ::boost::parameter::aux::is_required<T>
>::type
, ::boost::parameter::aux::get_tag_type<T>
, ::boost::mpl::identity<T>
>
{
};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_CAN_USE_MP11
#endif // include guard

View File

@@ -1,41 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PACK_UNMATCHED_ARGUMENT_HPP
#define BOOST_PARAMETER_AUX_PACK_UNMATCHED_ARGUMENT_HPP
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <type_traits>
#else
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename T>
struct unmatched_argument
{
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
static_assert(::std::is_same<T,void>::value, "T == void");
#else
BOOST_MPL_ASSERT((
typename ::boost::mpl::if_<
::boost::is_same<T,void>
, ::boost::mpl::true_
, ::boost::mpl::false_
>::type
));
#endif
typedef int type;
};
}}} // namespace boost::parameter::aux
#endif // include guard

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

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

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

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

View File

@@ -1,91 +0,0 @@
// Copyright Daniel Wallin 2006.
// Copyright Cromwell D. Enage 2017.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PP_IMPL_ARGUMENT_PACK_HPP
#define BOOST_PARAMETER_AUX_PP_IMPL_ARGUMENT_PACK_HPP
#include <boost/parameter/aux_/pack/tag_keyword_arg.hpp>
#include <boost/parameter/aux_/pack/make_arg_list.hpp>
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#include <boost/parameter/aux_/pack/make_parameter_spec_items.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#include <boost/mp11/list.hpp>
#else
#include <boost/mpl/bool.hpp>
#include <boost/mpl/pair.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
template <typename Parameters, typename ...Args>
struct argument_pack
{
typedef typename ::boost::parameter::aux::make_arg_list<
typename ::boost::parameter::aux::make_parameter_spec_items<
typename Parameters::parameter_spec
, Args...
>::type
, typename Parameters::deduced_list
, ::boost::parameter::aux::tag_keyword_arg
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
, ::boost::mp11::mp_false
#else
, ::boost::mpl::false_
#endif
>::type result;
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using type = ::boost::mp11::mp_at_c<result,0>;
#else
typedef typename ::boost::mpl::first<result>::type type;
#endif
};
}}} // namespace boost::parameter::aux
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#include <boost/parameter/aux_/void.hpp>
#include <boost/parameter/aux_/pack/make_items.hpp>
#include <boost/parameter/aux_/preprocessor/no_perfect_forwarding_begin.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/pair.hpp>
namespace boost { namespace parameter { namespace aux {
template <
typename Parameters
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(
BOOST_PARAMETER_MAX_ARITY
, typename A
, = ::boost::parameter::void_ BOOST_PP_INTERCEPT
)
>
struct argument_pack
{
typedef typename ::boost::parameter::aux::make_arg_list<
typename BOOST_PARAMETER_build_arg_list(
BOOST_PARAMETER_MAX_ARITY
, ::boost::parameter::aux::make_items
, typename Parameters::parameter_spec
, A
)::type
, typename Parameters::deduced_list
, ::boost::parameter::aux::tag_keyword_arg
, ::boost::mpl::false_
>::type result;
typedef typename ::boost::mpl::first<result>::type type;
};
}}} // namespace boost::parameter::aux
#include <boost/parameter/aux_/preprocessor/no_perfect_forwarding_end.hpp>
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
#endif // include guard

View File

@@ -1,55 +0,0 @@
// Copyright Daniel Wallin 2006.
// Copyright Cromwell D. Enage 2017.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PP_IMPL_MATCH_HPP
#define BOOST_PARAMETER_AUX_PP_IMPL_MATCH_HPP
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
namespace boost { namespace parameter { namespace aux {
// Recast the ParameterSpec's nested match metafunction
// as a free metafunction.
//
// No more limits set by BOOST_PARAMETER_MAX_ARITY. -- Cromwell D. Enage
template <typename Parameters, typename ...Args>
struct match : Parameters::BOOST_NESTED_TEMPLATE match<Args...>
{
};
}}} // namespace boost::parameter::aux
#else
#include <boost/parameter/aux_/void.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
namespace boost { namespace parameter { namespace aux {
// Recast the ParameterSpec's nested match metafunction
// as a free metafunction.
template <
typename Parameters
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(
BOOST_PARAMETER_MAX_ARITY
, typename A
, = ::boost::parameter::void_ BOOST_PP_INTERCEPT
)
>
struct match
: Parameters::BOOST_NESTED_TEMPLATE match<
BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, A)
>
{
};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
#endif // include guard

View File

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

View File

@@ -1,65 +0,0 @@
// Copyright Cromwell D. Enage 2017.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_BINARY_SEQ_TO_ARGS_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_BINARY_SEQ_TO_ARGS_HPP
#include <boost/preprocessor/seq/elem.hpp>
#include <boost/preprocessor/cat.hpp>
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0_1(n, prefix_seq) \
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, prefix_seq), n) const&
/**/
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1_1(n, prefix_seq) \
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, prefix_seq), n)&
/**/
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0_2(n, prefix_seq) \
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0_1(n, prefix_seq) \
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, prefix_seq), n)
/**/
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1_2(n, prefix_seq) \
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1_1(n, prefix_seq) \
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, prefix_seq), n)
/**/
#include <boost/preprocessor/seq/size.hpp>
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0(prefix_seq) \
BOOST_PP_CAT( \
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0_ \
, BOOST_PP_SEQ_SIZE(prefix_seq) \
)
/**/
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1(prefix_seq) \
BOOST_PP_CAT( \
BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1_ \
, BOOST_PP_SEQ_SIZE(prefix_seq) \
)
/**/
#include <boost/parameter/aux_/preprocessor/convert_binary_seq.hpp>
// This macro converts the specified Boost.Preprocessor sequence of 1s and 0s
// into a formal function parameter list.
//
// Example:
// BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS((1)(0)(1)(0), (P)(p))
// expands to
// P0 & p0, P1 const& p1, P2 & p2, P3 const& p3
#define BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS(binary_seq, prefix_seq) \
BOOST_PARAMETER_AUX_PP_CONVERT_BINARY_SEQ( \
binary_seq \
, BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_0(prefix_seq) \
, BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARG_1(prefix_seq) \
, prefix_seq \
)
/**/
#endif // include guard

View File

@@ -1,57 +0,0 @@
// Copyright Cromwell D. Enage 2013.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_CONVERT_BINARY_SEQ_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_CONVERT_BINARY_SEQ_HPP
#include <boost/preprocessor/seq/size.hpp>
#include <boost/preprocessor/seq/push_back.hpp>
#define BOOST_PARAMETER_AUX_PP_AUGMENT_BINARY_SEQ_INDEX_FOLD_OP(s, seq, idx) \
BOOST_PP_SEQ_PUSH_BACK(seq, (idx, BOOST_PP_SEQ_SIZE(seq)))
/**/
#include <boost/preprocessor/control/iif.hpp>
#include <boost/preprocessor/seq/elem.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#define BOOST_PARAMETER_AUX_PP_CONVERT_BINARY_SEQ_FOLD_OP(s, seq, elem) \
( \
BOOST_PP_SEQ_PUSH_BACK( \
BOOST_PP_SEQ_ELEM(0, seq) \
, BOOST_PP_IIF( \
BOOST_PP_TUPLE_ELEM(2, 0, elem) \
, BOOST_PP_SEQ_ELEM(2, seq) \
, BOOST_PP_SEQ_ELEM(1, seq) \
)(BOOST_PP_TUPLE_ELEM(2, 1, elem), BOOST_PP_SEQ_ELEM(3, seq)) \
) \
)(BOOST_PP_SEQ_ELEM(1, seq))(BOOST_PP_SEQ_ELEM(2, seq)) \
(BOOST_PP_SEQ_ELEM(3, seq))
/**/
#include <boost/parameter/aux_/preprocessor/seq_enum.hpp>
#include <boost/preprocessor/facilities/empty.hpp>
#include <boost/preprocessor/seq/seq.hpp>
#include <boost/preprocessor/seq/fold_left.hpp>
#define BOOST_PARAMETER_AUX_PP_CONVERT_BINARY_SEQ(seq, macro0, macro1, data) \
BOOST_PARAMETER_SEQ_ENUM( \
BOOST_PP_SEQ_ELEM( \
0 \
, BOOST_PP_SEQ_FOLD_LEFT( \
BOOST_PARAMETER_AUX_PP_CONVERT_BINARY_SEQ_FOLD_OP \
, (BOOST_PP_SEQ_NIL)(macro0)(macro1)(data) \
, BOOST_PP_SEQ_FOLD_LEFT( \
BOOST_PARAMETER_AUX_PP_AUGMENT_BINARY_SEQ_INDEX_FOLD_OP \
, BOOST_PP_EMPTY() \
, seq \
) \
) \
) \
)
/**/
#endif // include guard

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

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

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

@@ -1,12 +1,103 @@
// 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)
// Copyright Daniel Wallin 2005. Use, modification and distribution is
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_FOR_EACH_051217_HPP
#define BOOST_PARAMETER_FOR_EACH_051217_HPP
# define BOOST_PARAMETER_FOR_EACH_051217_HPP
#include <boost/parameter/aux_/preprocessor/impl/for_each.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>
#endif // include guard
# 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

File diff suppressed because it is too large Load Diff

View File

@@ -1,24 +0,0 @@
// Copyright Daniel Wallin 2006.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_ARGUMENT_SPECS_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_ARGUMENT_SPECS_HPP
#include <boost/preprocessor/tuple/elem.hpp>
// Accessor macros for the argument specs tuple.
#define BOOST_PARAMETER_FN_ARG_QUALIFIER(x) BOOST_PP_TUPLE_ELEM(4, 0, x)
#define BOOST_PARAMETER_FN_ARG_KEYWORD(x) BOOST_PP_TUPLE_ELEM(4, 1, x)
#define BOOST_PARAMETER_FN_ARG_PRED(x) BOOST_PP_TUPLE_ELEM(4, 2, x)
#define BOOST_PARAMETER_FN_ARG_DEFAULT(x) BOOST_PP_TUPLE_ELEM(4, 3, x)
#include <boost/parameter/aux_/preprocessor/qualifier.hpp>
#define BOOST_PARAMETER_FN_ARG_NAME(x) \
BOOST_PARAMETER_UNQUALIFIED(BOOST_PARAMETER_FN_ARG_KEYWORD(x))
/**/
#endif // include guard

View File

@@ -1,42 +0,0 @@
// Copyright Daniel Wallin 2006.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_ARITY_RANGE_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_ARITY_RANGE_HPP
// Helper macros for BOOST_PARAMETER_ARITY_RANGE.
#define BOOST_PARAMETER_ARITY_RANGE_M_optional(state) state
#define BOOST_PARAMETER_ARITY_RANGE_M_deduced_optional(state) state
#include <boost/preprocessor/arithmetic/inc.hpp>
#define BOOST_PARAMETER_ARITY_RANGE_M_required(state) BOOST_PP_INC(state)
#define BOOST_PARAMETER_ARITY_RANGE_M_deduced_required(state) \
BOOST_PP_INC(state)
/**/
#include <boost/parameter/aux_/preprocessor/impl/argument_specs.hpp>
#include <boost/preprocessor/cat.hpp>
#define BOOST_PARAMETER_ARITY_RANGE_M(s, state, x) \
BOOST_PP_CAT( \
BOOST_PARAMETER_ARITY_RANGE_M_ \
, BOOST_PARAMETER_FN_ARG_QUALIFIER(x) \
)(state)
/**/
#include <boost/preprocessor/seq/fold_left.hpp>
#include <boost/preprocessor/seq/size.hpp>
// Calculates [begin, end) arity range.
#define BOOST_PARAMETER_ARITY_RANGE(args) \
( \
BOOST_PP_SEQ_FOLD_LEFT(BOOST_PARAMETER_ARITY_RANGE_M, 0, args) \
, BOOST_PP_INC(BOOST_PP_SEQ_SIZE(args)) \
)
/**/
#endif // include guard

View File

@@ -1,143 +0,0 @@
// Copyright Daniel Wallin 2005.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FLATTEN_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FLATTEN_HPP
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT_required required,
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT_optional optional,
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT_deduced deduced,
#define BOOST_PARAMETER_AUX_PP_FLATTEN_IDENTITY(x) x
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC0_DUMMY_ELEM(z, n, data) ~
#include <boost/preprocessor/cat.hpp>
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT(sub) \
BOOST_PP_CAT(BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT_, sub)
/**/
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_AS_DEDUCED(x) \
BOOST_PP_CAT(deduced_, x)
/**/
#include <boost/preprocessor/detail/split.hpp>
#define BOOST_PARAMETER_AUX_PP_FLATTEN_QUALIFIER(sub) \
BOOST_PP_SPLIT(0, BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT(sub))
/**/
#define BOOST_PARAMETER_AUX_PP_FLATTEN_ARGS(sub) \
BOOST_PP_SPLIT(1, BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT(sub))
/**/
#include <boost/preprocessor/tuple/elem.hpp>
#define BOOST_PARAMETER_AUX_PP_FLATTEN_ARITY_optional(arities) \
BOOST_PP_TUPLE_ELEM(3, 0, arities)
/**/
#define BOOST_PARAMETER_AUX_PP_FLATTEN_ARITY_required(arities) \
BOOST_PP_TUPLE_ELEM(3, 1, arities)
/**/
#include <boost/preprocessor/arithmetic/sub.hpp>
#include <boost/preprocessor/repetition/enum_trailing.hpp>
#include <boost/preprocessor/tuple/rem.hpp>
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC0(r, n, elem, data) \
(( \
BOOST_PP_TUPLE_ELEM(3, 2, data) \
, BOOST_PP_TUPLE_REM(BOOST_PP_TUPLE_ELEM(3, 0, data)) elem \
BOOST_PP_ENUM_TRAILING( \
BOOST_PP_SUB( \
BOOST_PP_TUPLE_ELEM(3, 1, data) \
, BOOST_PP_TUPLE_ELEM(3, 0, data) \
) \
, BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC0_DUMMY_ELEM \
, ~ \
) \
))
/**/
#include <boost/parameter/aux_/preprocessor/impl/for_each.hpp>
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_AUX( \
r, arity, max_arity, spec, xform \
) \
BOOST_PARAMETER_AUX_PP_FOR_EACH_R( \
r \
, arity \
, BOOST_PARAMETER_AUX_PP_FLATTEN_ARGS(spec) \
, ( \
arity \
, max_arity \
, xform(BOOST_PARAMETER_AUX_PP_FLATTEN_QUALIFIER(spec)) \
) \
, BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC0 \
)
/**/
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_optional(r, arities, spec) \
BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_AUX( \
r \
, BOOST_PP_CAT( \
BOOST_PARAMETER_AUX_PP_FLATTEN_ARITY_ \
, BOOST_PARAMETER_AUX_PP_FLATTEN_QUALIFIER(spec) \
)(arities) \
, BOOST_PP_TUPLE_ELEM(3, 2, arities) \
, spec \
, BOOST_PARAMETER_AUX_PP_FLATTEN_IDENTITY \
)
/**/
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_required(r, arities, spec) \
BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_optional(r, arities, spec)
/**/
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_deduced_M(r, arities, n, spec) \
BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_AUX( \
r \
, BOOST_PP_CAT( \
BOOST_PARAMETER_AUX_PP_FLATTEN_ARITY_ \
, BOOST_PARAMETER_AUX_PP_FLATTEN_QUALIFIER(spec) \
)(arities) \
, BOOST_PP_TUPLE_ELEM(3, 2, arities) \
, spec \
, BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_AS_DEDUCED \
)
/**/
#include <boost/preprocessor/seq/for_each_i.hpp>
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_deduced(r, arities, spec) \
BOOST_PP_SEQ_FOR_EACH_I_R( \
r \
, BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_deduced_M \
, arities \
, BOOST_PARAMETER_AUX_PP_FLATTEN_ARGS(spec) \
)
/**/
#define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC(r, arities, spec) \
BOOST_PP_CAT( \
BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_ \
, BOOST_PARAMETER_AUX_PP_FLATTEN_QUALIFIER(spec) \
)(r, arities, spec)
/**/
#include <boost/preprocessor/seq/for_each.hpp>
#define BOOST_PARAMETER_AUX_PP_FLATTEN( \
opt_arity, req_arity, wanted_arity, specs \
) \
BOOST_PP_SEQ_FOR_EACH( \
BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC \
, (opt_arity, req_arity, wanted_arity) \
, specs \
)
/**/
#endif // include guard

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,33 +0,0 @@
// Copyright Daniel Wallin 2006.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_DISPATCH_TUPLE_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_DISPATCH_TUPLE_HPP
#include <boost/preprocessor/tuple/elem.hpp>
// Accessor macros for the input tuple to the dispatch macros.
#define BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
BOOST_PP_TUPLE_ELEM(5, 0, x)
/**/
#define BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
BOOST_PP_TUPLE_ELEM(5, 1, x)
/**/
#define BOOST_PARAMETER_FUNCTION_DISPATCH_IS_MEMBER(x) \
BOOST_PP_TUPLE_ELEM(5, 2, x)
/**/
#define BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x) \
BOOST_PP_TUPLE_ELEM(5, 3, x)
/**/
#define BOOST_PARAMETER_FUNCTION_DISPATCH_TAG_NAMESPACE(x) \
BOOST_PP_TUPLE_ELEM(5, 4, x)
/**/
#endif // include guard

View File

@@ -1,43 +0,0 @@
// Copyright Daniel Wallin 2006.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_FORWARD_MATCH_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_FORWARD_MATCH_HPP
#include <boost/parameter/config.hpp>
#if !defined(BOOST_NO_SFINAE) && \
!BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x592))
#include <boost/parameter/aux_/pp_impl/match.hpp>
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
// Expands to an extra argument that is well-formed
// iff all Args... satisfy the requirements set by params.
#define BOOST_PARAMETER_FUNCTION_FORWARD_MATCH(params, n, prefix) \
, typename ::boost::parameter::aux::match< \
params BOOST_PP_ENUM_TRAILING_PARAMS(n, prefix) \
>::type = params()
/**/
#define BOOST_PARAMETER_FUNCTION_FORWARD_MATCH_Z(z, params, n, prefix) \
, typename ::boost::parameter::aux::match< \
params BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, prefix) \
>::type = params()
/**/
#else // SFINAE/Borland workarounds needed.
#define BOOST_PARAMETER_FUNCTION_FORWARD_MATCH(params, n, prefix) \
, params = params()
/**/
#define BOOST_PARAMETER_FUNCTION_FORWARD_MATCH_Z(z, params, n, prefix) \
, params = params()
/**/
#endif
#endif // include guard

View File

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

View File

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

View File

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

View File

@@ -1,34 +0,0 @@
// Copyright David Abrahams 2006.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_PARENTHESIZED_TYPE_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_PARENTHESIZED_TYPE_HPP
namespace boost { namespace parameter { namespace aux {
// A metafunction that transforms void(*)(T) -> T
template <typename UnaryFunctionPointer>
struct unaryfunptr_arg_type;
template <typename Arg>
struct unaryfunptr_arg_type<void(*)(Arg)>
{
typedef Arg type;
};
template <>
struct unaryfunptr_arg_type<void(*)(void)>
{
typedef void type;
};
}}} // namespace boost::parameter::aux
// A macro that takes a parenthesized C++ type name (T) and transforms it
// into an un-parenthesized type expression equivalent to T.
#define BOOST_PARAMETER_PARENTHESIZED_TYPE(x) \
::boost::parameter::aux::unaryfunptr_arg_type< void(*)x >::type
#endif // include guard

View File

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

View File

@@ -1,71 +0,0 @@
// Copyright Daniel Wallin 2006.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_SPLIT_ARGS_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_SPLIT_ARGS_HPP
#include <boost/preprocessor/tuple/elem.hpp>
// Accessor macros for the split_args tuple.
#define BOOST_PARAMETER_SPLIT_ARG_REQ_COUNT(x) BOOST_PP_TUPLE_ELEM(4, 0, x)
#define BOOST_PARAMETER_SPLIT_ARG_REQ_SEQ(x) BOOST_PP_TUPLE_ELEM(4, 1, x)
#define BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT(x) BOOST_PP_TUPLE_ELEM(4, 2, x)
#define BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(x) BOOST_PP_TUPLE_ELEM(4, 3, x)
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/seq/push_back.hpp>
// Helper macros for BOOST_PARAMETER_FUNCTION_SPLIT_ARGS.
#define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_required(s_a, arg) \
( \
BOOST_PP_INC(BOOST_PARAMETER_SPLIT_ARG_REQ_COUNT(s_a)) \
, BOOST_PP_SEQ_PUSH_BACK(BOOST_PARAMETER_SPLIT_ARG_REQ_SEQ(s_a), arg) \
, BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT(s_a) \
, BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(s_a) \
)
/**/
#define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_deduced_required(split_args, arg) \
BOOST_PARAMETER_FUNCTION_SPLIT_ARG_required(split_args, arg)
/**/
#define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_optional(s_a, arg) \
( \
BOOST_PARAMETER_SPLIT_ARG_REQ_COUNT(s_a) \
, BOOST_PARAMETER_SPLIT_ARG_REQ_SEQ(s_a) \
, BOOST_PP_INC(BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT(s_a)) \
, BOOST_PP_SEQ_PUSH_BACK(BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(s_a), arg) \
)
/**/
#define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_deduced_optional(split_args, arg) \
BOOST_PARAMETER_FUNCTION_SPLIT_ARG_optional(split_args, arg)
/**/
#include <boost/parameter/aux_/preprocessor/impl/argument_specs.hpp>
#include <boost/preprocessor/cat.hpp>
#define BOOST_PARAMETER_FUNCTION_SPLIT_ARG(s, split_args, arg) \
BOOST_PP_CAT( \
BOOST_PARAMETER_FUNCTION_SPLIT_ARG_ \
, BOOST_PARAMETER_FN_ARG_QUALIFIER(arg) \
)(split_args, arg)
/**/
#include <boost/preprocessor/seq/fold_left.hpp>
#include <boost/preprocessor/seq/seq.hpp>
// Expands from the flattened BOOST_PARAMETER_FUNCTION et. al. arg sequence to
// the tuple (required_count, required_args, optional_count, optional_args).
#define BOOST_PARAMETER_FUNCTION_SPLIT_ARGS(args) \
BOOST_PP_SEQ_FOLD_LEFT( \
BOOST_PARAMETER_FUNCTION_SPLIT_ARG \
, (0, BOOST_PP_SEQ_NIL, 0, BOOST_PP_SEQ_NIL) \
, args \
)
/**/
#endif // include guard

View File

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

View File

@@ -1,31 +0,0 @@
// Copyright Daniel Wallin 2006.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IS_BINARY_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IS_BINARY_HPP
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
// From Paul Mensonides
#include <boost/preprocessor/punctuation/comma.hpp>
#include <boost/preprocessor/detail/split.hpp>
#define BOOST_PARAMETER_IS_BINARY(x) \
BOOST_PP_SPLIT(1, BOOST_PARAMETER_IS_BINARY_C x BOOST_PP_COMMA() 0)
/**/
#include <boost/preprocessor/punctuation/paren.hpp>
#include <boost/preprocessor/tuple/eat.hpp>
#define BOOST_PARAMETER_IS_BINARY_C(x,y) \
~, 1 BOOST_PP_RPAREN() \
BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~
/**/
#else
#include <boost/preprocessor/detail/is_binary.hpp>
#define BOOST_PARAMETER_IS_BINARY(x) BOOST_PP_IS_BINARY(x)
#endif
#endif // include guard

View File

@@ -1,32 +0,0 @@
// Copyright Daniel Wallin 2006.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IS_NULLARY_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_IS_NULLARY_HPP
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
// From Paul Mensonides
#include <boost/preprocessor/punctuation/comma.hpp>
#include <boost/preprocessor/detail/split.hpp>
#define BOOST_PARAMETER_IS_NULLARY(x) \
BOOST_PP_SPLIT(1, BOOST_PARAMETER_IS_NULLARY_C x BOOST_PP_COMMA() 0)
/**/
#include <boost/preprocessor/punctuation/paren.hpp>
#include <boost/preprocessor/tuple/eat.hpp>
#define BOOST_PARAMETER_IS_NULLARY_C() \
~, 1 BOOST_PP_RPAREN() \
BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~
/**/
#else
#include <boost/preprocessor/detail/is_nullary.hpp>
#define BOOST_PARAMETER_IS_NULLARY(x) BOOST_PP_IS_NULLARY(x)
/**/
#endif
#endif // include guard

View File

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

View File

@@ -1,24 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Copyright Cromwell D. Enage 2017.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// No include guard. This file is intended for multiple inclusion.
#undef BOOST_PARAMETER_satisfies_begin
#if (0 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
#undef BOOST_PARAMETER_function_call_op_overload_R
#undef BOOST_PARAMETER_function_call_arg_pack_init
#undef BOOST_PARAMETER_function_call_arg_list_R
#undef BOOST_PARAMETER_make_arg_items_R
#endif
#undef BOOST_PARAMETER_template_args
#undef BOOST_PARAMETER_forward_typedef
#undef BOOST_PARAMETER_build_deduced_list
#undef BOOST_PARAMETER_make_deduced_list
#undef BOOST_PARAMETER_build_arg_list
#undef BOOST_PARAMETER_make_arg_list
#undef BOOST_PARAMETER_satisfies_end
#undef BOOST_PARAMETER_right_angle

View File

@@ -1,18 +0,0 @@
// Copyright Cromwell D. Enage 2019.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_NULLPTR_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_NULLPTR_HPP
#include <boost/config.hpp>
#if defined(BOOST_NO_CXX11_NULLPTR)
#define BOOST_PARAMETER_AUX_PP_NULLPTR 0
#else
#define BOOST_PARAMETER_AUX_PP_NULLPTR nullptr
#endif
#endif // include guard

View File

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

View File

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

View File

@@ -1,26 +0,0 @@
// Copyright David Abrahams 2005.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_SEQ_ENUM_HPP
#define BOOST_PARAMETER_AUX_PREPROCESSOR_SEQ_ENUM_HPP
#include <boost/preprocessor/seq/enum.hpp>
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003)
#include <boost/preprocessor/seq/size.hpp>
// Temporary version of BOOST_PP_SEQ_ENUM
// until Paul M. integrates the workaround.
#define BOOST_PARAMETER_SEQ_ENUM_I(size, seq) \
BOOST_PP_CAT(BOOST_PP_SEQ_ENUM_, size) seq
#define BOOST_PARAMETER_SEQ_ENUM(seq) \
BOOST_PARAMETER_SEQ_ENUM_I(BOOST_PP_SEQ_SIZE(seq), seq)
#else
#define BOOST_PARAMETER_SEQ_ENUM(seq) BOOST_PP_SEQ_ENUM(seq)
#endif
#endif // include guard

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,131 @@
// Copyright Daniel Wallin 2005. Use, modification and distribution is
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_INVOKER_051210_HPP
# define BOOST_PARAMETER_INVOKER_051210_HPP
# include <boost/mpl/begin.hpp>
# include <boost/mpl/next.hpp>
# include <boost/mpl/deref.hpp>
# include <boost/parameter/keyword.hpp>
# include <boost/preprocessor/iteration/iterate.hpp>
namespace boost { namespace parameter { namespace python { namespace aux {
template <long Arity, class M, class R, class Args>
struct invoker;
template <class M, class R>
struct make_invoker
{
template <class Args>
struct apply
{
typedef invoker<
mpl::size<Args>::value, M, R, Args
> type;
};
};
template <long Arity, class M, class R, class T, class Args>
struct member_invoker;
template <class M, class R, class T>
struct make_member_invoker
{
template <class Args>
struct apply
{
typedef member_invoker<
mpl::size<Args>::value, M, R, T, Args
> type;
};
};
template <long Arity, class T, class R, class Args>
struct call_invoker;
template <class T, class R>
struct make_call_invoker
{
template <class Args>
struct apply
{
typedef call_invoker<
mpl::size<Args>::value, T, R, Args
> type;
};
};
template <long Arity, class T, class Args>
struct init_invoker;
template <class T>
struct make_init_invoker
{
template <class Args>
struct apply
{
typedef init_invoker<
mpl::size<Args>::value, T, Args
> type;
};
};
template <class M, class R, class Args>
struct invoker<0, M, R, Args>
{
static R execute()
{
return M()(boost::type<R>());
}
};
template <class M, class R, class T, class Args>
struct member_invoker<0, M, R, T, Args>
{
static R execute(T& self)
{
return M()(boost::type<R>(), self);
}
};
template <class T, class R, class Args>
struct call_invoker<0, T, R, Args>
{
static R execute(T& self)
{
return self();
}
};
template <class T, class Args>
struct init_invoker<0, T, Args>
{
static T* execute(T& self)
{
return new T;
}
};
# define BOOST_PP_ITERATION_PARAMS_1 (4, \
(1, BOOST_PARAMETER_MAX_ARITY, <boost/parameter/aux_/python/invoker_iterate.hpp>, 1))
# include BOOST_PP_ITERATE()
# define BOOST_PP_ITERATION_PARAMS_1 (4, \
(1, BOOST_PARAMETER_MAX_ARITY, <boost/parameter/aux_/python/invoker_iterate.hpp>, 2))
# include BOOST_PP_ITERATE()
# define BOOST_PP_ITERATION_PARAMS_1 (4, \
(1, BOOST_PARAMETER_MAX_ARITY, <boost/parameter/aux_/python/invoker_iterate.hpp>, 3))
# include BOOST_PP_ITERATE()
# define BOOST_PP_ITERATION_PARAMS_1 (4, \
(1, BOOST_PARAMETER_MAX_ARITY, <boost/parameter/aux_/python/invoker_iterate.hpp>, 4))
# include BOOST_PP_ITERATE()
}}}} // namespace boost::parameter::python::aux
#endif // BOOST_PARAMETER_INVOKER_051210_HPP

View File

@@ -0,0 +1,93 @@
// Copyright Daniel Wallin 2005. Use, modification and distribution is
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/dec.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#define N BOOST_PP_ITERATION()
#define BOOST_PARAMETER_PY_ARG_TYPES(z, n, _) \
typedef typename mpl::next< \
BOOST_PP_CAT(iter,BOOST_PP_DEC(n)) \
>::type BOOST_PP_CAT(iter,n); \
\
typedef typename mpl::deref<BOOST_PP_CAT(iter,n)>::type BOOST_PP_CAT(spec,n); \
typedef typename mpl::if_< \
mpl::and_< \
mpl::not_<typename BOOST_PP_CAT(spec,n)::required> \
, typename BOOST_PP_CAT(spec,n)::optimized_default \
> \
, parameter::aux::maybe<typename BOOST_PP_CAT(spec,n)::type> \
, typename BOOST_PP_CAT(spec,n)::type \
>::type BOOST_PP_CAT(arg,n); \
typedef typename BOOST_PP_CAT(spec,n)::keyword BOOST_PP_CAT(kw,n);
#if BOOST_PP_ITERATION_FLAGS() == 1
template <class M, class R, class Args>
struct invoker<N, M, R, Args>
#elif BOOST_PP_ITERATION_FLAGS() == 2
template <class T, class R, class Args>
struct call_invoker<N, T, R, Args>
#elif BOOST_PP_ITERATION_FLAGS() == 3
template <class T, class Args>
struct init_invoker<N, T, Args>
#elif BOOST_PP_ITERATION_FLAGS() == 4
template <class M, class R, class T, class Args>
struct member_invoker<N, M, R, T, Args>
#endif
{
typedef typename mpl::begin<Args>::type iter0;
typedef typename mpl::deref<iter0>::type spec0;
typedef typename mpl::if_<
mpl::and_<
mpl::not_<typename spec0::required>
, typename spec0::optimized_default
>
, parameter::aux::maybe<typename spec0::type>
, typename spec0::type
>::type arg0;
typedef typename spec0::keyword kw0;
BOOST_PP_REPEAT_FROM_TO(1, N, BOOST_PARAMETER_PY_ARG_TYPES, ~)
static
#if BOOST_PP_ITERATION_FLAGS() == 3
T*
#else
R
#endif
execute(
#if BOOST_PP_ITERATION_FLAGS() == 2 || BOOST_PP_ITERATION_FLAGS() == 4
T& self
,
#endif
BOOST_PP_ENUM_BINARY_PARAMS(N, arg, a)
)
{
return
#if BOOST_PP_ITERATION_FLAGS() == 1 || BOOST_PP_ITERATION_FLAGS() == 4
M()(
boost::type<R>()
# if BOOST_PP_ITERATION_FLAGS() == 4
, self
# endif
, BOOST_PP_ENUM_BINARY_PARAMS(N, parameter::keyword<kw, >::get() = a)
);
#elif BOOST_PP_ITERATION_FLAGS() == 2
self(
BOOST_PP_ENUM_BINARY_PARAMS(N, parameter::keyword<kw, >::get() = a)
);
#elif BOOST_PP_ITERATION_FLAGS() == 3
new T(
BOOST_PP_ENUM_BINARY_PARAMS(N, parameter::keyword<kw, >::get() = a)
);
#endif
}
};
#undef BOOST_PARAMETER_PY_ARG_TYPES
#undef N

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

@@ -1,53 +1,36 @@
// Copyright David Abrahams 2005.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Copyright David Abrahams 2005. Distributed under the Boost
// Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_RESULT_OF0_DWA2005511_HPP
#define BOOST_PARAMETER_AUX_RESULT_OF0_DWA2005511_HPP
# define BOOST_PARAMETER_AUX_RESULT_OF0_DWA2005511_HPP
#include <boost/parameter/aux_/use_default_tag.hpp>
#include <boost/parameter/config.hpp>
#include <boost/utility/result_of.hpp>
# include <boost/utility/result_of.hpp>
// A metafunction returning the result of invoking a nullary function
// object of the given type.
#ifndef BOOST_NO_RESULT_OF
# include <boost/utility/result_of.hpp>
namespace boost { namespace parameter { namespace aux {
template <class F>
struct result_of0 : result_of<F()>
{};
}}} // namespace boost::parameter::aux_
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/utility.hpp>
#include <type_traits>
#else
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_void.hpp>
#endif
namespace boost { namespace parameter { namespace aux {
namespace boost { namespace parameter { namespace aux {
template <class F>
struct result_of0
{
typedef typename F::result_type type;
};
// A metafunction returning the result of invoking
// a nullary function object of the given type.
template <typename F>
class result_of0
{
#if defined(BOOST_NO_RESULT_OF)
typedef typename F::result_type result_of_F;
#else
typedef typename ::boost::result_of<F()>::type result_of_F;
#endif
}}} // namespace boost::parameter::aux_
public:
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using type = ::boost::mp11::mp_if<
::std::is_void<result_of_F>
#else
typedef typename ::boost::mpl::if_<
::boost::is_void<result_of_F>
#endif
, ::boost::parameter::aux::use_default_tag
, result_of_F
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
>;
#else
>::type type;
#endif
};
}}} // namespace boost::parameter::aux
#endif
#endif // include guard
#endif // BOOST_PARAMETER_AUX_RESULT_OF0_DWA2005511_HPP

151
include/boost/parameter/aux_/set.hpp Normal file → Executable file
View File

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

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

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

1020
include/boost/parameter/aux_/tagged_argument.hpp Normal file → Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -1,38 +0,0 @@
// Copyright Daniel Wallin, David Abrahams 2005.
// Copyright Cromwell D. Enage 2017.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_TAGGED_ARGUMENT_FWD_HPP
#define BOOST_PARAMETER_TAGGED_ARGUMENT_FWD_HPP
namespace boost { namespace parameter { namespace aux {
template <typename Keyword, typename Arg>
class tagged_argument;
}}} // namespace boost::parameter::aux
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
namespace boost { namespace parameter { namespace aux {
template <typename Keyword, typename Arg>
struct tagged_argument_rref;
}}} // namespace boost::parameter::aux
#endif
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
namespace boost { namespace parameter { namespace aux {
template <typename TaggedArg>
struct tagged_argument_list_of_1;
}}} // namespace boost::parameter::aux
#endif
#endif // include guard

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

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

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

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

View File

@@ -1,17 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_USE_DEFAULT_HPP
#define BOOST_PARAMETER_AUX_USE_DEFAULT_HPP
namespace boost { namespace parameter { namespace aux {
struct use_default
{
};
}}} // namespace boost::parameter::aux
#endif // include guard

View File

@@ -1,29 +0,0 @@
// Copyright Daniel Wallin 2006.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_USE_DEFAULT_TAG_HPP
#define BOOST_PARAMETER_USE_DEFAULT_TAG_HPP
#include <boost/config.hpp>
namespace boost { namespace parameter { namespace aux {
struct use_default_tag
{
inline BOOST_CONSTEXPR BOOST_DEFAULTED_FUNCTION(use_default_tag(), {})
inline BOOST_CONSTEXPR BOOST_DEFAULTED_FUNCTION(
use_default_tag(use_default_tag const&), {}
)
inline BOOST_CONSTEXPR use_default_tag operator()() const
{
return *this;
}
};
}}} // namespace boost::parameter::aux
#endif // include guard

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

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

48
include/boost/parameter/aux_/yesno.hpp Normal file → Executable file
View File

@@ -1,42 +1,26 @@
// Copyright Daniel Wallin, David Abrahams 2005.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// Copyright Daniel Wallin, David Abrahams 2005. Use, modification and
// distribution is subject to the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_AUX_YESNO_HPP
#define BOOST_PARAMETER_AUX_YESNO_HPP
namespace boost { namespace parameter { namespace aux {
// types used with the "sizeof trick" to capture the results of
// overload resolution at compile-time.
typedef char yes_tag;
typedef char (&no_tag)[2];
}}} // namespace boost::parameter::aux
#ifndef YESNO_050328_HPP
#define YESNO_050328_HPP
#include <boost/mpl/bool.hpp>
namespace boost { namespace parameter { namespace aux {
// mpl::true_ and mpl::false_ are not distinguishable by sizeof(),
// so we pass them through these functions to get a type that is.
::boost::parameter::aux::yes_tag to_yesno(::boost::mpl::true_);
::boost::parameter::aux::no_tag to_yesno(::boost::mpl::false_);
// types used with the "sizeof trick" to capture the results of
// overload resolution at compile-time.
typedef char yes_tag;
typedef char (&no_tag)[2];
// mpl::true_ and mpl::false_ are not distinguishable by sizeof(),
// so we pass them through these functions to get a type that is.
yes_tag to_yesno(mpl::true_);
no_tag to_yesno(mpl::false_);
}}} // namespace boost::parameter::aux
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
namespace boost { namespace parameter { namespace aux {
// mp11::mp_true and mp11::mp_false are not distinguishable by sizeof(),
// so we pass them through these functions to get a type that is.
::boost::parameter::aux::yes_tag to_yesno(::boost::mp11::mp_true);
::boost::parameter::aux::no_tag to_yesno(::boost::mp11::mp_false);
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_CAN_USE_MP11
#endif // include guard
#endif // YESNO_050328_HPP

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

@@ -1,164 +1,106 @@
// 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_BINDING_DWA200558_HPP
#define BOOST_PARAMETER_BINDING_DWA200558_HPP
# define BOOST_PARAMETER_BINDING_DWA200558_HPP
#include <boost/parameter/aux_/void.hpp>
#include <boost/parameter/config.hpp>
# include <boost/mpl/apply.hpp>
# include <boost/mpl/assert.hpp>
# include <boost/mpl/and.hpp>
# include <boost/parameter/aux_/result_of0.hpp>
# include <boost/parameter/aux_/void.hpp>
# include <boost/type_traits/is_same.hpp>
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
#include <boost/mp11/integral.hpp>
#include <boost/mp11/list.hpp>
#include <boost/mp11/utility.hpp>
#include <type_traits>
#else
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/apply_wrap.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>
#endif
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
# include <boost/mpl/eval_if.hpp>
# endif
namespace boost { namespace parameter {
// A metafunction that, given an argument pack, returns the reference type
// of the parameter identified by the given keyword. If no such parameter
// has been specified, returns Default
// A metafunction that, given an argument pack, returns the type of
// the parameter identified by the given keyword. If no such
// parameter has been specified, returns Default
template <typename Parameters, typename Keyword, typename Default>
struct binding0
{
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using type = ::boost::mp11::mp_apply_q<
typename Parameters::binding
, ::boost::mp11::mp_list<Keyword,Default,::boost::mp11::mp_true>
>;
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
template <class Parameters, class Keyword, class Default>
struct binding0
{
typedef typename mpl::apply_wrap3<
typename Parameters::binding,Keyword,Default,mpl::true_
>::type type;
static_assert(
::boost::mp11::mp_if<
::std::is_same<Default,::boost::parameter::void_>
, ::boost::mp11::mp_if<
::std::is_same<type,::boost::parameter::void_>
, ::boost::mp11::mp_false
, ::boost::mp11::mp_true
>
, ::boost::mp11::mp_true
>::value
, "required parameters must not result in void_ type"
);
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
typedef typename ::boost::mpl::apply_wrap3<
typename Parameters::binding
, Keyword
, Default
, ::boost::mpl::true_
>::type type;
BOOST_MPL_ASSERT((
typename ::boost::mpl::eval_if<
::boost::is_same<Default,::boost::parameter::void_>
, ::boost::mpl::if_<
::boost::is_same<type,::boost::parameter::void_>
, ::boost::mpl::false_
, ::boost::mpl::true_
>
, ::boost::mpl::true_
>::type
));
#endif // BOOST_PARAMETER_CAN_USE_MP11
};
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <typename Placeholder, typename Keyword, typename Default>
struct binding1
{
using type = ::boost::mp11::mp_apply_q<
Placeholder
, ::boost::mp11::mp_list<Keyword,Default,::boost::mp11::mp_true>
>;
static_assert(
::boost::mp11::mp_if<
::std::is_same<Default,::boost::parameter::void_>
, ::boost::mp11::mp_if<
::std::is_same<type,::boost::parameter::void_>
, ::boost::mp11::mp_false
, ::boost::mp11::mp_true
>
, ::boost::mp11::mp_true
>::value
, "required parameters must not result in void_ type"
);
};
#endif // BOOST_PARAMETER_CAN_USE_MP11
}} // namespace boost::parameter
#include <boost/parameter/aux_/is_placeholder.hpp>
namespace boost { namespace parameter {
template <
typename Parameters
, typename Keyword
, typename Default = ::boost::parameter::void_
>
struct binding
#if !defined(BOOST_PARAMETER_CAN_USE_MP11)
: ::boost::mpl::eval_if<
::boost::parameter::aux::is_mpl_placeholder<Parameters>
, ::boost::mpl::identity<int>
, ::boost::parameter::binding0<Parameters,Keyword,Default>
BOOST_MPL_ASSERT_NOT((
mpl::and_<
is_same<Default, void_>
, is_same<type, void_>
>
#endif
{
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using type = typename ::boost::mp11::mp_if<
::boost::parameter::aux::is_mpl_placeholder<Parameters>
, ::boost::mp11::mp_identity<int>
, ::boost::mp11::mp_if<
::boost::parameter::aux::is_mp11_placeholder<Parameters>
, ::boost::parameter::binding1<Parameters,Keyword,Default>
, ::boost::parameter::binding0<Parameters,Keyword,Default>
>
>::type;
#endif
};
));
};
# endif
template <class Parameters, class Keyword, class Default = void_>
# if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
struct binding
# else
struct binding_eti
# endif
{
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
typedef typename mpl::eval_if<
mpl::is_placeholder<Parameters>
, mpl::identity<int>
, binding0<Parameters,Keyword,Default>
>::type type;
# else
typedef typename mpl::apply_wrap3<
typename Parameters::binding,Keyword,Default,mpl::true_
>::type type;
BOOST_MPL_ASSERT_NOT((
mpl::and_<
is_same<Default, void_>
, is_same<type, void_>
>
));
# endif
# if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
BOOST_MPL_AUX_LAMBDA_SUPPORT(3,binding,(Parameters,Keyword,Default))
# endif
};
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
template <class Parameters, class Keyword, class Default = void_>
struct binding
{
typedef typename mpl::eval_if<
is_same<Parameters, int>
, mpl::identity<int>
, binding_eti<Parameters, Keyword, Default>
>::type type;
BOOST_MPL_AUX_LAMBDA_SUPPORT(3,binding,(Parameters,Keyword,Default))
};
# endif
// A metafunction that, given an argument pack, returns the type of
// the parameter identified by the given keyword. If no such
// parameter has been specified, returns the type returned by invoking
// DefaultFn
template <class Parameters, class Keyword, class DefaultFn>
struct lazy_binding
{
typedef typename mpl::apply_wrap3<
typename Parameters::binding
, Keyword
, typename aux::result_of0<DefaultFn>::type
, mpl::true_
>::type type;
};
}} // namespace boost::parameter
#include <boost/parameter/aux_/result_of0.hpp>
namespace boost { namespace parameter {
// A metafunction that, given an argument pack, returns the reference type
// of the parameter identified by the given keyword. If no such parameter
// has been specified, returns the type returned by invoking DefaultFn
template <typename Parameters, typename Keyword, typename DefaultFn>
struct lazy_binding
{
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
using type = ::boost::mp11::mp_apply_q<
typename Parameters::binding
, ::boost::mp11::mp_list<
Keyword
, typename ::boost::parameter::aux::result_of0<DefaultFn>::type
, ::boost::mp11::mp_true
>
>;
#else
typedef typename ::boost::mpl::apply_wrap3<
typename Parameters::binding
, Keyword
, typename ::boost::parameter::aux::result_of0<DefaultFn>::type
, ::boost::mpl::true_
>::type type;
#endif // BOOST_PARAMETER_CAN_USE_MP11
};
}} // namespace boost::parameter
#endif // include guard
#endif // BOOST_PARAMETER_BINDING_DWA200558_HPP

View File

@@ -1,210 +0,0 @@
// Copyright Cromwell D. Enage 2019.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_COMPOSE_HPP
#define BOOST_PARAMETER_COMPOSE_HPP
#include <boost/parameter/aux_/arg_list.hpp>
namespace boost { namespace parameter {
inline BOOST_CONSTEXPR ::boost::parameter::aux::empty_arg_list compose()
{
return ::boost::parameter::aux::empty_arg_list();
}
}} // namespace boost::parameter
#include <boost/parameter/config.hpp>
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
namespace boost { namespace parameter { namespace aux {
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
template <typename ...TaggedArgs>
struct compose_arg_list
{
using type = ::boost::parameter::aux::flat_like_arg_list<
::boost::parameter::aux::flat_like_arg_tuple<
typename TaggedArgs::base_type::key_type
, typename TaggedArgs::base_type
>...
>;
};
#else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
template <typename TaggedArg0, typename ...TaggedArgs>
struct compose_arg_list;
template <typename TaggedArg0>
struct compose_arg_list<TaggedArg0>
{
typedef ::boost::parameter::aux::arg_list<TaggedArg0> type;
};
template <typename TaggedArg0, typename ...TaggedArgs>
struct compose_arg_list
{
typedef ::boost::parameter::aux::arg_list<
TaggedArg0
, typename ::boost::parameter::aux
::compose_arg_list<TaggedArgs...>::type
> type;
};
#endif // BOOST_PARAMETER_CAN_USE_MP11
}}} // namespace boost::parameter::aux
#include <boost/parameter/are_tagged_arguments.hpp>
#include <boost/core/enable_if.hpp>
namespace boost { namespace parameter { namespace result_of {
template <typename ...TaggedArgs>
struct compose
: ::boost::lazy_enable_if<
::boost::parameter::are_tagged_arguments<TaggedArgs...>
, ::boost::parameter::aux::compose_arg_list<TaggedArgs...>
>
{
};
template <>
struct compose<>
{
typedef ::boost::parameter::aux::empty_arg_list type;
};
}}} // namespace boost::parameter::result_of
namespace boost { namespace parameter {
template <typename TaggedArg0, typename ...TaggedArgs>
inline BOOST_CONSTEXPR typename ::boost::parameter::result_of
::compose<TaggedArg0,TaggedArgs...>::type
compose(TaggedArg0 const& arg0, TaggedArgs const&... args)
{
return typename ::boost::parameter::aux
::compose_arg_list<TaggedArg0,TaggedArgs...>::type(
::boost::parameter::aux::value_type_is_not_void()
, arg0
, args...
);
}
}} // namespace boost::parameter
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#define BOOST_PARAMETER_compose_arg_list_type_suffix(z, n, suffix) suffix
#include <boost/preprocessor/cat.hpp>
#define BOOST_PARAMETER_compose_arg_list_type_prefix(z, n, prefix) \
::boost::parameter::aux::arg_list<BOOST_PP_CAT(prefix, n)
/**/
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#define BOOST_PARAMETER_compose_arg_list_type(z, n, prefix) \
BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
n, BOOST_PARAMETER_compose_arg_list_type_prefix, prefix \
) BOOST_PP_CAT(BOOST_PP_REPEAT_, z)( \
n, BOOST_PARAMETER_compose_arg_list_type_suffix, > \
)
/**/
#include <boost/parameter/aux_/void.hpp>
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/arithmetic/sub.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
#if defined(BOOST_NO_SFINAE)
#define BOOST_PARAMETER_compose_arg_list_function_overload(z, n, prefix) \
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename prefix)> \
inline BOOST_CONSTEXPR \
BOOST_PARAMETER_compose_arg_list_type(z, n, prefix) \
compose(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, prefix, const& a)) \
{ \
return BOOST_PARAMETER_compose_arg_list_type(z, n, prefix)( \
BOOST_PP_ENUM_PARAMS_Z(z, n, a) \
BOOST_PP_ENUM_TRAILING_PARAMS_Z( \
z \
, BOOST_PP_SUB(BOOST_PARAMETER_COMPOSE_MAX_ARITY, n) \
, ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT \
) \
); \
}
/**/
#else // !defined(BOOST_NO_SFINAE)
#include <boost/parameter/are_tagged_arguments.hpp>
#include <boost/core/enable_if.hpp>
namespace boost { namespace parameter { namespace result_of {
template <
BOOST_PP_ENUM_BINARY_PARAMS(
BOOST_PP_INC(BOOST_PARAMETER_COMPOSE_MAX_ARITY)
, typename TaggedArg
, = void BOOST_PP_INTERCEPT
)
>
struct compose;
template <>
struct compose<>
{
typedef ::boost::parameter::aux::empty_arg_list type;
};
}}} // namespace boost::parameter::result_of
#define BOOST_PARAMETER_compose_arg_list_function_overload(z, n, prefix) \
namespace boost { namespace parameter { namespace result_of { \
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename prefix)> \
struct compose<BOOST_PP_ENUM_PARAMS_Z(z, n, prefix)> \
: ::boost::enable_if< \
::boost::parameter \
::are_tagged_arguments<BOOST_PP_ENUM_PARAMS_Z(z, n, prefix)> \
, BOOST_PARAMETER_compose_arg_list_type(z, n, prefix) \
> \
{ \
}; \
}}} \
namespace boost { namespace parameter { \
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename prefix)> \
inline BOOST_CONSTEXPR typename ::boost::parameter::result_of \
::compose<BOOST_PP_ENUM_PARAMS_Z(z, n, prefix)>::type \
compose(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, prefix, const& a)) \
{ \
return BOOST_PARAMETER_compose_arg_list_type(z, n, prefix)( \
BOOST_PP_ENUM_PARAMS_Z(z, n, a) \
BOOST_PP_ENUM_TRAILING_PARAMS_Z( \
z \
, BOOST_PP_SUB(BOOST_PARAMETER_COMPOSE_MAX_ARITY, n) \
, ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT \
) \
); \
} \
}}
/**/
#endif // BOOST_NO_SFINAE
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
BOOST_PP_REPEAT_FROM_TO(
1
, BOOST_PP_INC(BOOST_PARAMETER_COMPOSE_MAX_ARITY)
, BOOST_PARAMETER_compose_arg_list_function_overload
, TaggedArg
)
#undef BOOST_PARAMETER_compose_arg_list_function_overload
#undef BOOST_PARAMETER_compose_arg_list_type
#undef BOOST_PARAMETER_compose_arg_list_type_prefix
#undef BOOST_PARAMETER_compose_arg_list_type_suffix
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
#endif // include guard

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

@@ -1,83 +1,14 @@
// Copyright Daniel Wallin, David Abrahams 2005.
// Copyright Cromwell D. Enage 2017.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// Copyright Daniel Wallin, David Abrahams 2005. Use, modification and
// distribution is subject to the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_CONFIG_050403_HPP
#define BOOST_PARAMETER_CONFIG_050403_HPP
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
// 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; function template default arguments, 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. Older versions of Clang either fail to compile due to
// differences in length between parameter packs 'Args' and 'args' or fail at
// runtime due to segmentation faults.
// -- Cromwell D. Enage
#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) && \
!defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && \
!BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) && !( \
defined(BOOST_CLANG) && (1 == BOOST_CLANG) && ( \
(__clang_major__ < 3) || ( \
(3 == __clang_major__) && (__clang_minor__ < 2) \
) \
) \
) && !BOOST_WORKAROUND(BOOST_GCC, < 40900)
#define BOOST_PARAMETER_HAS_PERFECT_FORWARDING
#ifndef BOOST_PARAMETER_MAX_ARITY
# define BOOST_PARAMETER_MAX_ARITY 5
#endif
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#if !defined(BOOST_PARAMETER_CAN_USE_MP11) && \
!defined(BOOST_PARAMETER_DISABLE_MP11_USAGE) && \
!defined(BOOST_NO_CXX11_CONSTEXPR) && \
!defined(BOOST_NO_CXX11_DECLTYPE_N3276) && \
!defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && \
!defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && \
!defined(BOOST_NO_CXX11_STATIC_ASSERT) && \
!defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) && \
!defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) && \
!defined(BOOST_NO_CXX11_HDR_TUPLE)
// Boost.MP11 requires C++11. -- Cromwell D. Enage
#define BOOST_PARAMETER_CAN_USE_MP11
#endif
#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
#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 0
#endif
#if !defined(BOOST_PARAMETER_COMPOSE_MAX_ARITY)
#if BOOST_WORKAROUND(BOOST_MSVC, < 1800) || \
BOOST_WORKAROUND(BOOST_GCC, < 60000)
// Some tests cause MSVC-11.0 and earlier to run out of heap space,
// while some other tests cause GCC 5 and earlier to do the same,
// if the value is set any higher. -- Cromwell D. Enage
#define BOOST_PARAMETER_COMPOSE_MAX_ARITY 20
#else
#define BOOST_PARAMETER_COMPOSE_MAX_ARITY 64
#endif
#endif // BOOST_PARAMETER_COMPOSE_MAX_ARITY
#if !defined(BOOST_PARAMETER_MAX_ARITY)
#define BOOST_PARAMETER_MAX_ARITY 8
#endif
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
#endif // include guard
#endif // BOOST_PARAMETER_CONFIG_050403_HPP

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