mirror of
https://github.com/boostorg/parameter.git
synced 2026-01-19 04:22:13 +00:00
Merge with boostorg/parameter
This commit is contained in:
11
.travis.yml
11
.travis.yml
@@ -202,6 +202,17 @@ matrix:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-5.0
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-6.0
|
||||
env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-6.0
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-6.0
|
||||
|
||||
- os: linux
|
||||
compiler: clang++
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
|
||||
|
||||
@@ -187,24 +187,24 @@ id="id39">5 Portability Considerations</a>
|
||||
<li><a class="reference internal" href="#perfect-forwarding-support"
|
||||
id="id40">5.1 Perfect Forwarding Support</a></li>
|
||||
<li><a class="reference internal" href="#no-sfinae-support"
|
||||
id="id41">5.2 No SFINAE Support</a></li>
|
||||
id="id42">5.2 No SFINAE Support</a></li>
|
||||
<li><a class="reference internal" href="#no-support-for-result-of"
|
||||
id="id42">5.3 No Support for
|
||||
id="id43">5.3 No Support for
|
||||
<tt class="docutils literal">result_of</tt></a></li>
|
||||
<li><a class="reference internal"
|
||||
href="#compiler-can-t-see-references-in-unnamed-namespace"
|
||||
id="id43">5.4 Compiler Can't See References In Unnamed
|
||||
id="id44">5.4 Compiler Can't See References In Unnamed
|
||||
Namespace</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#python-binding"
|
||||
id="id44">6 Python Binding</a></li>
|
||||
id="id45">6 Python Binding</a></li>
|
||||
<li><a class="reference internal" href="#reference"
|
||||
id="id45">7 Reference</a></li>
|
||||
id="id46">7 Reference</a></li>
|
||||
<li><a class="reference internal" href="#glossary"
|
||||
id="id46">8 Glossary</a></li>
|
||||
id="id47">8 Glossary</a></li>
|
||||
<li><a class="reference internal" href="#acknowledgements"
|
||||
id="id47">9 Acknowledgements</a></li>
|
||||
id="id48">9 Acknowledgements</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
@@ -849,7 +849,7 @@ prints the arguments:</p>
|
||||
#include <boost/graph/depth_first_search.hpp> // for dfs_visitor
|
||||
|
||||
BOOST_PARAMETER_FUNCTION(
|
||||
(void), depth_first_search, tag
|
||||
(bool), depth_first_search, tag
|
||||
<em>…signature goes here…</em>
|
||||
)
|
||||
{
|
||||
@@ -863,16 +863,20 @@ BOOST_PARAMETER_FUNCTION(
|
||||
std::cout << std::endl;
|
||||
std::cout << "color_map=" << color_map;
|
||||
std::cout << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
char const* g = "1";
|
||||
depth_first_search(1, 2, 3, 4, 5);
|
||||
|
||||
depth_first_search(
|
||||
"1", '2', _color_map = '5',
|
||||
g, '2', _color_map = '5',
|
||||
_index_map = "4", _root_vertex = "3"
|
||||
);
|
||||
return boost::report_errors();
|
||||
}
|
||||
</pre>
|
||||
<p class="compound-last">Despite the fact that default expressions such as <tt
|
||||
@@ -980,14 +984,18 @@ struct vertex_descriptor_predicate
|
||||
{
|
||||
template <typename T, typename Args>
|
||||
struct apply
|
||||
: boost::is_convertible<
|
||||
T
|
||||
, typename boost::graph_traits<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, graphs::graph
|
||||
>::type
|
||||
>::vertex_descriptor
|
||||
: boost::mpl::if_<
|
||||
boost::is_convertible<
|
||||
T
|
||||
, typename boost::graph_traits<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, graphs::graph
|
||||
>::type
|
||||
>::vertex_descriptor
|
||||
>
|
||||
, boost::mpl::true_
|
||||
, boost::mpl::false_
|
||||
>
|
||||
{
|
||||
};
|
||||
@@ -1034,15 +1042,20 @@ struct graph_predicate
|
||||
{
|
||||
template <typename T, typename Args>
|
||||
struct apply
|
||||
: boost::mpl::and_<
|
||||
: boost::mpl::eval_if<
|
||||
boost::is_convertible<
|
||||
typename boost::graph_traits<T>::traversal_category
|
||||
, boost::incidence_graph_tag
|
||||
>
|
||||
, boost::is_convertible<
|
||||
typename boost::graph_traits<T>::traversal_category
|
||||
, boost::vertex_list_graph_tag
|
||||
, boost::mpl::if_<
|
||||
boost::is_convertible<
|
||||
typename boost::graph_traits<T>::traversal_category
|
||||
, boost::vertex_list_graph_tag
|
||||
>
|
||||
, boost::mpl::true_
|
||||
, boost::mpl::false_
|
||||
>
|
||||
, boost::mpl::false_
|
||||
>
|
||||
{
|
||||
};
|
||||
@@ -1052,18 +1065,22 @@ struct index_map_predicate
|
||||
{
|
||||
template <typename T, typename Args>
|
||||
struct apply
|
||||
: boost::mpl::and_<
|
||||
: boost::mpl::eval_if<
|
||||
boost::is_integral<
|
||||
typename boost::property_traits<T>::value_type
|
||||
>
|
||||
, boost::is_same<
|
||||
typename boost::property_traits<T>::key_type
|
||||
, typename boost::graph_traits<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, graphs::graph
|
||||
>::type
|
||||
>::vertex_descriptor
|
||||
, boost::mpl::if_<
|
||||
boost::is_same<
|
||||
typename boost::property_traits<T>::key_type
|
||||
, typename boost::graph_traits<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, graphs::graph
|
||||
>::type
|
||||
>::vertex_descriptor
|
||||
>
|
||||
, boost::mpl::true_
|
||||
, boost::mpl::false_
|
||||
>
|
||||
>
|
||||
{
|
||||
@@ -1074,14 +1091,18 @@ struct color_map_predicate
|
||||
{
|
||||
template <typename T, typename Args>
|
||||
struct apply
|
||||
: boost::is_same<
|
||||
typename boost::property_traits<T>::key_type
|
||||
, typename boost::graph_traits<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, graphs::graph
|
||||
>::type
|
||||
>::vertex_descriptor
|
||||
: boost::mpl::if_<
|
||||
boost::is_same<
|
||||
typename boost::property_traits<T>::key_type
|
||||
, typename boost::graph_traits<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, graphs::graph
|
||||
>::type
|
||||
>::vertex_descriptor
|
||||
>
|
||||
, boost::mpl::true_
|
||||
, boost::mpl::false_
|
||||
>
|
||||
{
|
||||
};
|
||||
@@ -1160,6 +1181,10 @@ BOOST_PARAMETER_NAME((_color_map, graphs) in_out(color_map))
|
||||
{
|
||||
}
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <utility>
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef boost::adjacency_list<
|
||||
@@ -1175,9 +1200,10 @@ int main()
|
||||
|
||||
depth_first_search(g);
|
||||
depth_first_search(g, _root_vertex = static_cast<int>(x));
|
||||
return boost::report_errors();
|
||||
}
|
||||
''') -->
|
||||
<!-- @test('compile') -->
|
||||
<!-- @test('run') -->
|
||||
<p>It usually isn't necessary to so completely encode the type requirements on
|
||||
arguments to generic functions. However, doing so is worth the effort: your
|
||||
code will be more self-documenting and will often provide a better user
|
||||
@@ -1271,33 +1297,42 @@ specify parameter names for those arguments. To generate this interface using
|
||||
enclose the deduced parameters in a
|
||||
<tt class="docutils literal">(deduced …)</tt> clause, as follows:</p>
|
||||
<pre class="literal-block">
|
||||
namespace mpl = boost::mpl;
|
||||
char const*& blank_char_ptr()
|
||||
{
|
||||
static char const* larr = "";
|
||||
return larr;
|
||||
}
|
||||
|
||||
BOOST_PARAMETER_FUNCTION(
|
||||
(void), def, tag,
|
||||
(bool), def, tag,
|
||||
|
||||
(required (name, (char const*)) (func,*) ) // nondeduced
|
||||
|
||||
<strong>(deduced</strong>
|
||||
(optional
|
||||
(docstring, (char const*), "")
|
||||
(docstring, (char const*), blank_char_ptr())
|
||||
|
||||
(keywords
|
||||
// see <a class="footnote-reference"
|
||||
href="#is-keyword-expression" id="id13"><sup>5</sup></a>
|
||||
, *(is_keyword_expression<mpl::_>)
|
||||
, *(is_keyword_expression<boost::mpl::_>)
|
||||
, no_keywords()
|
||||
)
|
||||
|
||||
(policies
|
||||
, *(mpl::not_<
|
||||
mpl::or_<
|
||||
boost::is_convertible<mpl::_, char const*>
|
||||
// see <a class="footnote-reference"
|
||||
, *(
|
||||
boost::mpl::eval_if<
|
||||
boost::is_convertible<boost::mpl::_,char const*>
|
||||
, boost::mpl::false_
|
||||
, boost::mpl::if_<
|
||||
// see <a class="footnote-reference"
|
||||
href="#is-keyword-expression" id="id14"><sup>5</sup></a>
|
||||
, is_keyword_expression<mpl::_>
|
||||
>
|
||||
>)
|
||||
is_keyword_expression<boost::mpl::_>
|
||||
, boost::mpl::false_
|
||||
, boost::mpl::true_
|
||||
>
|
||||
>
|
||||
)
|
||||
, default_call_policies()
|
||||
)
|
||||
)
|
||||
@@ -1307,7 +1342,7 @@ href="#is-keyword-expression" id="id14"><sup>5</sup></a>
|
||||
<em>…</em>
|
||||
}
|
||||
</pre>
|
||||
<!-- @example.replace_emphasis('') -->
|
||||
<!-- @example.replace_emphasis('return false;') -->
|
||||
<!-- @example.prepend('''
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
@@ -1346,6 +1381,11 @@ default_call_policies some_policies;
|
||||
void f()
|
||||
{
|
||||
}
|
||||
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
''') -->
|
||||
<div class="admonition-syntax-note admonition">
|
||||
<p class="first admonition-title">Syntax Note</p>
|
||||
@@ -1358,13 +1398,16 @@ parameters at the outer level.</p>
|
||||
</div>
|
||||
<p>With the declaration above, the following two calls are equivalent:</p>
|
||||
<pre class="literal-block">
|
||||
char const* f_name = "f";
|
||||
def(
|
||||
"f", &f
|
||||
f_name
|
||||
, &f
|
||||
, <strong>some_policies</strong>
|
||||
, <strong>"Documentation for f"</strong>
|
||||
);
|
||||
def(
|
||||
"f", &f
|
||||
f_name
|
||||
, &f
|
||||
, <strong>"Documentation for f"</strong>
|
||||
, <strong>some_policies</strong>
|
||||
);
|
||||
@@ -1379,7 +1422,8 @@ argument that was also, for some reason, convertible to
|
||||
parameter name explicitly, as follows:</p>
|
||||
<pre class="literal-block">
|
||||
def(
|
||||
"f", &f
|
||||
f_name
|
||||
, &f
|
||||
, <strong>_policies = some_policies</strong>
|
||||
, "Documentation for f"
|
||||
);
|
||||
@@ -1416,13 +1460,23 @@ struct callable2
|
||||
std::cout << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
callable2 c2;
|
||||
callable2 const& c2_const = c2;
|
||||
c2_const.call(1, 2);
|
||||
return boost::report_errors();
|
||||
}
|
||||
</pre>
|
||||
<!-- @example.prepend('''
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
using namespace boost::parameter;
|
||||
''') -->
|
||||
<!-- @test('compile') -->
|
||||
<!-- @test('run') -->
|
||||
<p>These macros don't directly allow a function's interface to be
|
||||
separated from its implementation, but you can always forward
|
||||
arguments on to a separate implementation function:</p>
|
||||
@@ -1433,8 +1487,9 @@ struct callable2
|
||||
(void), call, tag, (required (arg1,(int))(arg2,(int)))
|
||||
)
|
||||
{
|
||||
call_impl(arg1,arg2);
|
||||
call_impl(arg1, arg2);
|
||||
}
|
||||
|
||||
private:
|
||||
void call_impl(int, int); // implemented elsewhere.
|
||||
};
|
||||
@@ -1463,13 +1518,22 @@ struct somebody
|
||||
std::cout << arg1 << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
somebody::f();
|
||||
somebody::f(4);
|
||||
return boost::report_errors();
|
||||
}
|
||||
</pre>
|
||||
<!-- @example.prepend('''
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
using namespace boost::parameter;
|
||||
''') -->
|
||||
<!-- @test('compile') -->
|
||||
<!-- @test('run') -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="function-call-ops">
|
||||
@@ -1497,13 +1561,23 @@ struct callable2
|
||||
std::cout << second_arg << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
callable2 c2;
|
||||
callable2 const& c2_const = c2;
|
||||
c2_const(1, 2);
|
||||
return boost::report_errors();
|
||||
}
|
||||
</pre>
|
||||
<!-- @example.prepend('''
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
using namespace boost::parameter;
|
||||
''') -->
|
||||
<!-- @test('compile') -->
|
||||
<!-- @test('run') -->
|
||||
</div>
|
||||
<div class="section" id="parameter-enabled-constructors">
|
||||
<h2><a class="toc-backref" href="#id30">2.4 Parameter-Enabled
|
||||
@@ -1514,8 +1588,8 @@ href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf"
|
||||
>http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf</a>) limits
|
||||
somewhat the quality of interface this library can provide for defining
|
||||
parameter-enabled constructors. The usual workaround for a lack of
|
||||
constructor delegation applies: one must factor the common logic into a base
|
||||
class.</p>
|
||||
constructor delegation applies: one must factor the common logic into one or
|
||||
more base classes.</p>
|
||||
<p>Let's build a parameter-enabled constructor that simply prints its
|
||||
arguments. The first step is to write a base class whose constructor accepts
|
||||
a single argument known as an <a class="reference external"
|
||||
@@ -1570,7 +1644,11 @@ myclass x("bob", 3); // positional
|
||||
myclass y(_index = 12, _name = "sally"); // named
|
||||
myclass z("june"); // positional/defaulted
|
||||
</pre>
|
||||
<!-- @example.wrap('int main() {', '}') -->
|
||||
<!-- @example.wrap('''
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main() {
|
||||
''', ' return boost::report_errors(); }') -->
|
||||
<!-- @test('run', howmany='all') -->
|
||||
<p>For more on <span class="concept">ArgumentPack</span> manipulation, see the
|
||||
<a class="reference internal" href="#advanced-topics">Advanced Topics</a>
|
||||
@@ -2010,8 +2088,7 @@ BOOST_PARAMETER_NAME(
|
||||
<strong>(</strong>
|
||||
<em>object-name</em>
|
||||
<strong>,</strong> <em>tag-namespace</em>
|
||||
<strong>)</strong>
|
||||
<em>parameter-name</em>
|
||||
<strong>)</strong> <em>parameter-name</em>
|
||||
)
|
||||
</pre>
|
||||
<!-- @ignore() -->
|
||||
@@ -2544,15 +2621,15 @@ aware of the following issues and workarounds for particular compilers.</p>
|
||||
Forwarding Support</a></h2>
|
||||
<p>If your compiler supports <a class="reference external" href=
|
||||
"http://www.justsoftwaresolutions.co.uk/cplusplus/rvalue_references_and_perfect_forwarding.html"
|
||||
>perfect forwarding</a>, then the Parameter library will
|
||||
<tt class="docutils literal">#define</tt> the macro
|
||||
<a class="reference external"
|
||||
>perfect forwarding</a>, then the Parameter library will <tt
|
||||
class="docutils literal">#define</tt> the macro <a class="reference external"
|
||||
href="reference.html#boost-parameter-has-perfect-forwarding"
|
||||
><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a>
|
||||
unless you disable it manually. If your compiler does not provide this
|
||||
support, then <tt class="docutils literal"
|
||||
>parameter::parameters::operator()</tt> will treat rvalue references as lvalue
|
||||
const references to work around the <a class="reference external"
|
||||
<tt class="docutils literal">const</tt> references to work around the
|
||||
<a class="reference external"
|
||||
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1385.htm"
|
||||
>forwarding problem</a>, so in certain cases you must wrap
|
||||
<a class="reference external" href="../../../core/doc/html/core/ref.html"
|
||||
@@ -2568,7 +2645,7 @@ href="../../test/preprocessor_eval_category.cpp"
|
||||
support.</p>
|
||||
</div>
|
||||
<div class="section" id="no-sfinae-support">
|
||||
<h2><a class="toc-backref" href="#id41">5.2 No SFINAE
|
||||
<h2><a class="toc-backref" href="#id42">5.2 No SFINAE
|
||||
Support</a></h2>
|
||||
<p>Some older compilers don't support SFINAE. If your compiler meets
|
||||
that criterion, then Boost headers will
|
||||
@@ -2578,7 +2655,7 @@ functions won't be removed from the overload set based on their
|
||||
signatures.</p>
|
||||
</div>
|
||||
<div class="section" id="no-support-for-result-of">
|
||||
<h2><a class="toc-backref" href="#id42">5.3 No Support
|
||||
<h2><a class="toc-backref" href="#id43">5.3 No Support
|
||||
for</a> <a class="reference external"
|
||||
href="../../../utility/utility.htm#result_of"
|
||||
><tt class="docutils literal">result_of</tt></a></h2>
|
||||
@@ -2626,7 +2703,7 @@ are unspecified, the workaround is to use
|
||||
.. |BOOST_PARAMETER_MATCH| replace:: ``BOOST_PARAMETER_MATCH`` -->
|
||||
</div>
|
||||
<div class="section" id="compiler-can-t-see-references-in-unnamed-namespace">
|
||||
<h2><a class="toc-backref" href="#id43">5.3 Compiler Can't
|
||||
<h2><a class="toc-backref" href="#id44">5.4 Compiler Can't
|
||||
See References In Unnamed Namespace</a></h2>
|
||||
<p>If you use Microsoft Visual C++ 6.x, you may find that the compiler has
|
||||
trouble finding your keyword objects. This problem has been observed, but
|
||||
@@ -2647,7 +2724,7 @@ namespace graphs {
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="python-binding">
|
||||
<h1><a class="toc-backref" href="#id44">6 Python
|
||||
<h1><a class="toc-backref" href="#id45">6 Python
|
||||
Binding</a></h1>
|
||||
<p>Follow <a class="reference external"
|
||||
href="../../../parameter_python/doc/html/index.html">this link</a> for
|
||||
@@ -2656,12 +2733,12 @@ with <a class="reference external" href="../../../python/doc/index.html"
|
||||
>Boost.Python</a>.</p>
|
||||
</div>
|
||||
<div class="section" id="reference">
|
||||
<h1><a class="toc-backref" href="#id45">7 Reference</a></h1>
|
||||
<h1><a class="toc-backref" href="#id46">7 Reference</a></h1>
|
||||
<p>Follow <a class="reference external" href="reference.html">this link</a> to
|
||||
the Boost.Parameter reference documentation.</p>
|
||||
</div>
|
||||
<div class="section" id="glossary">
|
||||
<h1><a class="toc-backref" href="#id46">8 Glossary</a></h1>
|
||||
<h1><a class="toc-backref" href="#id47">8 Glossary</a></h1>
|
||||
<table class="docutils field-list" frame="void" id="arguments" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
@@ -2702,7 +2779,7 @@ int y = f(3);
|
||||
</table>
|
||||
</div>
|
||||
<div class="section" id="acknowledgements">
|
||||
<h1><a class="toc-backref" href="#id47"
|
||||
<h1><a class="toc-backref" href="#id48"
|
||||
>9 Acknowledgements</a></h1>
|
||||
<p>The authors would like to thank all the Boosters who participated in the
|
||||
review of this library and its documentation, most especially our review
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
212
doc/index.rst
212
doc/index.rst
@@ -765,7 +765,7 @@ that prints the arguments:
|
||||
#include <boost/graph/depth_first_search.hpp> // for dfs_visitor
|
||||
|
||||
BOOST_PARAMETER_FUNCTION(
|
||||
(void), depth_first_search, tag
|
||||
(bool), depth_first_search, tag
|
||||
*…signature goes here…*
|
||||
)
|
||||
{
|
||||
@@ -779,16 +779,20 @@ that prints the arguments:
|
||||
std::cout << std::endl;
|
||||
std::cout << "color_map=" << color_map;
|
||||
std::cout << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
char const\* g = "1";
|
||||
depth_first_search(1, 2, 3, 4, 5);
|
||||
|
||||
depth_first_search(
|
||||
"1", '2', _color_map = '5',
|
||||
g, '2', _color_map = '5',
|
||||
_index_map = "4", _root_vertex = "3"
|
||||
);
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
Despite the fact that default expressions such as ``vertices(graph).first``
|
||||
@@ -815,7 +819,7 @@ and each one will print exactly the same thing.
|
||||
(color_map, \*)
|
||||
)
|
||||
''')
|
||||
.. @test('compile')
|
||||
.. @test('run')
|
||||
|
||||
Signature Matching and Overloading
|
||||
----------------------------------
|
||||
@@ -893,14 +897,18 @@ __ `parameter table`_
|
||||
{
|
||||
template <typename T, typename Args>
|
||||
struct apply
|
||||
: boost::is_convertible<
|
||||
T
|
||||
, typename boost::graph_traits<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, graphs::graph
|
||||
>::type
|
||||
>::vertex_descriptor
|
||||
: boost::mpl::if_<
|
||||
boost::is_convertible<
|
||||
T
|
||||
, typename boost::graph_traits<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, graphs::graph
|
||||
>::type
|
||||
>::vertex_descriptor
|
||||
>
|
||||
, boost::mpl::true_
|
||||
, boost::mpl::false_
|
||||
>
|
||||
{
|
||||
};
|
||||
@@ -949,14 +957,18 @@ classes provide the necessary checks.
|
||||
{
|
||||
template <typename T, typename Args>
|
||||
struct apply
|
||||
: boost::mpl::and_<
|
||||
: boost::mpl::eval_if<
|
||||
boost::is_convertible<
|
||||
typename boost::graph_traits<T>::traversal_category
|
||||
, boost::incidence_graph_tag
|
||||
>
|
||||
, boost::is_convertible<
|
||||
typename boost::graph_traits<T>::traversal_category
|
||||
, boost::vertex_list_graph_tag
|
||||
, boost::mpl::if_<
|
||||
boost::is_convertible<
|
||||
typename boost::graph_traits<T>::traversal_category
|
||||
, boost::vertex_list_graph_tag
|
||||
>
|
||||
, boost::mpl::true_
|
||||
, boost::mpl::false_
|
||||
>
|
||||
>
|
||||
{
|
||||
@@ -967,18 +979,22 @@ classes provide the necessary checks.
|
||||
{
|
||||
template <typename T, typename Args>
|
||||
struct apply
|
||||
: boost::mpl::and_<
|
||||
: boost::mpl::eval_if<
|
||||
boost::is_integral<
|
||||
typename boost::property_traits<T>::value_type
|
||||
>
|
||||
, boost::is_same<
|
||||
typename boost::property_traits<T>::key_type
|
||||
, typename boost::graph_traits<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, graphs::graph
|
||||
>::type
|
||||
>::vertex_descriptor
|
||||
, boost::mpl::if_<
|
||||
boost::is_same<
|
||||
typename boost::property_traits<T>::key_type
|
||||
, typename boost::graph_traits<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, graphs::graph
|
||||
>::type
|
||||
>::vertex_descriptor
|
||||
>
|
||||
, boost::mpl::true_
|
||||
, boost::mpl::false_
|
||||
>
|
||||
>
|
||||
{
|
||||
@@ -989,14 +1005,18 @@ classes provide the necessary checks.
|
||||
{
|
||||
template <typename T, typename Args>
|
||||
struct apply
|
||||
: boost::is_same<
|
||||
typename boost::property_traits<T>::key_type
|
||||
, typename boost::graph_traits<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, graphs::graph
|
||||
>::type
|
||||
>::vertex_descriptor
|
||||
: boost::mpl::if_<
|
||||
boost::is_same<
|
||||
typename boost::property_traits<T>::key_type
|
||||
, typename boost::graph_traits<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, graphs::graph
|
||||
>::type
|
||||
>::vertex_descriptor
|
||||
>
|
||||
, boost::mpl::true_
|
||||
, boost::mpl::false_
|
||||
>
|
||||
{
|
||||
};
|
||||
@@ -1080,6 +1100,10 @@ by an asterix*, as follows:
|
||||
{
|
||||
}
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <utility>
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef boost::adjacency_list<
|
||||
@@ -1095,11 +1119,11 @@ by an asterix*, as follows:
|
||||
|
||||
depth_first_search(g);
|
||||
depth_first_search(g, _root_vertex = static_cast<int>(x));
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
''')
|
||||
|
||||
.. @test('compile')
|
||||
.. @test('run')
|
||||
|
||||
It usually isn't necessary to so completely encode the type requirements on
|
||||
arguments to generic functions. However, doing so is worth the effort: your
|
||||
@@ -1203,10 +1227,14 @@ follows:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
namespace mpl = boost::mpl;
|
||||
char const*& blank_char_ptr()
|
||||
{
|
||||
static char const* larr = "";
|
||||
return larr;
|
||||
}
|
||||
|
||||
BOOST_PARAMETER_FUNCTION(
|
||||
(void), def, tag,
|
||||
(bool), def, tag,
|
||||
|
||||
(required (name, (char const\*)) (func,\*) ) // nondeduced
|
||||
|
||||
@@ -1216,18 +1244,23 @@ follows:
|
||||
|
||||
(keywords
|
||||
// see [#is_keyword_expression]_
|
||||
, \*(is_keyword_expression<mpl::_>)
|
||||
, \*(is_keyword_expression<boost::mpl::_>)
|
||||
, no_keywords()
|
||||
)
|
||||
|
||||
(policies
|
||||
, \*(mpl::not_<
|
||||
mpl::or_<
|
||||
boost::is_convertible<mpl::_, char const\*>
|
||||
// see [#is_keyword_expression]_
|
||||
, is_keyword_expression<mpl::_>
|
||||
, \*(
|
||||
boost::mpl::eval_if<
|
||||
boost::is_convertible<boost::mpl::_,char const\*>
|
||||
, boost::mpl::false_
|
||||
, boost::mpl::if_<
|
||||
// see [#is_keyword_expression]_
|
||||
is_keyword_expression<boost::mpl::_>
|
||||
, boost::mpl::false_
|
||||
, boost::mpl::true_
|
||||
>
|
||||
>
|
||||
>)
|
||||
)
|
||||
, default_call_policies()
|
||||
)
|
||||
)
|
||||
@@ -1237,7 +1270,7 @@ follows:
|
||||
*…*
|
||||
}
|
||||
|
||||
.. @example.replace_emphasis('')
|
||||
.. @example.replace_emphasis('return true;')
|
||||
|
||||
.. @example.prepend('''
|
||||
#include <boost/parameter.hpp>
|
||||
@@ -1278,6 +1311,11 @@ follows:
|
||||
{
|
||||
}
|
||||
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
''')
|
||||
|
||||
.. Admonition:: Syntax Note
|
||||
@@ -1290,8 +1328,19 @@ With the declaration above, the following two calls are equivalent:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
def("f", &f, **some_policies**, **"Documentation for f"**);
|
||||
def("f", &f, **"Documentation for f"**, **some_policies**);
|
||||
char const\* f_name = "f";
|
||||
def(
|
||||
f_name
|
||||
, &f
|
||||
, **some_policies**
|
||||
, **"Documentation for f"**
|
||||
);
|
||||
def(
|
||||
f_name
|
||||
, &f
|
||||
, **"Documentation for f"**
|
||||
, **some_policies**
|
||||
);
|
||||
|
||||
.. @example.prepend('''
|
||||
int main()
|
||||
@@ -1305,8 +1354,10 @@ name explicitly, as follows:
|
||||
.. parsed-literal::
|
||||
|
||||
def(
|
||||
"f", &f
|
||||
, **_policies = some_policies**, "Documentation for f"
|
||||
f_name
|
||||
, &f
|
||||
, **_policies = some_policies**
|
||||
, "Documentation for f"
|
||||
);
|
||||
|
||||
.. @example.append('}')
|
||||
@@ -1346,13 +1397,23 @@ the body of a class::
|
||||
}
|
||||
};
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
callable2 c2;
|
||||
callable2 const& c2_const = c2;
|
||||
c2_const.call(1, 2);
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
.. @example.prepend('''
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
using namespace boost::parameter;
|
||||
''')
|
||||
|
||||
.. @test('compile')
|
||||
.. @test('run')
|
||||
|
||||
These macros don't directly allow a function's interface to be separated from
|
||||
its implementation, but you can always forward arguments on to a separate
|
||||
@@ -1364,7 +1425,7 @@ implementation function::
|
||||
(void), call, tag, (required (arg1,(int))(arg2,(int)))
|
||||
)
|
||||
{
|
||||
call_impl(arg1,arg2);
|
||||
call_impl(arg1, arg2);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -1401,13 +1462,22 @@ before the function name:
|
||||
}
|
||||
};
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
somebody::f();
|
||||
somebody::f(4);
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
.. @example.prepend('''
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
using namespace boost::parameter;
|
||||
''')
|
||||
|
||||
.. @test('compile')
|
||||
.. @test('run')
|
||||
|
||||
-----------------------------------------
|
||||
Parameter-Enabled Function Call Operators
|
||||
@@ -1434,13 +1504,23 @@ function objects::
|
||||
}
|
||||
};
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
callable2 c2;
|
||||
callable2 const& c2_const = c2;
|
||||
c2_const(1, 2);
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
.. @example.prepend('''
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
using namespace boost::parameter;
|
||||
''')
|
||||
|
||||
.. @test('compile')
|
||||
.. @test('run')
|
||||
|
||||
------------------------------
|
||||
Parameter-Enabled Constructors
|
||||
@@ -1451,7 +1531,7 @@ The lack of a “delegating constructor” feature in C++
|
||||
limits somewhat the quality of interface this library can provide
|
||||
for defining parameter-enabled constructors. The usual workaround
|
||||
for a lack of constructor delegation applies: one must factor the
|
||||
common logic into a base class.
|
||||
common logic into one or more base classes.
|
||||
|
||||
Let's build a parameter-enabled constructor that simply prints its
|
||||
arguments. The first step is to write a base class whose
|
||||
@@ -1501,7 +1581,11 @@ only ``name`` is required. We can exercise our new interface as follows::
|
||||
myclass y(_index = 12, _name = "sally"); // named
|
||||
myclass z("june"); // positional/defaulted
|
||||
|
||||
.. @example.wrap('int main() {', ' return 0; }')
|
||||
.. @example.wrap('''
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main() {
|
||||
''', ' return boost::report_errors(); }')
|
||||
.. @test('run', howmany='all')
|
||||
|
||||
For more on |ArgumentPack| manipulation, see the `Advanced Topics`_ section.
|
||||
@@ -2014,7 +2098,8 @@ The simplest |ArgumentPack| is the result of assigning into a keyword object::
|
||||
template <typename ArgumentPack>
|
||||
int print_index(ArgumentPack const& args)
|
||||
{
|
||||
std::cout << "index = " << args[_index] << std::endl;
|
||||
std::cout << "index = " << args[_index];
|
||||
std::cout << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2034,7 +2119,8 @@ arguments to ``print_name_and_index``::
|
||||
template <typename ArgumentPack>
|
||||
int print_name_and_index(ArgumentPack const& args)
|
||||
{
|
||||
std::cout << "name = " << args[_name] << "; ";
|
||||
std::cout << "name = " << args[_name];
|
||||
std::cout << "; ";
|
||||
return print_index(args);
|
||||
}
|
||||
|
||||
@@ -2501,7 +2587,7 @@ the Parameter library to see how it fares on your favorite
|
||||
compiler. Additionally, you may need to be aware of the following
|
||||
issues and workarounds for particular compilers.
|
||||
|
||||
.. _`regression test results`: http://www.boost.org/regression/release/user/parameter.html
|
||||
.. _`regression test results`: http\://www.boost.org/regression/release/user/parameter.html
|
||||
|
||||
--------------------------
|
||||
Perfect Forwarding Support
|
||||
@@ -2511,13 +2597,13 @@ If your compiler supports `perfect forwarding`_, then the Parameter library
|
||||
will ``#define`` the macro ``BOOST_PARAMETER_HAS_PERFECT_FORWARDING`` unless
|
||||
you disable it manually. If your compiler does not provide this support, then
|
||||
``parameter::parameters::operator()`` will treat rvalue references as lvalue
|
||||
const references to work around the `forwarding problem`_, so in certain cases
|
||||
you must wrap |boost_ref|_ or |std_ref|_ around any arguments that will be
|
||||
bound to out parameters. The |evaluate_category|_ and
|
||||
``const`` references to work around the `forwarding problem`_, so in certain
|
||||
cases you must wrap |boost_ref|_ or |std_ref|_ around any arguments that will
|
||||
be bound to out parameters. The |evaluate_category|_ and
|
||||
|preprocessor_eval_category|_ test programs demonstrate this support.
|
||||
|
||||
.. _`perfect forwarding`: http://www.justsoftwaresolutions.co.uk/cplusplus/rvalue_references_and_perfect_forwarding.html
|
||||
.. _`forwarding problem`: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1385.htm
|
||||
.. _`perfect forwarding`: http\://www.justsoftwaresolutions.co.uk/cplusplus/rvalue_references_and_perfect_forwarding.html
|
||||
.. _`forwarding problem`: http\://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1385.htm
|
||||
.. |boost_ref| replace:: ``boost\:\:ref``
|
||||
.. _boost_ref: ../../../core/doc/html/core/ref.html
|
||||
.. |std_ref| replace:: ``std\:\:ref``
|
||||
|
||||
5846
doc/reference.rst
5846
doc/reference.rst
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@
|
||||
#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>
|
||||
@@ -21,7 +22,9 @@
|
||||
#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
|
||||
|
||||
|
||||
125
include/boost/parameter/are_tagged_arguments.hpp
Normal file
125
include/boost/parameter/are_tagged_arguments.hpp
Normal file
@@ -0,0 +1,125 @@
|
||||
// Copyright Cromwell D. Enage 2018.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_HPP
|
||||
#define BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_HPP
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
template <typename TaggedArg0, typename ...TaggedArgs>
|
||||
struct are_tagged_arguments;
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#include <boost/parameter/aux_/is_tagged_argument.hpp>
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
template <typename TaggedArg0>
|
||||
struct are_tagged_arguments<TaggedArg0>
|
||||
: ::boost::parameter::aux::is_tagged_argument<TaggedArg0>
|
||||
{
|
||||
};
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
template <typename TaggedArg0, typename ...TaggedArgs>
|
||||
struct are_tagged_arguments
|
||||
: ::boost::mpl::if_<
|
||||
::boost::parameter::aux::is_tagged_argument<TaggedArg0>
|
||||
, ::boost::parameter::are_tagged_arguments<TaggedArgs...>
|
||||
, ::boost::mpl::false_
|
||||
>::type
|
||||
{
|
||||
};
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
|
||||
#define BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_END_Z(z, n, false_t) , false_t>
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/is_tagged_argument.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_BEGIN_Z(z, n, prefix) \
|
||||
::boost::mpl::eval_if< \
|
||||
::boost::parameter::aux::is_tagged_argument<BOOST_PP_CAT(prefix, n)>,
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
|
||||
#define BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_OVERLOADS_Z(z, n, prefix) \
|
||||
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename prefix)> \
|
||||
struct are_tagged_arguments< \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, n, prefix) \
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS_Z( \
|
||||
z \
|
||||
, BOOST_PP_SUB(BOOST_PARAMETER_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_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_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
|
||||
|
||||
@@ -144,6 +144,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/tti/detail/dnullptr.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
@@ -153,9 +154,13 @@ namespace boost { namespace parameter { namespace aux {
|
||||
template <
|
||||
typename TaggedArg
|
||||
, typename Next = ::boost::parameter::aux::empty_arg_list
|
||||
, typename EmitsErrors = ::boost::mpl::true_
|
||||
>
|
||||
struct arg_list : Next
|
||||
class arg_list : public Next
|
||||
{
|
||||
TaggedArg arg; // Stores the argument
|
||||
|
||||
public:
|
||||
typedef TaggedArg tagged_arg;
|
||||
typedef ::boost::parameter::aux::arg_list<TaggedArg,Next> self;
|
||||
typedef typename TaggedArg::key_type key_type;
|
||||
@@ -176,8 +181,6 @@ namespace boost { namespace parameter { namespace aux {
|
||||
, typename TaggedArg::value_type
|
||||
>::type value_type;
|
||||
|
||||
TaggedArg arg; // Stores the argument
|
||||
|
||||
// Create a new list by prepending arg to a copy of tail. Used when
|
||||
// incrementally building this structure with the comma operator.
|
||||
inline arg_list(TaggedArg const& head, Next const& tail)
|
||||
@@ -276,16 +279,22 @@ namespace boost { namespace parameter { namespace aux {
|
||||
static ::boost::parameter::aux::yes_tag has_key(key_type*);
|
||||
using Next::has_key;
|
||||
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
private:
|
||||
typedef ::boost::mpl::bool_<
|
||||
sizeof(
|
||||
Next::has_key(
|
||||
static_cast<key_type*>(BOOST_TTI_DETAIL_NULLPTR)
|
||||
)
|
||||
) == sizeof(::boost::parameter::aux::no_tag)
|
||||
> _has_unique_key;
|
||||
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
!(EmitsErrors::value) || (_has_unique_key::value)
|
||||
, duplicate_keyword
|
||||
, (key_type)
|
||||
);
|
||||
|
||||
public:
|
||||
//
|
||||
// Begin implementation of indexing operators
|
||||
// for looking up specific arguments by name.
|
||||
@@ -356,11 +365,18 @@ namespace boost { namespace parameter { namespace aux {
|
||||
// satisfied by TaggedArg. Used only for compile-time computation
|
||||
// and never really called, so a declaration is enough.
|
||||
template <typename HasDefault, typename Predicate, typename ArgPack>
|
||||
static typename ::boost::mpl::apply_wrap2<
|
||||
::boost::parameter::aux
|
||||
::augment_predicate<Predicate,reference,key_type>
|
||||
, value_type
|
||||
, ArgPack
|
||||
static typename ::boost::lazy_enable_if<
|
||||
typename ::boost::mpl::if_<
|
||||
EmitsErrors
|
||||
, ::boost::mpl::true_
|
||||
, _has_unique_key
|
||||
>::type
|
||||
, ::boost::mpl::apply_wrap2<
|
||||
::boost::parameter::aux
|
||||
::augment_predicate<Predicate,reference,key_type>
|
||||
, value_type
|
||||
, ArgPack
|
||||
>
|
||||
>::type
|
||||
satisfies(
|
||||
::boost::parameter::aux::parameter_requirements<
|
||||
@@ -524,6 +540,10 @@ namespace boost { namespace parameter { namespace aux {
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#endif
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#include <boost/tti/detail/dnullptr.hpp>
|
||||
#endif
|
||||
@@ -535,9 +555,13 @@ namespace boost { namespace parameter { namespace aux {
|
||||
template <
|
||||
typename TaggedArg
|
||||
, typename Next = ::boost::parameter::aux::empty_arg_list
|
||||
, typename EmitsErrors = ::boost::mpl::true_
|
||||
>
|
||||
struct arg_list : Next
|
||||
class arg_list : public Next
|
||||
{
|
||||
TaggedArg arg; // Stores the argument
|
||||
|
||||
public:
|
||||
typedef TaggedArg tagged_arg;
|
||||
typedef ::boost::parameter::aux::arg_list<TaggedArg,Next> self;
|
||||
typedef typename TaggedArg::key_type key_type;
|
||||
@@ -558,8 +582,6 @@ namespace boost { namespace parameter { namespace aux {
|
||||
, typename TaggedArg::value_type
|
||||
>::type value_type;
|
||||
|
||||
TaggedArg arg; // Stores the argument
|
||||
|
||||
// Create a new list by prepending arg to a copy of tail. Used when
|
||||
// incrementally building this structure with the comma operator.
|
||||
inline arg_list(TaggedArg const& head, Next const& tail)
|
||||
@@ -613,6 +635,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
static ::boost::parameter::aux::yes_tag has_key(key_type*);
|
||||
using Next::has_key;
|
||||
|
||||
#if defined(BOOST_NO_SFINAE) || BOOST_WORKAROUND(BOOST_MSVC, < 1800)
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
sizeof(
|
||||
Next::has_key(
|
||||
@@ -622,8 +645,25 @@ namespace boost { namespace parameter { namespace aux {
|
||||
, duplicate_keyword
|
||||
, (key_type)
|
||||
);
|
||||
#endif
|
||||
#else
|
||||
private:
|
||||
typedef ::boost::mpl::bool_<
|
||||
sizeof(
|
||||
Next::has_key(
|
||||
static_cast<key_type*>(BOOST_TTI_DETAIL_NULLPTR)
|
||||
)
|
||||
) == sizeof(::boost::parameter::aux::no_tag)
|
||||
> _has_unique_key;
|
||||
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
!(EmitsErrors::value) || (_has_unique_key::value)
|
||||
, duplicate_keyword
|
||||
, (key_type)
|
||||
);
|
||||
#endif
|
||||
#endif // Borland workarounds not needed.
|
||||
|
||||
public:
|
||||
//
|
||||
// Begin implementation of indexing operators
|
||||
// for looking up specific arguments by name.
|
||||
@@ -786,11 +826,23 @@ namespace boost { namespace parameter { namespace aux {
|
||||
// satisfied by TaggedArg. Used only for compile-time computation
|
||||
// and never really called, so a declaration is enough.
|
||||
template <typename HasDefault, typename Predicate, typename ArgPack>
|
||||
static typename ::boost::mpl::apply_wrap2<
|
||||
::boost::parameter::aux
|
||||
::augment_predicate<Predicate,reference,key_type>
|
||||
, value_type
|
||||
, ArgPack
|
||||
static typename
|
||||
#if !defined(BOOST_NO_SFINAE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
|
||||
::boost::lazy_enable_if<
|
||||
typename ::boost::mpl::if_<
|
||||
EmitsErrors
|
||||
, ::boost::mpl::true_
|
||||
, _has_unique_key
|
||||
>::type,
|
||||
#endif
|
||||
::boost::mpl::apply_wrap2<
|
||||
::boost::parameter::aux
|
||||
::augment_predicate<Predicate,reference,key_type>
|
||||
, value_type
|
||||
, ArgPack
|
||||
#if !defined(BOOST_NO_SFINAE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
|
||||
>
|
||||
#endif
|
||||
>::type
|
||||
satisfies(
|
||||
::boost::parameter::aux::parameter_requirements<
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
, typename DeducedArgs
|
||||
, typename UsedArgs
|
||||
, typename TagFn
|
||||
, typename EmitsErrors
|
||||
>
|
||||
struct deduce_tag;
|
||||
}}} // namespace boost::parameter::aux
|
||||
@@ -38,45 +39,53 @@ namespace boost { namespace parameter { namespace aux {
|
||||
, typename DeducedArgs
|
||||
, typename UsedArgs
|
||||
, typename TagFn
|
||||
, typename EmitsErrors
|
||||
>
|
||||
struct deduce_tag0
|
||||
class deduce_tag0
|
||||
{
|
||||
typedef typename DeducedArgs::spec spec;
|
||||
typedef typename DeducedArgs::spec _spec;
|
||||
|
||||
typedef typename ::boost::mpl::apply_wrap2<
|
||||
typename ::boost::mpl::lambda<
|
||||
typename spec::predicate
|
||||
typename _spec::predicate
|
||||
, ::boost::parameter::aux::lambda_tag
|
||||
>::type
|
||||
, Argument
|
||||
, ArgumentPack
|
||||
>::type condition;
|
||||
>::type _condition;
|
||||
|
||||
// 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
|
||||
, typename ::boost::parameter::aux::tag_type<_spec>::type
|
||||
>::type
|
||||
, ::boost::mpl::if_<
|
||||
condition
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::mpl::eval_if<
|
||||
_condition
|
||||
, ::boost::mpl::if_<
|
||||
EmitsErrors
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::mpl::true_
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
>
|
||||
, ::boost::mpl::true_
|
||||
>::type
|
||||
));
|
||||
|
||||
public:
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
condition
|
||||
, ::boost::parameter::aux::tag_deduced<UsedArgs,spec,Argument,TagFn>
|
||||
_condition
|
||||
, ::boost::parameter::aux
|
||||
::tag_deduced<UsedArgs,_spec,Argument,TagFn>
|
||||
, ::boost::parameter::aux::deduce_tag<
|
||||
Argument
|
||||
, ArgumentPack
|
||||
, typename DeducedArgs::tail
|
||||
, UsedArgs
|
||||
, TagFn
|
||||
, EmitsErrors
|
||||
>
|
||||
>::type type;
|
||||
};
|
||||
@@ -108,6 +117,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
, typename DeducedArgs
|
||||
, typename UsedArgs
|
||||
, typename TagFn
|
||||
, typename EmitsErrors
|
||||
>
|
||||
struct deduce_tag
|
||||
: ::boost::mpl::eval_if<
|
||||
@@ -119,6 +129,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
, DeducedArgs
|
||||
, UsedArgs
|
||||
, TagFn
|
||||
, EmitsErrors
|
||||
>
|
||||
>
|
||||
{
|
||||
|
||||
@@ -12,10 +12,11 @@ namespace boost { namespace parameter { namespace aux {
|
||||
typename List
|
||||
, typename DeducedArgs
|
||||
, typename TagFn
|
||||
, typename Positional
|
||||
, typename IsPositional
|
||||
, typename UsedArgs
|
||||
, typename ArgumentPack
|
||||
, typename Error
|
||||
, typename EmitsErrors
|
||||
>
|
||||
struct make_arg_list_aux;
|
||||
}}} // namespace boost::parameter::aux
|
||||
@@ -47,117 +48,126 @@ namespace boost { namespace parameter { namespace aux {
|
||||
typename List
|
||||
, typename DeducedArgs
|
||||
, typename TagFn
|
||||
, typename Positional
|
||||
, typename IsPositional
|
||||
, typename UsedArgs
|
||||
, typename ArgumentPack
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
, typename argument
|
||||
, typename _argument
|
||||
#endif
|
||||
, typename Error
|
||||
, typename EmitsErrors
|
||||
>
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
struct make_arg_list00
|
||||
class make_arg_list00
|
||||
#else
|
||||
struct make_arg_list0
|
||||
class make_arg_list0
|
||||
#endif
|
||||
{
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
typedef typename List::arg argument;
|
||||
typedef typename List::arg _argument;
|
||||
#endif
|
||||
typedef typename ::boost::remove_const<
|
||||
typename ::boost::remove_reference<argument>::type
|
||||
>::type arg_type;
|
||||
typedef typename List::spec parameter_spec;
|
||||
typename ::boost::remove_reference<_argument>::type
|
||||
>::type _arg_type;
|
||||
typedef typename List::spec _parameter_spec;
|
||||
typedef typename ::boost::parameter::aux
|
||||
::tag_type<parameter_spec>::type tag_;
|
||||
::tag_type<_parameter_spec>::type _tag;
|
||||
typedef ::boost::parameter::aux
|
||||
::is_named_argument<argument> is_tagged;
|
||||
::is_named_argument<_argument> _is_tagged;
|
||||
|
||||
// If this argument is either explicitly tagged or a deduced
|
||||
// parameter, then turn off positional matching.
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
Positional
|
||||
IsPositional
|
||||
, ::boost::mpl::eval_if<
|
||||
::boost::parameter::aux::is_deduced<parameter_spec>
|
||||
::boost::parameter::aux::is_deduced<_parameter_spec>
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::mpl::if_<
|
||||
is_tagged
|
||||
_is_tagged
|
||||
, ::boost::mpl::false_
|
||||
, ::boost::mpl::true_
|
||||
>
|
||||
>
|
||||
, ::boost::mpl::false_
|
||||
>::type positional;
|
||||
>::type _is_positional;
|
||||
|
||||
// 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.
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
is_tagged
|
||||
, ::boost::parameter::aux::insert_tagged<UsedArgs,arg_type>
|
||||
_is_tagged
|
||||
, ::boost::parameter::aux::insert_tagged<UsedArgs,_arg_type>
|
||||
, ::boost::mpl::identity<UsedArgs>
|
||||
>::type used_args;
|
||||
>::type _used_args;
|
||||
|
||||
// If this parameter is neither explicitly tagged nor positionally
|
||||
// matched, then deduce the tag from the deduced parameter specs.
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
typename ::boost::mpl::if_<
|
||||
is_tagged
|
||||
_is_tagged
|
||||
, ::boost::mpl::true_
|
||||
, positional
|
||||
, _is_positional
|
||||
>::type
|
||||
, ::boost::mpl::pair< ::boost::parameter::void_,used_args>
|
||||
, ::boost::mpl::pair< ::boost::parameter::void_,_used_args>
|
||||
, ::boost::parameter::aux::deduce_tag<
|
||||
argument
|
||||
_argument
|
||||
, ArgumentPack
|
||||
, DeducedArgs
|
||||
, used_args
|
||||
, _used_args
|
||||
, TagFn
|
||||
, EmitsErrors
|
||||
>
|
||||
>::type deduced_data;
|
||||
>::type _deduced_data;
|
||||
|
||||
// If this parameter is explicitly tagged ...
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
is_tagged
|
||||
_is_tagged
|
||||
// ... just use it
|
||||
, ::boost::mpl::identity<arg_type>
|
||||
, ::boost::mpl::identity<_arg_type>
|
||||
// ... else ...
|
||||
, ::boost::mpl::eval_if<
|
||||
// if positional matching is turned on ...
|
||||
positional
|
||||
_is_positional
|
||||
// ... tag it positionally
|
||||
, ::boost::mpl::apply_wrap2<TagFn,tag_,argument>
|
||||
, ::boost::mpl::apply_wrap2<TagFn,_tag,_argument>
|
||||
// ... else, use the deduced tag
|
||||
, ::boost::mpl::first<deduced_data>
|
||||
, ::boost::mpl::first<_deduced_data>
|
||||
>
|
||||
>::type tagged;
|
||||
>::type _tagged;
|
||||
|
||||
// Build the arg_list incrementally, prepending new nodes.
|
||||
typedef typename ::boost::mpl::if_<
|
||||
typename ::boost::mpl::if_<
|
||||
::boost::is_same<Error,::boost::parameter::void_>
|
||||
, ::boost::is_same<tagged,::boost::parameter::void_>
|
||||
, ::boost::is_same<_tagged,::boost::parameter::void_>
|
||||
, ::boost::mpl::false_
|
||||
>::type
|
||||
, ::boost::parameter::aux::unmatched_argument<argument>
|
||||
, ::boost::parameter::aux::unmatched_argument<_argument>
|
||||
, ::boost::parameter::void_
|
||||
>::type error;
|
||||
|
||||
typedef typename ::boost::mpl::if_<
|
||||
::boost::is_same<tagged,::boost::parameter::void_>
|
||||
::boost::is_same<_tagged,::boost::parameter::void_>
|
||||
, ArgumentPack
|
||||
, ::boost::parameter::aux::arg_list<tagged,ArgumentPack>
|
||||
>::type argument_pack;
|
||||
#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;
|
||||
|
||||
public:
|
||||
typedef typename ::boost::parameter::aux::make_arg_list_aux<
|
||||
typename List::tail
|
||||
, DeducedArgs
|
||||
, TagFn
|
||||
, positional
|
||||
, typename deduced_data::second
|
||||
, argument_pack
|
||||
, _is_positional
|
||||
, typename _deduced_data::second
|
||||
, _argument_pack
|
||||
, error
|
||||
, EmitsErrors
|
||||
>::type type;
|
||||
};
|
||||
|
||||
@@ -166,10 +176,11 @@ namespace boost { namespace parameter { namespace aux {
|
||||
typename List
|
||||
, typename DeducedArgs
|
||||
, typename TagFn
|
||||
, typename Positional
|
||||
, typename IsPositional
|
||||
, typename UsedArgs
|
||||
, typename ArgumentPack
|
||||
, typename Error
|
||||
, typename EmitsErrors
|
||||
>
|
||||
struct make_arg_list0
|
||||
{
|
||||
@@ -179,21 +190,23 @@ namespace boost { namespace parameter { namespace aux {
|
||||
List
|
||||
, DeducedArgs
|
||||
, TagFn
|
||||
, Positional
|
||||
, IsPositional
|
||||
, UsedArgs
|
||||
, ArgumentPack
|
||||
, typename List::arg const
|
||||
, Error
|
||||
, EmitsErrors
|
||||
>
|
||||
, ::boost::parameter::aux::make_arg_list00<
|
||||
List
|
||||
, DeducedArgs
|
||||
, TagFn
|
||||
, Positional
|
||||
, IsPositional
|
||||
, UsedArgs
|
||||
, ArgumentPack
|
||||
, typename List::arg
|
||||
, Error
|
||||
, EmitsErrors
|
||||
>
|
||||
>::type type;
|
||||
};
|
||||
@@ -211,7 +224,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
// TagFn: A metafunction class used to tag positional or deduced
|
||||
// arguments with a keyword tag.
|
||||
//
|
||||
// Positional: An mpl::bool_<> specialization indicating if positional
|
||||
// IsPositional: An mpl::bool_<> specialization indicating if positional
|
||||
// matching is to be performed.
|
||||
//
|
||||
// DeducedSet: An mpl::set<> containing the keyword tags used so far.
|
||||
@@ -222,10 +235,11 @@ namespace boost { namespace parameter { namespace aux {
|
||||
typename List
|
||||
, typename DeducedArgs
|
||||
, typename TagFn
|
||||
, typename Positional
|
||||
, typename IsPositional
|
||||
, typename DeducedSet
|
||||
, typename ArgumentPack
|
||||
, typename Error
|
||||
, typename EmitsErrors
|
||||
>
|
||||
struct make_arg_list_aux
|
||||
: ::boost::mpl::eval_if<
|
||||
@@ -235,10 +249,11 @@ namespace boost { namespace parameter { namespace aux {
|
||||
List
|
||||
, DeducedArgs
|
||||
, TagFn
|
||||
, Positional
|
||||
, IsPositional
|
||||
, DeducedSet
|
||||
, ArgumentPack
|
||||
, Error
|
||||
, EmitsErrors
|
||||
>
|
||||
>
|
||||
{
|
||||
@@ -255,7 +270,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
typename List
|
||||
, typename DeducedArgs
|
||||
, typename TagFn
|
||||
, typename EmitErrors = ::boost::mpl::true_
|
||||
, typename EmitsErrors = ::boost::mpl::true_
|
||||
>
|
||||
struct make_arg_list
|
||||
: ::boost::parameter::aux::make_arg_list_aux<
|
||||
@@ -266,6 +281,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
, ::boost::parameter::aux::set0
|
||||
, ::boost::parameter::aux::empty_arg_list
|
||||
, ::boost::parameter::void_
|
||||
, EmitsErrors
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <boost/config/workaround.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>
|
||||
@@ -23,6 +24,22 @@
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
template <typename ArgList, typename ParameterRequirements, typename Bound>
|
||||
struct satisfies_impl
|
||||
: ::boost::mpl::apply_wrap2<
|
||||
::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>
|
||||
@@ -41,14 +58,17 @@ namespace boost { namespace parameter { namespace aux {
|
||||
typedef typename ::boost::mpl::eval_if<
|
||||
::boost::is_same<bound,::boost::parameter::void_>
|
||||
, typename ParameterRequirements::has_default
|
||||
, ::boost::mpl::apply_wrap2<
|
||||
::boost::parameter::aux::augment_predicate<
|
||||
typename ParameterRequirements::predicate
|
||||
, typename ArgList::reference
|
||||
, typename ArgList::key_type
|
||||
, ::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
|
||||
>
|
||||
, bound
|
||||
, ArgList
|
||||
>
|
||||
>::type type;
|
||||
#else // !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
@@ -83,7 +103,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
ArgList
|
||||
, typename ::boost::parameter::aux
|
||||
::as_parameter_requirements<ParameterSpec>::type
|
||||
>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
@@ -47,23 +47,29 @@
|
||||
// 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(3, 1, data)) \
|
||||
inline \
|
||||
BOOST_PARAMETER_FUNCTION_RESULT_NAME(BOOST_PP_TUPLE_ELEM(3, 1, 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(3, 1, data) \
|
||||
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(3, 2, data), const) \
|
||||
BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(4, 3, data), const) \
|
||||
{ \
|
||||
return BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, data) \
|
||||
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(3, 1, data) \
|
||||
BOOST_PP_TUPLE_ELEM(4, 1, data) \
|
||||
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
|
||||
)()() \
|
||||
); \
|
||||
}
|
||||
@@ -78,12 +84,15 @@
|
||||
// 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(3, 1, data)) \
|
||||
inline typename \
|
||||
BOOST_PARAMETER_FUNCTION_RESULT_NAME(BOOST_PP_TUPLE_ELEM(3, 1, data))< \
|
||||
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(3, 1, data) \
|
||||
BOOST_PP_TUPLE_ELEM(4, 1, data) \
|
||||
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
|
||||
) \
|
||||
, BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
|
||||
n \
|
||||
@@ -92,23 +101,27 @@
|
||||
) \
|
||||
>::type \
|
||||
>::type \
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION_NAME(BOOST_PP_TUPLE_ELEM(3, 0, data))( \
|
||||
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(3, 1, data) \
|
||||
BOOST_PP_TUPLE_ELEM(4, 1, data) \
|
||||
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
|
||||
) \
|
||||
, n \
|
||||
, ParameterArgumentType \
|
||||
) \
|
||||
) BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(3, 2, data), const) \
|
||||
) BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(4, 3, data), const) \
|
||||
{ \
|
||||
return BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, data) \
|
||||
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(3, 1, data) \
|
||||
BOOST_PP_TUPLE_ELEM(4, 1, data) \
|
||||
, BOOST_PP_TUPLE_ELEM(4, 3, data) \
|
||||
)()( \
|
||||
BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
|
||||
n \
|
||||
@@ -169,12 +182,21 @@
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
|
||||
// Helper macro for BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS.
|
||||
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX(name, impl, range, c) \
|
||||
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX(nm, impl, r, is_m, c) \
|
||||
BOOST_PP_REPEAT_FROM_TO( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, range) \
|
||||
, BOOST_PP_TUPLE_ELEM(2, 1, range) \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, r) \
|
||||
, BOOST_PP_TUPLE_ELEM(2, 1, r) \
|
||||
, BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_Z \
|
||||
, (name, impl, c) \
|
||||
, ( \
|
||||
nm \
|
||||
, impl \
|
||||
, BOOST_PP_IF( \
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(nm) \
|
||||
, 0 \
|
||||
, is_m \
|
||||
) \
|
||||
, c \
|
||||
) \
|
||||
)
|
||||
/**/
|
||||
|
||||
@@ -192,9 +214,9 @@
|
||||
|
||||
// Expands to the layer of forwarding functions for the function with the
|
||||
// specified name, whose arguments determine the range of arities.
|
||||
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, impl, args, const_) \
|
||||
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, impl, a, is_m, c) \
|
||||
BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX( \
|
||||
name, impl, BOOST_PARAMETER_ARITY_RANGE(args), const_ \
|
||||
name, impl, BOOST_PARAMETER_ARITY_RANGE(a), is_m, c \
|
||||
)
|
||||
/**/
|
||||
|
||||
@@ -236,41 +258,58 @@
|
||||
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_0_ARITY(z, n, seq) \
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION_STATIC( \
|
||||
BOOST_PP_TUPLE_ELEM( \
|
||||
3, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
4, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
) \
|
||||
) \
|
||||
inline BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM( \
|
||||
3, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
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( \
|
||||
3, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
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( \
|
||||
3, 0, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
4, 0, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
) \
|
||||
)() BOOST_PP_EXPR_IF( \
|
||||
BOOST_PP_TUPLE_ELEM( \
|
||||
3, 2, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
4, 3, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
) \
|
||||
, const \
|
||||
) \
|
||||
{ \
|
||||
return BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
|
||||
return BOOST_PP_EXPR_IF( \
|
||||
BOOST_PP_TUPLE_ELEM( \
|
||||
3, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
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( \
|
||||
3, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
|
||||
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)) \
|
||||
) \
|
||||
)()() \
|
||||
); \
|
||||
@@ -332,14 +371,16 @@
|
||||
) \
|
||||
> \
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION_STATIC( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_SEQ_HEAD(seq)) \
|
||||
BOOST_PP_TUPLE_ELEM(4, 1, BOOST_PP_SEQ_HEAD(seq)) \
|
||||
) \
|
||||
inline typename BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_SEQ_HEAD(seq)) \
|
||||
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(3, 1, BOOST_PP_SEQ_HEAD(seq)) \
|
||||
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) \
|
||||
@@ -347,27 +388,33 @@
|
||||
>::type \
|
||||
>::type \
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_SEQ_HEAD(seq)) \
|
||||
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(3, 1, BOOST_PP_SEQ_HEAD(seq)) \
|
||||
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(3, 2, BOOST_PP_SEQ_HEAD(seq)), const \
|
||||
BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_HEAD(seq)), const \
|
||||
) \
|
||||
{ \
|
||||
return BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
|
||||
BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_SEQ_HEAD(seq)) \
|
||||
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(3, 1, BOOST_PP_SEQ_HEAD(seq)) \
|
||||
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 \
|
||||
@@ -415,12 +462,21 @@
|
||||
/**/
|
||||
|
||||
// Helper macro for BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS.
|
||||
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX(name, impl, range, c) \
|
||||
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX(nm, impl, r, is_m, c) \
|
||||
BOOST_PP_REPEAT_FROM_TO( \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, range) \
|
||||
, BOOST_PP_TUPLE_ELEM(2, 1, range) \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, r) \
|
||||
, BOOST_PP_TUPLE_ELEM(2, 1, r) \
|
||||
, BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_Z \
|
||||
, (name, impl, c) \
|
||||
, ( \
|
||||
nm \
|
||||
, impl \
|
||||
, BOOST_PP_IF( \
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(impl) \
|
||||
, 0 \
|
||||
, is_m \
|
||||
) \
|
||||
, c \
|
||||
) \
|
||||
)
|
||||
/**/
|
||||
|
||||
@@ -438,12 +494,13 @@
|
||||
|
||||
// Expands to the layer of forwarding functions for the function with the
|
||||
// specified name, whose arguments determine the range of arities.
|
||||
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, impl, args, const_) \
|
||||
#define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, impl, a, is_m, c) \
|
||||
BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX( \
|
||||
name \
|
||||
, impl \
|
||||
, BOOST_PARAMETER_ARITY_RANGE(args) \
|
||||
, const_ \
|
||||
, BOOST_PARAMETER_ARITY_RANGE(a) \
|
||||
, is_m \
|
||||
, c \
|
||||
)
|
||||
/**/
|
||||
|
||||
|
||||
@@ -79,6 +79,24 @@
|
||||
|
||||
#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
|
||||
@@ -281,7 +299,10 @@
|
||||
BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
|
||||
inline BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 0, 0) \
|
||||
{ \
|
||||
return BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, 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_TTI_DETAIL_NULLPTR) \
|
||||
, args \
|
||||
, 0L \
|
||||
@@ -304,7 +325,10 @@
|
||||
BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
|
||||
inline BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 1, 0) \
|
||||
{ \
|
||||
return BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, 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_TTI_DETAIL_NULLPTR) \
|
||||
, args \
|
||||
, 0L \
|
||||
@@ -331,7 +355,10 @@
|
||||
BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
|
||||
inline BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 0, 1) \
|
||||
{ \
|
||||
return BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, 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_TTI_DETAIL_NULLPTR) \
|
||||
, (args \
|
||||
, BOOST_PARAMETER_FUNCTION_DISPATCH_DEFAULT( \
|
||||
@@ -357,7 +384,7 @@
|
||||
|
||||
// x is a tuple:
|
||||
//
|
||||
// (base_name, split_args, is_const, tag_namespace)
|
||||
// (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
|
||||
@@ -391,15 +418,21 @@
|
||||
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_PARAMETER_FUNCTION_DISPATCH_NAME(x, 0)( \
|
||||
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_TTI_DETAIL_NULLPTR) \
|
||||
, args \
|
||||
|
||||
@@ -10,19 +10,23 @@
|
||||
|
||||
// Accessor macros for the input tuple to the dispatch macros.
|
||||
#define BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
|
||||
BOOST_PP_TUPLE_ELEM(4, 0, x)
|
||||
BOOST_PP_TUPLE_ELEM(5, 0, x)
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
|
||||
BOOST_PP_TUPLE_ELEM(4, 1, 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(4, 2, x)
|
||||
BOOST_PP_TUPLE_ELEM(5, 3, x)
|
||||
/**/
|
||||
|
||||
#define BOOST_PARAMETER_FUNCTION_DISPATCH_TAG_NAMESPACE(x) \
|
||||
BOOST_PP_TUPLE_ELEM(4, 3, x)
|
||||
BOOST_PP_TUPLE_ELEM(5, 4, x)
|
||||
/**/
|
||||
|
||||
#endif // include guard
|
||||
|
||||
@@ -72,18 +72,64 @@
|
||||
/**/
|
||||
|
||||
// Produces a name for a parameter specification for the function named base.
|
||||
#define BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME(base) \
|
||||
#define BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME(base, is_const) \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_PP_CAT(boost_param_parameters_, __LINE__) \
|
||||
, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(name) \
|
||||
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) \
|
||||
#define BOOST_PARAMETER_FUNCTION_RESULT_NAME(base, is_const) \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_PP_CAT(boost_param_result_, __LINE__) \
|
||||
, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(name) \
|
||||
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) \
|
||||
)
|
||||
/**/
|
||||
|
||||
@@ -92,22 +138,13 @@
|
||||
// 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) \
|
||||
BOOST_PP_CAT(boost_param_impl, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base))
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/impl/function_dispatch_tuple.hpp>
|
||||
|
||||
// Produces a name for the dispatch functions.
|
||||
#define BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, n) \
|
||||
#define BOOST_PARAMETER_FUNCTION_IMPL_NAME(base, is_const) \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_PP_CAT(boost_param_dispatch_, n) \
|
||||
, BOOST_PP_CAT(boost_, __LINE__) \
|
||||
) \
|
||||
, BOOST_PARAMETER_MEMBER_FUNCTION_NAME( \
|
||||
BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
|
||||
BOOST_PP_IF(is_const, boost_param_impl_const, boost_param_impl) \
|
||||
, __LINE__ \
|
||||
) \
|
||||
, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
|
||||
)
|
||||
/**/
|
||||
|
||||
|
||||
@@ -0,0 +1,321 @@
|
||||
// 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_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_type.hpp>
|
||||
|
||||
// Expands to the result metafunction for the specified no-spec function.
|
||||
#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) \
|
||||
{ \
|
||||
typedef typename BOOST_PARAMETER_PARENTHESIZED_TYPE(result) type; \
|
||||
};
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/compose.hpp>
|
||||
#include <boost/parameter/are_tagged_arguments.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/tti/detail/dnullptr.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_TTI_DETAIL_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_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_MAX_ARITY \
|
||||
, typename TaggedArg \
|
||||
, = ::boost::parameter::void_ BOOST_PP_INTERCEPT \
|
||||
) \
|
||||
> \
|
||||
struct BOOST_PARAMETER_NO_SPEC_FUNCTION_RESULT_NAME(name, is_const) \
|
||||
{ \
|
||||
typedef typename BOOST_PARAMETER_PARENTHESIZED_TYPE(result) type; \
|
||||
};
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/compose.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/tti/detail/dnullptr.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_TTI_DETAIL_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/tti/detail/dnullptr.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_TTI_DETAIL_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_TTI_DETAIL_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_TTI_DETAIL_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_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_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_MAX_ARITY) \
|
||||
, BOOST_PARAMETER_NO_SPEC_FUNCTION_OVERLOAD_Z \
|
||||
, (name, impl, is_m, c) \
|
||||
)
|
||||
/**/
|
||||
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
#endif // include guard
|
||||
|
||||
@@ -67,15 +67,23 @@
|
||||
|
||||
#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) \
|
||||
#define BOOST_PARAMETER_SPECIFICATION(tag_ns, base, split_args, is_const) \
|
||||
template <typename BoostParameterDummy> \
|
||||
struct BOOST_PP_CAT( \
|
||||
BOOST_PP_CAT(boost_param_params_, __LINE__) \
|
||||
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( \
|
||||
@@ -85,7 +93,14 @@
|
||||
{ \
|
||||
}; \
|
||||
typedef BOOST_PP_CAT( \
|
||||
BOOST_PP_CAT(boost_param_params_, __LINE__) \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_PP_IF( \
|
||||
is_const \
|
||||
, boost_param_params_const_ \
|
||||
, boost_param_params_ \
|
||||
) \
|
||||
, __LINE__ \
|
||||
) \
|
||||
, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
|
||||
)<int>
|
||||
/**/
|
||||
|
||||
@@ -51,7 +51,8 @@ namespace boost { namespace parameter { namespace aux {
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/tti/detail/dnullptr.hpp>
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
|
||||
!BOOST_WORKAROUND(BOOST_GCC, < 40000)
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#endif
|
||||
|
||||
@@ -83,7 +84,8 @@ namespace boost { namespace parameter { namespace aux {
|
||||
value> type;
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) || \
|
||||
BOOST_WORKAROUND(BOOST_GCC, < 40000)
|
||||
template <
|
||||
typename T
|
||||
, typename = typename ::boost::parameter::aux
|
||||
@@ -103,7 +105,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
struct unwrap_cv_reference<T,::boost::mpl::true_> : T
|
||||
{
|
||||
};
|
||||
#else // !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#else // 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>
|
||||
@@ -123,7 +125,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
>
|
||||
{
|
||||
};
|
||||
#endif // Borland workarounds needed.
|
||||
#endif // Borland or GCC 3- workarounds needed
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#endif // include guard
|
||||
|
||||
157
include/boost/parameter/compose.hpp
Normal file
157
include/boost/parameter/compose.hpp
Normal file
@@ -0,0 +1,157 @@
|
||||
// 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_COMPOSE_HPP
|
||||
#define BOOST_PARAMETER_COMPOSE_HPP
|
||||
|
||||
#include <boost/parameter/aux_/arg_list.hpp>
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
inline ::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 {
|
||||
|
||||
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;
|
||||
};
|
||||
}}} // namespace boost::parameter::aux
|
||||
|
||||
#include <boost/parameter/are_tagged_arguments.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
template <typename TaggedArg0, typename ...TaggedArgs>
|
||||
inline typename ::boost::lazy_enable_if<
|
||||
::boost::parameter::are_tagged_arguments<TaggedArg0,TaggedArgs...>
|
||||
, ::boost::parameter::aux
|
||||
::compose_arg_list<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/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_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_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>
|
||||
|
||||
#define BOOST_PARAMETER_compose_arg_list_function_overload(z, n, prefix) \
|
||||
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename prefix)> \
|
||||
inline typename ::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) \
|
||||
>::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_MAX_ARITY, n) \
|
||||
, ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT \
|
||||
) \
|
||||
); \
|
||||
}
|
||||
/**/
|
||||
#endif // BOOST_NO_SFINAE
|
||||
|
||||
#include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(
|
||||
1
|
||||
, BOOST_PP_INC(BOOST_PARAMETER_MAX_ARITY)
|
||||
, BOOST_PARAMETER_compose_arg_list_function_overload
|
||||
, TaggedArg
|
||||
)
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#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
|
||||
|
||||
@@ -15,9 +15,13 @@
|
||||
// SFINAE support, needed explicitly by tagged_argument & keyword & cast;
|
||||
// correct function template ordering, needed by the code generation macros;
|
||||
// rvalue references, needed throughout; variadic templates, needed by
|
||||
// parameters; and the ability to handle multiple parameter packs, needed by
|
||||
// parameters. Older versions of GCC either don't have the latter ability or
|
||||
// cannot disambiguate between keyword's overloaded operators.
|
||||
// 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) && \
|
||||
@@ -25,12 +29,31 @@
|
||||
!defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) && \
|
||||
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
|
||||
!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
|
||||
!BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
|
||||
!BOOST_WORKAROUND(BOOST_GCC, < 40900)
|
||||
!defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && \
|
||||
!BOOST_WORKAROUND(__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
|
||||
#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
|
||||
|
||||
@@ -74,6 +74,11 @@ namespace boost { namespace parameter { namespace aux {
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE)
|
||||
#if defined(BOOST_PARAMETER_CAN_USE_MP11)
|
||||
#include <boost/mp11/list.hpp>
|
||||
#include <boost/mp11/mpl.hpp>
|
||||
#define BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE ::boost::mp11::mp_list
|
||||
#else
|
||||
#include <boost/fusion/container/list/list_fwd.hpp>
|
||||
|
||||
// Newer versions of MSVC fail on the evaluate_category and
|
||||
@@ -98,6 +103,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
#define BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE ::boost::mpl::vector
|
||||
#endif // BOOST_FUSION_HAS_VARIADIC_DEQUE
|
||||
#endif // BOOST_FUSION_HAS_VARIADIC_LIST
|
||||
#endif // BOOST_PARAMETER_CAN_USE_MP11
|
||||
#endif // BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
// Helper macro for BOOST_PARAMETER_CONSTRUCTOR.
|
||||
#define BOOST_PARAMETER_CONSTRUCTOR_AUX(class_, base, tag_namespace, args) \
|
||||
BOOST_PARAMETER_SPECIFICATION(tag_namespace, ctor, args) \
|
||||
BOOST_PARAMETER_SPECIFICATION(tag_namespace, ctor, args, 0) \
|
||||
BOOST_PP_CAT(constructor_parameters, __LINE__); \
|
||||
BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS(class_, base, args)
|
||||
/**/
|
||||
@@ -21,42 +21,46 @@
|
||||
#include <boost/parameter/aux_/preprocessor/impl/function_name.hpp>
|
||||
|
||||
// Defines the implementation function header.
|
||||
#define BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name) \
|
||||
#define BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name, is_const) \
|
||||
template <typename Args> \
|
||||
typename BOOST_PARAMETER_FUNCTION_RESULT_NAME(name)< \
|
||||
typename BOOST_PARAMETER_FUNCTION_RESULT_NAME(name, is_const)< \
|
||||
Args \
|
||||
>::type BOOST_PARAMETER_FUNCTION_IMPL_NAME(name)(Args const& args)
|
||||
>::type BOOST_PARAMETER_FUNCTION_IMPL_NAME(name, is_const)( \
|
||||
Args const& args \
|
||||
)
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/impl/parenthesized_type.hpp>
|
||||
|
||||
// Expands to the result metafunction and the parameters specialization.
|
||||
#define BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_namespace, args) \
|
||||
#define BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_ns, args, is_const) \
|
||||
template <typename Args> \
|
||||
struct BOOST_PARAMETER_FUNCTION_RESULT_NAME(name) \
|
||||
struct BOOST_PARAMETER_FUNCTION_RESULT_NAME(name, is_const) \
|
||||
{ \
|
||||
typedef typename BOOST_PARAMETER_PARENTHESIZED_TYPE(result) type; \
|
||||
}; \
|
||||
BOOST_PARAMETER_SPECIFICATION(tag_namespace, name, args) \
|
||||
BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME(name);
|
||||
BOOST_PARAMETER_SPECIFICATION(tag_ns, name, args, is_const) \
|
||||
BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME(name, is_const);
|
||||
/**/
|
||||
|
||||
// Helper macro for BOOST_PARAMETER_BASIC_FUNCTION.
|
||||
#define BOOST_PARAMETER_BASIC_FUNCTION_AUX(result, name, tag_ns, args) \
|
||||
BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_ns, args) \
|
||||
BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name); \
|
||||
BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, name, args, 0) \
|
||||
BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name)
|
||||
BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_ns, args, 0) \
|
||||
BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name, 0); \
|
||||
BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, name, args, 0, 0) \
|
||||
BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name, 0)
|
||||
/**/
|
||||
|
||||
#include <boost/preprocessor/control/expr_if.hpp>
|
||||
|
||||
// Helper macro for BOOST_PARAMETER_BASIC_MEMBER_FUNCTION
|
||||
// and BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION.
|
||||
#define BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX(r, name, tag_ns, args, c) \
|
||||
BOOST_PARAMETER_FUNCTION_HEAD(r, name, tag_ns, args) \
|
||||
BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, name, args, c) \
|
||||
BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name) BOOST_PP_EXPR_IF(c, const)
|
||||
// Helper macro for BOOST_PARAMETER_BASIC_MEMBER_FUNCTION,
|
||||
// BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION,
|
||||
// BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR, and
|
||||
// BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR.
|
||||
#define BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX(r, n, i, tag_ns, args, c) \
|
||||
BOOST_PARAMETER_FUNCTION_HEAD(r, i, tag_ns, args, c) \
|
||||
BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(n, i, args, 1, c) \
|
||||
BOOST_PARAMETER_FUNCTION_IMPL_HEAD(i, c) BOOST_PP_EXPR_IF(c, const)
|
||||
/**/
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/impl/flatten.hpp>
|
||||
@@ -83,7 +87,7 @@
|
||||
// are accessible via args and keywords only.
|
||||
#define BOOST_PARAMETER_BASIC_MEMBER_FUNCTION(result, name, tag_ns, args) \
|
||||
BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX( \
|
||||
result, name, tag_ns \
|
||||
result, name, name, tag_ns \
|
||||
, BOOST_PARAMETER_AUX_PP_FLATTEN(2, 2, 3, args), 0 \
|
||||
)
|
||||
/**/
|
||||
@@ -92,7 +96,25 @@
|
||||
// header. All arguments are accessible via args and keywords only.
|
||||
#define BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION(r, name, tag_ns, args) \
|
||||
BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX( \
|
||||
r, name, tag_ns \
|
||||
r, name, name, tag_ns \
|
||||
, BOOST_PARAMETER_AUX_PP_FLATTEN(2, 2, 3, args), 1 \
|
||||
)
|
||||
/**/
|
||||
|
||||
// Expands to a Boost.Parameter-enabled function call operator header. All
|
||||
// arguments are accessible via args and keywords only.
|
||||
#define BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR(result, tag_ns, args) \
|
||||
BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX( \
|
||||
result, operator(), operator, tag_ns \
|
||||
, BOOST_PARAMETER_AUX_PP_FLATTEN(2, 2, 3, args), 0 \
|
||||
)
|
||||
/**/
|
||||
|
||||
// Expands to a Boost.Parameter-enabled const-qualified function call
|
||||
// operator header. All arguments are accessible via args and keywords only.
|
||||
#define BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR(r, tag_ns, args) \
|
||||
BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX( \
|
||||
r, operator(), operator, tag_ns \
|
||||
, BOOST_PARAMETER_AUX_PP_FLATTEN(2, 2, 3, args), 1 \
|
||||
)
|
||||
/**/
|
||||
@@ -101,11 +123,11 @@
|
||||
|
||||
// Helper macro for BOOST_PARAMETER_FUNCTION.
|
||||
#define BOOST_PARAMETER_FUNCTION_AUX(result, name, tag_ns, args) \
|
||||
BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_ns, args) \
|
||||
BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name); \
|
||||
BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, name, args, 0) \
|
||||
BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_ns, args, 0) \
|
||||
BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name, 0); \
|
||||
BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, name, args, 0, 0) \
|
||||
BOOST_PARAMETER_FUNCTION_DISPATCH_LAYER( \
|
||||
1, (name, BOOST_PARAMETER_FUNCTION_SPLIT_ARGS(args), 0, tag_ns) \
|
||||
1, (name, BOOST_PARAMETER_FUNCTION_SPLIT_ARGS(args), 0, 0, tag_ns) \
|
||||
)
|
||||
/**/
|
||||
|
||||
@@ -118,15 +140,27 @@
|
||||
)
|
||||
/**/
|
||||
|
||||
#include <boost/preprocessor/control/if.hpp>
|
||||
|
||||
// Helper macro for BOOST_PARAMETER_MEMBER_FUNCTION
|
||||
// BOOST_PARAMETER_CONST_MEMBER_FUNCTION,
|
||||
// BOOST_PARAMETER_FUNCTION_CALL_OPERATOR, and
|
||||
// BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR.
|
||||
#define BOOST_PARAMETER_MEMBER_FUNCTION_AUX(r, name, impl, tag_ns, c, args) \
|
||||
BOOST_PARAMETER_FUNCTION_HEAD(r, impl, tag_ns, args) \
|
||||
BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, impl, args, c) \
|
||||
BOOST_PARAMETER_FUNCTION_HEAD(r, impl, tag_ns, args, c) \
|
||||
BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, impl, args, 1, c) \
|
||||
BOOST_PARAMETER_FUNCTION_DISPATCH_LAYER( \
|
||||
0, (impl, BOOST_PARAMETER_FUNCTION_SPLIT_ARGS(args), c, tag_ns) \
|
||||
0, ( \
|
||||
impl \
|
||||
, BOOST_PARAMETER_FUNCTION_SPLIT_ARGS(args) \
|
||||
, BOOST_PP_IF( \
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(impl) \
|
||||
, 0 \
|
||||
, 1 \
|
||||
) \
|
||||
, c \
|
||||
, tag_ns \
|
||||
) \
|
||||
)
|
||||
/**/
|
||||
|
||||
|
||||
74
include/boost/parameter/preprocessor_no_spec.hpp
Normal file
74
include/boost/parameter/preprocessor_no_spec.hpp
Normal file
@@ -0,0 +1,74 @@
|
||||
// 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_PREPROCESSOR_NO_SPEC_HPP
|
||||
#define BOOST_PARAMETER_PREPROCESSOR_NO_SPEC_HPP
|
||||
|
||||
#include <boost/parameter/aux_/preprocessor/impl/function_name.hpp>
|
||||
#include <boost/parameter/aux_/preprocessor/impl/no_spec_overloads.hpp>
|
||||
|
||||
// Exapnds to a variadic function header that is enabled if and only if all
|
||||
// its arguments are tagged arguments. All arguments are accessible via args
|
||||
// and keywords only.
|
||||
#define BOOST_PARAMETER_NO_SPEC_FUNCTION(result, name) \
|
||||
BOOST_PARAMETER_NO_SPEC_FUNCTION_HEAD(result, name, 0) \
|
||||
BOOST_PARAMETER_NO_SPEC_FUNCTION_IMPL_HEAD(name, 0); \
|
||||
BOOST_PARAMETER_NO_SPEC_FUNCTION_OVERLOAD(name, name, 0, 0) \
|
||||
BOOST_PARAMETER_NO_SPEC_FUNCTION_IMPL_HEAD(name, 0)
|
||||
/**/
|
||||
|
||||
#include <boost/preprocessor/control/expr_if.hpp>
|
||||
#include <boost/preprocessor/control/if.hpp>
|
||||
|
||||
// Helper macro for BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION,
|
||||
// BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION,
|
||||
// BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR, and
|
||||
// and BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR.
|
||||
#define BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION_AUX(result, name, impl, c) \
|
||||
BOOST_PARAMETER_NO_SPEC_FUNCTION_HEAD(result, impl, c) \
|
||||
BOOST_PARAMETER_NO_SPEC_FUNCTION_OVERLOAD( \
|
||||
name \
|
||||
, impl \
|
||||
, BOOST_PP_IF(BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(impl), 0, 1) \
|
||||
, c \
|
||||
) \
|
||||
BOOST_PARAMETER_NO_SPEC_FUNCTION_IMPL_HEAD(impl, c) \
|
||||
BOOST_PP_EXPR_IF(c, const)
|
||||
/**/
|
||||
|
||||
// Exapnds to a variadic member function header that is enabled if and only if
|
||||
// all its arguments are tagged arguments. All arguments are accessible via
|
||||
// args and keywords only.
|
||||
#define BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION(result, name) \
|
||||
BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION_AUX(result, name, name, 0)
|
||||
/**/
|
||||
|
||||
// Exapnds to a const-qualified variadic member function header that is
|
||||
// enabled if and only if all its arguments are tagged arguments. All
|
||||
// arguments are accessible via args and keywords only.
|
||||
#define BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION(result, name) \
|
||||
BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION_AUX(result, name, name, 1)
|
||||
/**/
|
||||
|
||||
// Exapnds to a variadic function call operator header that is enabled if and
|
||||
// only if all its arguments are tagged arguments. All arguments are
|
||||
// accessible via args and keywords only.
|
||||
#define BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR(result) \
|
||||
BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION_AUX( \
|
||||
result, operator(), operator, 0 \
|
||||
)
|
||||
/**/
|
||||
|
||||
// Exapnds to a const-qualified variadic function call operator header that is
|
||||
// enabled if and only if all its arguments are tagged arguments. All
|
||||
// arguments are accessible via args and keywords only.
|
||||
#define BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR(result) \
|
||||
BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION_AUX( \
|
||||
result, operator(), operator, 1 \
|
||||
)
|
||||
/**/
|
||||
|
||||
#endif // include guard
|
||||
|
||||
210
test/Jamfile.v2
210
test/Jamfile.v2
@@ -32,16 +32,6 @@ alias parameter_standard_tests
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run optional_deduced_sfinae.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=2
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=2
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run efficiency.cpp
|
||||
:
|
||||
:
|
||||
@@ -71,6 +61,34 @@ alias parameter_standard_tests
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run parameterized_inheritance.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=3
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run preprocessor_eval_cat_no_spec.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=8
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run optional_deduced_sfinae.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=2
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=2
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run preprocessor_eval_category.cpp
|
||||
:
|
||||
:
|
||||
@@ -111,26 +129,6 @@ alias parameter_standard_tests
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run earwicker.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=5
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run macros.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=5
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run preprocessor.cpp
|
||||
:
|
||||
:
|
||||
@@ -171,19 +169,44 @@ alias parameter_standard_tests
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run earwicker.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=5
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ run macros.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=5
|
||||
:
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
[ compile unwrap_cv_reference.cpp ]
|
||||
[ compile ntp.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=0
|
||||
]
|
||||
[ compile function_type_tpl_param.cpp ]
|
||||
[ compile-fail duplicates.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=5
|
||||
:
|
||||
duplicates_fail
|
||||
]
|
||||
[ compile-fail deduced_unmatched_arg.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=5
|
||||
:
|
||||
deduced_unmatched_arg_fail
|
||||
]
|
||||
@@ -217,6 +240,8 @@ alias parameter_standard_tests
|
||||
]
|
||||
[ compile-fail deduced.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=4
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=5
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE
|
||||
:
|
||||
deduced_fail
|
||||
@@ -567,6 +592,16 @@ alias parameter_macros_eval_category
|
||||
|
||||
alias parameter_evaluate_category_10
|
||||
:
|
||||
[ run evaluate_category_10.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=0
|
||||
:
|
||||
evaluate_category_10_gcc_4_8_linux
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
:
|
||||
<target-os>linux
|
||||
<toolset>gcc
|
||||
@@ -575,16 +610,16 @@ alias parameter_evaluate_category_10
|
||||
|
||||
alias parameter_evaluate_category_10
|
||||
:
|
||||
:
|
||||
# This test fails for xcode 7.3.0 on osx
|
||||
# so we turn off this test for this compiler for now
|
||||
<target-os>darwin
|
||||
<cxxstd>03
|
||||
# TODO: Differentiate by xcode version or by clang version
|
||||
;
|
||||
|
||||
alias parameter_evaluate_category_10
|
||||
:
|
||||
[ run evaluate_category_10.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=0
|
||||
:
|
||||
evaluate_category_10_mingw
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
:
|
||||
<target-os>windows
|
||||
<toolset>gcc
|
||||
@@ -596,8 +631,6 @@ alias parameter_evaluate_category_10
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=10
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=0
|
||||
:
|
||||
evaluate_category_10_cxx98
|
||||
:
|
||||
@@ -613,7 +646,6 @@ alias parameter_evaluate_category_10
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=10
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=0
|
||||
:
|
||||
evaluate_category_10_cxx03
|
||||
@@ -640,40 +672,17 @@ alias parameter_evaluate_category_10
|
||||
|
||||
alias parameter_preprocessor_eval_cat_8
|
||||
:
|
||||
:
|
||||
<target-os>linux
|
||||
<toolset>gcc
|
||||
<toolset-gcc:version>4.8
|
||||
;
|
||||
|
||||
alias parameter_preprocessor_eval_cat_8
|
||||
:
|
||||
:
|
||||
<target-os>linux
|
||||
<toolset>gcc
|
||||
<toolset-gcc:version>4.9
|
||||
;
|
||||
|
||||
alias parameter_preprocessor_eval_cat_8
|
||||
:
|
||||
:
|
||||
<target-os>linux
|
||||
<toolset>gcc
|
||||
<cxxstd>03
|
||||
;
|
||||
|
||||
alias parameter_preprocessor_eval_cat_8
|
||||
:
|
||||
:
|
||||
# This test fails for xcode 7.3.0 and xcode 8.3.0 on osx
|
||||
# so we turn off this test for this compiler for now
|
||||
<target-os>darwin
|
||||
<cxxstd>03
|
||||
# TODO: Differentiate by xcode version or by clang version
|
||||
;
|
||||
|
||||
alias parameter_preprocessor_eval_cat_8
|
||||
:
|
||||
[ run preprocessor_eval_cat_8.cpp
|
||||
:
|
||||
:
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=8
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=0
|
||||
:
|
||||
preproc_eval_cat_8_mingw
|
||||
:
|
||||
<preserve-target-tests>off
|
||||
]
|
||||
:
|
||||
<target-os>windows
|
||||
<toolset>gcc
|
||||
@@ -722,22 +731,22 @@ alias parameter_preprocessor_eval_cat_fail
|
||||
]
|
||||
;
|
||||
|
||||
alias parameter_msvc_fail_tests ;
|
||||
alias parameter_vendor_specific_fail_tests ;
|
||||
|
||||
alias parameter_msvc_fail_tests
|
||||
alias parameter_vendor_specific_fail_tests
|
||||
:
|
||||
[ compile-fail compose.cpp
|
||||
:
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC
|
||||
:
|
||||
compose_msvc11_fail_11
|
||||
compose_fail_msvc11
|
||||
]
|
||||
:
|
||||
<toolset>msvc
|
||||
<toolset-msvc:version>11.0
|
||||
;
|
||||
|
||||
alias parameter_msvc_fail_tests
|
||||
alias parameter_vendor_specific_fail_tests
|
||||
:
|
||||
[ compile-fail evaluate_category.cpp
|
||||
:
|
||||
@@ -745,7 +754,7 @@ alias parameter_msvc_fail_tests
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=5
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC
|
||||
:
|
||||
evaluate_category_msvc12_fail
|
||||
evaluate_category_fail_msvc12
|
||||
]
|
||||
[ compile-fail preprocessor_eval_category.cpp
|
||||
:
|
||||
@@ -753,14 +762,21 @@ alias parameter_msvc_fail_tests
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=9
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC
|
||||
:
|
||||
preproc_eval_cat_msvc12_fail
|
||||
preproc_eval_cat_fail_msvc12
|
||||
]
|
||||
[ compile-fail preprocessor_eval_cat_no_spec.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=8
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC
|
||||
:
|
||||
preproc_eval_cat_no_spec_fail_msvc12
|
||||
]
|
||||
:
|
||||
<toolset>msvc
|
||||
<toolset-msvc:version>12.0
|
||||
;
|
||||
|
||||
alias parameter_msvc_fail_tests
|
||||
alias parameter_vendor_specific_fail_tests
|
||||
:
|
||||
[ compile-fail evaluate_category.cpp
|
||||
:
|
||||
@@ -768,7 +784,7 @@ alias parameter_msvc_fail_tests
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=5
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC
|
||||
:
|
||||
evaluate_category_msvc14_0_fail
|
||||
evaluate_category_fail_msvc14_0
|
||||
]
|
||||
[ compile-fail preprocessor_eval_category.cpp
|
||||
:
|
||||
@@ -776,14 +792,21 @@ alias parameter_msvc_fail_tests
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=9
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC
|
||||
:
|
||||
preproc_eval_cat_msvc14_0_fail
|
||||
preproc_eval_cat_fail_msvc14_0
|
||||
]
|
||||
[ compile-fail preprocessor_eval_cat_no_spec.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=8
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC
|
||||
:
|
||||
preproc_eval_cat_no_spec_fail_msvc14_0
|
||||
]
|
||||
:
|
||||
<toolset>msvc
|
||||
<toolset-msvc:version>14.0
|
||||
;
|
||||
|
||||
alias parameter_msvc_fail_tests
|
||||
alias parameter_vendor_specific_fail_tests
|
||||
:
|
||||
[ compile-fail evaluate_category.cpp
|
||||
:
|
||||
@@ -791,7 +814,7 @@ alias parameter_msvc_fail_tests
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=5
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC
|
||||
:
|
||||
evaluate_category_msvc14_1_fail
|
||||
evaluate_category_fail_msvc14_1
|
||||
]
|
||||
[ compile-fail preprocessor_eval_category.cpp
|
||||
:
|
||||
@@ -799,7 +822,14 @@ alias parameter_msvc_fail_tests
|
||||
<define>BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY=9
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC
|
||||
:
|
||||
preproc_eval_cat_msvc14_1_fail
|
||||
preproc_eval_cat_fail_msvc14_1
|
||||
]
|
||||
[ compile-fail preprocessor_eval_cat_no_spec.cpp
|
||||
:
|
||||
<define>BOOST_PARAMETER_MAX_ARITY=8
|
||||
<define>LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC
|
||||
:
|
||||
preproc_eval_cat_no_spec_fail_msvc14_1
|
||||
]
|
||||
:
|
||||
<toolset>msvc
|
||||
@@ -816,5 +846,5 @@ test-suite "parameter"
|
||||
parameter_standard_tests
|
||||
parameter_literate_tests
|
||||
parameter_python_test
|
||||
parameter_msvc_fail_tests
|
||||
parameter_vendor_specific_fail_tests
|
||||
;
|
||||
|
||||
@@ -9,15 +9,14 @@
|
||||
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if (BOOST_PARAMETER_MAX_ARITY < 4)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 4 or greater.
|
||||
#endif
|
||||
#if (BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < 5)
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < 5)
|
||||
#error Define BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY \
|
||||
as 5 or greater.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
@@ -5,15 +5,14 @@
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if (BOOST_PARAMETER_MAX_ARITY < 4)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 4 or greater.
|
||||
#endif
|
||||
#if (BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < 5)
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < 5)
|
||||
#error Define BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY \
|
||||
as 5 or greater.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <boost/parameter/name.hpp>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/parameter.hpp>
|
||||
#include <boost/parameter/name.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
#include <boost/timer.hpp>
|
||||
#include <iostream>
|
||||
|
||||
@@ -5,12 +5,19 @@
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(BOOST_PARAMETER_MAX_ARITY < 10)
|
||||
#if ( \
|
||||
defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
!defined(__MINGW32__) \
|
||||
) || ( \
|
||||
!defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(10 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY) \
|
||||
)
|
||||
#if (BOOST_PARAMETER_MAX_ARITY < 10)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 10 or greater.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <boost/parameter.hpp>
|
||||
#include <boost/parameter/name.hpp>
|
||||
|
||||
namespace test {
|
||||
|
||||
@@ -28,6 +35,20 @@ namespace test {
|
||||
BOOST_PARAMETER_NAME((_lrc2, keywords) in(lrc2))
|
||||
BOOST_PARAMETER_NAME((_lr2, keywords) out(lr2))
|
||||
BOOST_PARAMETER_NAME((_rr2, keywords) rr2)
|
||||
} // namespace test
|
||||
|
||||
#if ( \
|
||||
defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
!defined(__MINGW32__) \
|
||||
) || ( \
|
||||
!defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(10 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY) \
|
||||
)
|
||||
#include <boost/parameter/parameters.hpp>
|
||||
#include <boost/parameter/required.hpp>
|
||||
#include <boost/parameter/optional.hpp>
|
||||
|
||||
namespace test {
|
||||
|
||||
struct g_parameters
|
||||
: boost::parameter::parameters<
|
||||
@@ -46,6 +67,8 @@ namespace test {
|
||||
};
|
||||
} // namespace test
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include "evaluate_category.hpp"
|
||||
|
||||
@@ -58,67 +81,67 @@ namespace test {
|
||||
{
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<0>(args[test::_lrc0])
|
||||
, test::U::evaluate_category<0>(args[test::_lrc0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference
|
||||
, U::evaluate_category<0>(args[test::_lr0])
|
||||
, test::U::evaluate_category<0>(args[test::_lr0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<1>(args[test::_lrc1])
|
||||
, test::U::evaluate_category<1>(args[test::_lrc1])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference
|
||||
, U::evaluate_category<1>(args[test::_lr1])
|
||||
, test::U::evaluate_category<1>(args[test::_lr1])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<2>(
|
||||
, test::U::evaluate_category<2>(
|
||||
args[test::_lrc2 | test::lvalue_const_bitset<2>()]
|
||||
)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference
|
||||
, U::evaluate_category<2>(
|
||||
, test::U::evaluate_category<2>(
|
||||
args[test::_lr2 || test::lvalue_bitset_function<2>()]
|
||||
)
|
||||
);
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_rvalue_reference_to_const
|
||||
, U::evaluate_category<0>(args[test::_rrc0])
|
||||
, test::U::evaluate_category<0>(args[test::_rrc0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_rvalue_reference
|
||||
, U::evaluate_category<0>(args[test::_rr0])
|
||||
, test::U::evaluate_category<0>(args[test::_rr0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_rvalue_reference_to_const
|
||||
, U::evaluate_category<1>(args[test::_rrc1])
|
||||
, test::U::evaluate_category<1>(args[test::_rrc1])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_rvalue_reference
|
||||
, U::evaluate_category<2>(
|
||||
, test::U::evaluate_category<2>(
|
||||
args[test::_rr2 || test::rvalue_bitset_function<2>()]
|
||||
)
|
||||
);
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<0>(args[test::_rrc0])
|
||||
, test::U::evaluate_category<0>(args[test::_rrc0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<0>(args[test::_rr0])
|
||||
, test::U::evaluate_category<0>(args[test::_rr0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<1>(args[test::_rrc1])
|
||||
, test::U::evaluate_category<1>(args[test::_rrc1])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<2>(
|
||||
, test::U::evaluate_category<2>(
|
||||
args[test::_rr2 || test::rvalue_bitset_function<2>()]
|
||||
)
|
||||
);
|
||||
@@ -129,13 +152,34 @@ namespace test {
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#include <boost/parameter/aux_/as_lvalue.hpp>
|
||||
#include <boost/core/ref.hpp>
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) || \
|
||||
(10 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if defined(__MINGW32__)
|
||||
test::C::evaluate((
|
||||
test::_rrc1 = test::rvalue_const_bitset<1>()
|
||||
, test::_lrc0 = test::lvalue_const_bitset<0>()
|
||||
, test::_lr0 = test::lvalue_bitset<0>()
|
||||
, test::_rrc0 = test::rvalue_const_bitset<0>()
|
||||
, test::_rr0 = test::rvalue_bitset<0>()
|
||||
, test::_lrc1 = test::lvalue_const_bitset<1>()
|
||||
, test::_lr1 = test::lvalue_bitset<1>()
|
||||
));
|
||||
test::C::evaluate((
|
||||
test::_lr0 = test::lvalue_bitset<0>()
|
||||
, test::_rrc0 = test::rvalue_const_bitset<0>()
|
||||
, test::_rr0 = test::rvalue_bitset<0>()
|
||||
, test::_lrc1 = test::lvalue_const_bitset<1>()
|
||||
, test::_lr1 = test::lvalue_bitset<1>()
|
||||
, test::_rrc1 = test::rvalue_const_bitset<1>()
|
||||
, test::_lrc2 = test::lvalue_const_bitset<2>()
|
||||
, test::_lr2 = test::lvalue_bitset<2>()
|
||||
, test::_rr2 = test::rvalue_bitset<2>()
|
||||
, test::_lrc0 = test::lvalue_const_bitset<0>()
|
||||
));
|
||||
#else // !defined(__MINGW32__)
|
||||
test::C::evaluate(
|
||||
test::g_parameters()(
|
||||
test::lvalue_const_bitset<0>()
|
||||
@@ -161,33 +205,64 @@ int main()
|
||||
, test::rvalue_bitset<2>()
|
||||
)
|
||||
);
|
||||
#else // no perfect forwarding support and no exponential overloads
|
||||
#endif // __MINGW32__
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if (10 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
test::C::evaluate(
|
||||
test::g_parameters()(
|
||||
test::lvalue_const_bitset<0>()
|
||||
, boost::ref(test::lvalue_bitset<0>())
|
||||
, test::lvalue_bitset<0>()
|
||||
, test::rvalue_const_bitset<0>()
|
||||
, boost::parameter::aux::as_lvalue(test::rvalue_bitset<0>())
|
||||
, test::lvalue_const_bitset<1>()
|
||||
, boost::ref(test::lvalue_bitset<1>())
|
||||
, test::lvalue_bitset<1>()
|
||||
, test::rvalue_const_bitset<1>()
|
||||
)
|
||||
);
|
||||
test::C::evaluate(
|
||||
test::g_parameters()(
|
||||
test::lvalue_const_bitset<0>()
|
||||
, boost::ref(test::lvalue_bitset<0>())
|
||||
, test::lvalue_bitset<0>()
|
||||
, test::rvalue_const_bitset<0>()
|
||||
, boost::parameter::aux::as_lvalue(test::rvalue_bitset<0>())
|
||||
, test::lvalue_const_bitset<1>()
|
||||
, boost::ref(test::lvalue_bitset<1>())
|
||||
, test::lvalue_bitset<1>()
|
||||
, test::rvalue_const_bitset<1>()
|
||||
, test::lvalue_const_bitset<2>()
|
||||
, boost::ref(test::lvalue_bitset<2>())
|
||||
, test::lvalue_bitset<2>()
|
||||
, boost::parameter::aux::as_lvalue(test::rvalue_bitset<2>())
|
||||
)
|
||||
);
|
||||
#endif // perfect forwarding support, or exponential overloads
|
||||
#else // !(10 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
test::C::evaluate((
|
||||
test::_lrc0 = test::lvalue_const_bitset<0>()
|
||||
, test::_lr0 = test::lvalue_bitset<0>()
|
||||
, test::_rrc0 = test::rvalue_const_bitset<0>()
|
||||
, test::_rr0 = boost::parameter::aux::as_lvalue(
|
||||
test::rvalue_bitset<0>()
|
||||
)
|
||||
, test::_lrc1 = test::lvalue_const_bitset<1>()
|
||||
, test::_lr1 = test::lvalue_bitset<1>()
|
||||
, test::_rrc1 = test::rvalue_const_bitset<1>()
|
||||
));
|
||||
test::C::evaluate((
|
||||
test::_lrc0 = test::lvalue_const_bitset<0>()
|
||||
, test::_lr0 = test::lvalue_bitset<0>()
|
||||
, test::_rrc0 = test::rvalue_const_bitset<0>()
|
||||
, test::_rr0 = boost::parameter::aux::as_lvalue(
|
||||
test::rvalue_bitset<0>()
|
||||
)
|
||||
, test::_lrc1 = test::lvalue_const_bitset<1>()
|
||||
, test::_lr1 = test::lvalue_bitset<1>()
|
||||
, test::_rrc1 = test::rvalue_const_bitset<1>()
|
||||
, test::_lrc2 = test::lvalue_const_bitset<2>()
|
||||
, test::_lr2 = test::lvalue_bitset<2>()
|
||||
, test::_rr2 = boost::parameter::aux::as_lvalue(
|
||||
test::rvalue_bitset<2>()
|
||||
)
|
||||
));
|
||||
#endif // (10 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,14 +44,21 @@ void f()
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
char const*& blank_char_ptr()
|
||||
{
|
||||
static char const* larr = "";
|
||||
return larr;
|
||||
}
|
||||
|
||||
BOOST_PARAMETER_FUNCTION(
|
||||
(void), def, tag,
|
||||
(bool), def, tag,
|
||||
(required (name,(char const*)) (func,*) ) // nondeduced
|
||||
(deduced
|
||||
(optional
|
||||
(docstring, (char const*), "")
|
||||
(docstring, (char const*), blank_char_ptr())
|
||||
(keywords
|
||||
, *(is_keyword_expression<boost::mpl::_>) // see 5
|
||||
// see 5
|
||||
, *(is_keyword_expression<boost::mpl::_>)
|
||||
, no_keywords()
|
||||
)
|
||||
(policies
|
||||
@@ -60,7 +67,8 @@ BOOST_PARAMETER_FUNCTION(
|
||||
boost::is_convertible<boost::mpl::_,char const*>
|
||||
, boost::mpl::false_
|
||||
, boost::mpl::if_<
|
||||
is_keyword_expression<boost::mpl::_> // see 5
|
||||
// see 5
|
||||
is_keyword_expression<boost::mpl::_>
|
||||
, boost::mpl::false_
|
||||
, boost::mpl::true_
|
||||
>
|
||||
@@ -72,16 +80,18 @@ BOOST_PARAMETER_FUNCTION(
|
||||
)
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
def("f", &f, some_policies, "Documentation for f");
|
||||
def("f", &f, "Documentation for f", some_policies);
|
||||
char const* f_name = "f";
|
||||
def(f_name, &f, some_policies, "Documentation for f");
|
||||
def(f_name, &f, "Documentation for f", some_policies);
|
||||
def(
|
||||
"f"
|
||||
f_name
|
||||
, &f
|
||||
, _policies = some_policies
|
||||
, "Documentation for f"
|
||||
|
||||
@@ -10,7 +10,7 @@ BOOST_PARAMETER_NAME(color_map)
|
||||
|
||||
#include <boost/graph/depth_first_search.hpp> // for dfs_visitor
|
||||
|
||||
BOOST_PARAMETER_FUNCTION((void), depth_first_search, tag,
|
||||
BOOST_PARAMETER_FUNCTION((bool), depth_first_search, tag,
|
||||
(required
|
||||
(graph, *)
|
||||
(visitor, *)
|
||||
@@ -20,20 +20,27 @@ BOOST_PARAMETER_FUNCTION((void), depth_first_search, tag,
|
||||
)
|
||||
)
|
||||
{
|
||||
std::cout << "graph=" << graph << std::endl;
|
||||
std::cout << "visitor=" << visitor << std::endl;
|
||||
std::cout << "root_vertex=" << root_vertex << std::endl;
|
||||
std::cout << "index_map=" << index_map << std::endl;
|
||||
std::cout << "color_map=" << color_map << std::endl;
|
||||
std::cout << "graph=" << graph;
|
||||
std::cout << std::endl;
|
||||
std::cout << "visitor=" << visitor;
|
||||
std::cout << std::endl;
|
||||
std::cout << "root_vertex=" << root_vertex;
|
||||
std::cout << std::endl;
|
||||
std::cout << "index_map=" << index_map;
|
||||
std::cout << std::endl;
|
||||
std::cout << "color_map=" << color_map;
|
||||
std::cout << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
char const* g = "1";
|
||||
depth_first_search(1, 2, 3, 4, 5);
|
||||
depth_first_search(
|
||||
"1", '2', _color_map = '5'
|
||||
g, '2', _color_map = '5'
|
||||
, _index_map = "4", _root_vertex = "3"
|
||||
);
|
||||
return boost::report_errors();
|
||||
|
||||
@@ -17,3 +17,13 @@ struct callable2
|
||||
}
|
||||
};
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
callable2 c2;
|
||||
callable2 const& c2_const = c2;
|
||||
c2_const.call(1, 2);
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,3 +16,12 @@ struct somebody
|
||||
}
|
||||
};
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
somebody::f();
|
||||
somebody::f(4);
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,8 @@ namespace test {
|
||||
|
||||
int main()
|
||||
{
|
||||
int x = test::new_window("alert", test::_width=10, test::_titlebar=false);
|
||||
char const* alert_s = "alert";
|
||||
int x = test::new_window(alert_s, test::_width=10, test::_titlebar=false);
|
||||
test::Foo* foo = new test::Foo();
|
||||
test::smart_ptr<
|
||||
test::Foo
|
||||
|
||||
@@ -5,17 +5,14 @@
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if (BOOST_PARAMETER_MAX_ARITY < 2)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 2 or greater.
|
||||
#endif
|
||||
#if (BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < 3)
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < 3)
|
||||
#error Define BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY \
|
||||
as 3 or greater.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
namespace test {
|
||||
|
||||
@@ -50,11 +47,17 @@ namespace test {
|
||||
};
|
||||
|
||||
std::size_t count_instances::count = 0;
|
||||
} // namespace test
|
||||
|
||||
#include <boost/parameter/name.hpp>
|
||||
|
||||
namespace test {
|
||||
|
||||
BOOST_PARAMETER_NAME(x)
|
||||
BOOST_PARAMETER_NAME(y)
|
||||
} // namespace test
|
||||
|
||||
#include <boost/parameter/preprocessor.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
@@ -107,7 +110,9 @@ namespace test {
|
||||
>::type
|
||||
));
|
||||
x.noop();
|
||||
#if !BOOST_WORKAROUND(BOOST_GCC, < 40000)
|
||||
BOOST_TEST_LT(0, test::count_instances::count);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -125,7 +130,9 @@ namespace test {
|
||||
>::type
|
||||
));
|
||||
x.noop();
|
||||
#if !BOOST_WORKAROUND(BOOST_GCC, < 40000)
|
||||
BOOST_TEST_EQ(1, test::count_instances::count);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
} // namespace test
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(BOOST_PARAMETER_MAX_ARITY < 4)
|
||||
#if (BOOST_PARAMETER_MAX_ARITY < 4)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 4 or greater.
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,15 +5,14 @@
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if (BOOST_PARAMETER_MAX_ARITY < 2)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 2 or greater.
|
||||
#endif
|
||||
#if (BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < 2)
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < 2)
|
||||
#error Define BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY \
|
||||
as 2 or greater.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <boost/parameter/preprocessor.hpp>
|
||||
#include <boost/parameter/name.hpp>
|
||||
|
||||
263
test/parameterized_inheritance.cpp
Normal file
263
test/parameterized_inheritance.cpp
Normal file
@@ -0,0 +1,263 @@
|
||||
// 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)
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if (BOOST_PARAMETER_MAX_ARITY < 3)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 3 or greater.
|
||||
#endif
|
||||
|
||||
#include <boost/parameter/name.hpp>
|
||||
|
||||
namespace test {
|
||||
|
||||
BOOST_PARAMETER_NAME(a0)
|
||||
BOOST_PARAMETER_NAME(a1)
|
||||
BOOST_PARAMETER_NAME(a2)
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
#include <boost/parameter/is_argument_pack.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#endif
|
||||
|
||||
namespace test {
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
struct _enabler
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
class backend0
|
||||
{
|
||||
T _a0;
|
||||
|
||||
public:
|
||||
template <typename ArgPack>
|
||||
explicit backend0(
|
||||
ArgPack const& args
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
, typename boost::enable_if<
|
||||
boost::parameter::is_argument_pack<ArgPack>
|
||||
, test::_enabler
|
||||
>::type = test::_enabler()
|
||||
#endif
|
||||
) : _a0(args[test::_a0])
|
||||
{
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
template <typename U>
|
||||
backend0(
|
||||
backend0<U> const& copy
|
||||
, typename boost::enable_if<
|
||||
boost::is_convertible<U,T>
|
||||
, test::_enabler
|
||||
>::type = test::_enabler()
|
||||
) : _a0(copy.get_a0())
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename Iterator>
|
||||
backend0(Iterator itr, Iterator itr_end) : _a0(itr, itr_end)
|
||||
{
|
||||
}
|
||||
|
||||
T const& get_a0() const
|
||||
{
|
||||
return this->_a0;
|
||||
}
|
||||
|
||||
protected:
|
||||
template <typename ArgPack>
|
||||
void initialize_impl(ArgPack const& args)
|
||||
{
|
||||
this->_a0 = args[test::_a0];
|
||||
}
|
||||
};
|
||||
|
||||
template <typename B, typename T>
|
||||
class backend1 : public B
|
||||
{
|
||||
T _a1;
|
||||
|
||||
public:
|
||||
template <typename ArgPack>
|
||||
explicit backend1(
|
||||
ArgPack const& args
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
, typename boost::enable_if<
|
||||
boost::parameter::is_argument_pack<ArgPack>
|
||||
, test::_enabler
|
||||
>::type = test::_enabler()
|
||||
#endif
|
||||
) : B(args), _a1(args[test::_a1])
|
||||
{
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
template <typename Derived>
|
||||
backend1(
|
||||
Derived const& copy
|
||||
, typename boost::disable_if<
|
||||
boost::parameter::is_argument_pack<Derived>
|
||||
, test::_enabler
|
||||
>::type = test::_enabler()
|
||||
) : B(copy), _a1(copy.get_a1())
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
T const& get_a1() const
|
||||
{
|
||||
return this->_a1;
|
||||
}
|
||||
|
||||
protected:
|
||||
template <typename ArgPack>
|
||||
void initialize_impl(ArgPack const& args)
|
||||
{
|
||||
B::initialize_impl(args);
|
||||
this->_a1 = args[test::_a1];
|
||||
}
|
||||
};
|
||||
|
||||
template <typename B, typename T>
|
||||
class backend2 : public B
|
||||
{
|
||||
T _a2;
|
||||
|
||||
public:
|
||||
template <typename ArgPack>
|
||||
explicit backend2(
|
||||
ArgPack const& args
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
, typename boost::enable_if<
|
||||
boost::parameter::is_argument_pack<ArgPack>
|
||||
, test::_enabler
|
||||
>::type = test::_enabler()
|
||||
#endif
|
||||
) : B(args), _a2(args[test::_a2])
|
||||
{
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
template <typename Derived>
|
||||
backend2(
|
||||
Derived const& copy
|
||||
, typename boost::disable_if<
|
||||
boost::parameter::is_argument_pack<Derived>
|
||||
, test::_enabler
|
||||
>::type = test::_enabler()
|
||||
) : B(copy), _a2(copy.get_a2())
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
T const& get_a2() const
|
||||
{
|
||||
return this->_a2;
|
||||
}
|
||||
|
||||
protected:
|
||||
template <typename ArgPack>
|
||||
void initialize_impl(ArgPack const& args)
|
||||
{
|
||||
B::initialize_impl(args);
|
||||
this->_a2 = args[test::_a2];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#include <boost/parameter/preprocessor_no_spec.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
#include <boost/parameter/are_tagged_arguments.hpp>
|
||||
#endif
|
||||
|
||||
namespace test {
|
||||
|
||||
template <typename B>
|
||||
struct frontend : public B
|
||||
{
|
||||
BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR(frontend, (B))
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
template <typename Iterator>
|
||||
frontend(
|
||||
Iterator itr
|
||||
, Iterator itr_end
|
||||
, typename boost::disable_if<
|
||||
boost::parameter::are_tagged_arguments<Iterator>
|
||||
, test::_enabler
|
||||
>::type = test::_enabler()
|
||||
) : B(itr, itr_end)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename O>
|
||||
frontend(frontend<O> const& copy) : B(copy)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION((void), initialize)
|
||||
{
|
||||
this->initialize_impl(args);
|
||||
}
|
||||
|
||||
BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR((void))
|
||||
{
|
||||
this->initialize_impl(args);
|
||||
}
|
||||
};
|
||||
} // namespace test
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
char const* p = "foo";
|
||||
char const* q = "bar";
|
||||
test::frontend<
|
||||
test::backend2<test::backend1<test::backend0<char const*>, char>, int>
|
||||
> composed_obj0(test::_a2 = 4, test::_a1 = ' ', test::_a0 = p);
|
||||
#if defined(BOOST_NO_SFINAE)
|
||||
test::frontend<
|
||||
test::backend1<test::backend2<test::backend0<char const*>, int>, char>
|
||||
> composed_obj1(test::_a0 = p, test::_a1 = ' ', test::_a2 = 4);
|
||||
#else
|
||||
test::frontend<
|
||||
test::backend1<test::backend2<test::backend0<char const*>, int>, char>
|
||||
> composed_obj1(composed_obj0);
|
||||
#endif
|
||||
BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0());
|
||||
BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1());
|
||||
BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2());
|
||||
composed_obj0.initialize(test::_a0 = q, test::_a1 = '!', test::_a2 = 8);
|
||||
composed_obj1.initialize(test::_a2 = 8, test::_a1 = '!', test::_a0 = q);
|
||||
BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0());
|
||||
BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1());
|
||||
BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2());
|
||||
composed_obj0(test::_a2 = 8, test::_a1 = '!', test::_a0 = q);
|
||||
composed_obj1(test::_a0 = q, test::_a1 = '!', test::_a2 = 8);
|
||||
BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0());
|
||||
BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1());
|
||||
BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2());
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
test::frontend<test::backend0<std::string> > string_wrap(p, p + 3);
|
||||
BOOST_TEST_EQ(string_wrap.get_a0(), std::string(p));
|
||||
#endif
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
#include <boost/parameter/preprocessor.hpp>
|
||||
#include <boost/parameter/keyword.hpp>
|
||||
#include <boost/parameter/binding.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
@@ -46,6 +46,7 @@ namespace test {
|
||||
}
|
||||
} // namespace test
|
||||
|
||||
#include <boost/parameter/value_type.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
namespace test {
|
||||
@@ -195,6 +196,18 @@ namespace test {
|
||||
(index, *)
|
||||
)
|
||||
)
|
||||
|
||||
BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR((int), test::tag,
|
||||
(optional
|
||||
(value, *)
|
||||
(index, *)
|
||||
)
|
||||
)
|
||||
{
|
||||
this->f = args[test::_value | 2.f];
|
||||
this->i = args[test::_index | 1];
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
struct base_1
|
||||
@@ -391,6 +404,16 @@ namespace test {
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR((bool), test::tag,
|
||||
(required
|
||||
(value, *)
|
||||
(index, *)
|
||||
)
|
||||
)
|
||||
{
|
||||
return args[test::_value] < args[test::_index];
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_PARAMETER_FUNCTION((int), sfinae1, test::tag,
|
||||
@@ -423,12 +446,6 @@ namespace test {
|
||||
}
|
||||
#endif // BOOST_NO_SFINAE
|
||||
|
||||
template <typename T>
|
||||
T const& as_lvalue(T const& x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
struct udt
|
||||
{
|
||||
udt(int foo_, int bar_) : foo(foo_), bar(bar_)
|
||||
@@ -453,6 +470,10 @@ namespace test {
|
||||
}
|
||||
} // namespace test
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
|
||||
#include <boost/parameter/aux_/as_lvalue.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
@@ -487,7 +508,7 @@ int main()
|
||||
, std::string("foo")
|
||||
, 1.f
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
|
||||
, test::as_lvalue(2)
|
||||
, boost::parameter::aux::as_lvalue(2)
|
||||
#else
|
||||
, 2
|
||||
#endif
|
||||
@@ -498,7 +519,7 @@ int main()
|
||||
, std::string("foo")
|
||||
, 1.f
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
|
||||
, test::as_lvalue(2)
|
||||
, boost::parameter::aux::as_lvalue(2)
|
||||
#else
|
||||
, 2
|
||||
#endif
|
||||
@@ -515,6 +536,11 @@ int main()
|
||||
BOOST_TEST(2 == u.i);
|
||||
BOOST_TEST(1.f == u.f);
|
||||
|
||||
u();
|
||||
|
||||
BOOST_TEST(1 == u.i);
|
||||
BOOST_TEST(2.f == u.f);
|
||||
|
||||
test::class_1 x(
|
||||
test::values(std::string("foo"), 1.f, 2)
|
||||
, std::string("foo")
|
||||
@@ -563,22 +589,33 @@ int main()
|
||||
, test::_name = std::string("foo")
|
||||
);
|
||||
|
||||
test::predicate p;
|
||||
test::predicate const& p_const = p;
|
||||
|
||||
BOOST_TEST(p_const(3, 4));
|
||||
BOOST_TEST(!p_const(4, 3));
|
||||
BOOST_TEST(!p_const(test::_index = 3, test::_value = 4));
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE) && \
|
||||
!BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
|
||||
BOOST_TEST(test::sfinae("foo") == 1);
|
||||
// GCC 3- tries to bind string literals
|
||||
// to non-const references to char const*.
|
||||
// BOOST_TEST(test::sfinae("foo") == 1);
|
||||
char const* foo_str = "foo";
|
||||
BOOST_TEST(test::sfinae(foo_str) == 1);
|
||||
BOOST_TEST(test::sfinae(1) == 0);
|
||||
|
||||
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
|
||||
// Sun actually eliminates the desired overload for some reason.
|
||||
// Disabling this part of the test because SFINAE abilities are
|
||||
// not the point of this test.
|
||||
BOOST_TEST(test::sfinae1("foo") == 1);
|
||||
BOOST_TEST(test::sfinae1(foo_str) == 1);
|
||||
#endif
|
||||
|
||||
|
||||
BOOST_TEST(test::sfinae1(1) == 0);
|
||||
#endif
|
||||
|
||||
test::lazy_defaults(test::_name = test::udt(0,1));
|
||||
test::lazy_defaults(test::_name = test::udt(0, 1));
|
||||
test::lazy_defaults(test::_name = 0, test::_value = 1, test::_index = 2);
|
||||
|
||||
return boost::report_errors();
|
||||
|
||||
@@ -10,11 +10,13 @@
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "basics.hpp"
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#endif
|
||||
|
||||
namespace test {
|
||||
@@ -30,7 +32,7 @@ namespace test {
|
||||
// template1< r* ( template2<x> ) >
|
||||
//
|
||||
// Workaround: factor template2<x> into separate typedefs
|
||||
struct predicate1
|
||||
struct predicate_int
|
||||
{
|
||||
template <typename From, typename Args>
|
||||
struct apply
|
||||
@@ -43,7 +45,7 @@ namespace test {
|
||||
};
|
||||
};
|
||||
|
||||
struct predicate2
|
||||
struct predicate_string
|
||||
{
|
||||
template <typename From, typename Args>
|
||||
struct apply
|
||||
@@ -116,7 +118,7 @@ namespace test {
|
||||
|
||||
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
|
||||
// SunPro workaround; see above
|
||||
struct predicate3
|
||||
struct predicate_X
|
||||
{
|
||||
template <typename From, typename Args>
|
||||
struct apply
|
||||
@@ -135,11 +137,11 @@ namespace test {
|
||||
)
|
||||
(deduced
|
||||
(required
|
||||
(x, *(test::predicate1))
|
||||
(y, *(test::predicate2))
|
||||
(x, *(test::predicate_int))
|
||||
(y, *(test::predicate_string))
|
||||
)
|
||||
(optional
|
||||
(z, *(test::predicate3), test::X())
|
||||
(z, *(test::predicate_X), test::X())
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -170,7 +172,7 @@ namespace test {
|
||||
BOOST_PARAMETER_FUNCTION((int), sfinae, test::tag,
|
||||
(deduced
|
||||
(required
|
||||
(x, *(test::predicate2))
|
||||
(x, *(test::predicate_string))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -206,6 +208,63 @@ namespace test {
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC) || \
|
||||
!BOOST_WORKAROUND(BOOST_MSVC, < 1800)
|
||||
// Test support for two different Boost.Parameter-enabled
|
||||
// function call operator overloads.
|
||||
class char_read_base
|
||||
{
|
||||
int index;
|
||||
char const* key;
|
||||
|
||||
public:
|
||||
template <typename Args>
|
||||
explicit char_read_base(Args const& args)
|
||||
: index(args[test::_y]), key(args[test::_z])
|
||||
{
|
||||
}
|
||||
|
||||
BOOST_PARAMETER_FUNCTION_CALL_OPERATOR((void), test::tag,
|
||||
(deduced
|
||||
(required
|
||||
(y, (int))
|
||||
(z, (char const*))
|
||||
)
|
||||
)
|
||||
)
|
||||
{
|
||||
this->index = y;
|
||||
this->key = z;
|
||||
}
|
||||
|
||||
BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR((char), test::tag,
|
||||
(deduced
|
||||
(required
|
||||
(y, (bool))
|
||||
(z, (std::map<char const*,std::string>))
|
||||
)
|
||||
)
|
||||
)
|
||||
{
|
||||
return y ? (
|
||||
(z.find(this->key)->second)[this->index]
|
||||
) : this->key[this->index];
|
||||
}
|
||||
};
|
||||
|
||||
struct char_reader : public char_read_base
|
||||
{
|
||||
BOOST_PARAMETER_CONSTRUCTOR(char_reader, (char_read_base), test::tag,
|
||||
(deduced
|
||||
(required
|
||||
(y, (int))
|
||||
(z, (char const*))
|
||||
)
|
||||
)
|
||||
)
|
||||
};
|
||||
#endif // MSVC-11.0-
|
||||
#endif // BOOST_NO_SFINAE
|
||||
} // namespace test
|
||||
|
||||
@@ -287,9 +346,26 @@ int main()
|
||||
);
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
BOOST_TEST(test::sfinae("foo") == 1);
|
||||
BOOST_TEST(test::sfinae(0) == 0);
|
||||
#endif
|
||||
char const* keys[] = {"foo", "bar", "baz"};
|
||||
BOOST_TEST_EQ(1, test::sfinae(keys[0]));
|
||||
BOOST_TEST_EQ(0, test::sfinae(0));
|
||||
#if defined(LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC) || \
|
||||
!BOOST_WORKAROUND(BOOST_MSVC, < 1800)
|
||||
std::map<char const*,std::string> k2s;
|
||||
k2s[keys[0]] = std::string("qux");
|
||||
k2s[keys[1]] = std::string("wmb");
|
||||
k2s[keys[2]] = std::string("zxc");
|
||||
test::char_reader r(keys[0], 0);
|
||||
BOOST_TEST_EQ('q', (r(k2s, true)));
|
||||
BOOST_TEST_EQ('f', (r(k2s, false)));
|
||||
r(keys[1], 1);
|
||||
BOOST_TEST_EQ('m', (r(k2s, true)));
|
||||
BOOST_TEST_EQ('a', (r(k2s, false)));
|
||||
r(keys[2], 2);
|
||||
BOOST_TEST_EQ('c', (r(k2s, true)));
|
||||
BOOST_TEST_EQ('z', (r(k2s, false)));
|
||||
#endif // MSVC-11.0-
|
||||
#endif // BOOST_NO_SFINAE
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -5,12 +5,11 @@
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
|
||||
(BOOST_PARAMETER_MAX_ARITY < 8)
|
||||
#if (BOOST_PARAMETER_MAX_ARITY < 8)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 8 or greater.
|
||||
#endif
|
||||
|
||||
#include <boost/parameter.hpp>
|
||||
#include <boost/parameter/name.hpp>
|
||||
|
||||
namespace test {
|
||||
|
||||
@@ -35,14 +34,23 @@ namespace test {
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include "evaluate_category.hpp"
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if !defined(__MINGW32__) && defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#include <boost/parameter/preprocessor.hpp>
|
||||
#include <utility>
|
||||
#elif defined(BOOST_MSVC)
|
||||
#include <boost/parameter/preprocessor.hpp>
|
||||
#else
|
||||
#include <boost/parameter/preprocessor_no_spec.hpp>
|
||||
#endif
|
||||
|
||||
namespace test {
|
||||
|
||||
struct C
|
||||
{
|
||||
#if ( \
|
||||
!defined(__MINGW32__) && \
|
||||
defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) \
|
||||
) || defined(BOOST_MSVC)
|
||||
typedef boost::mpl::if_<
|
||||
boost::is_convertible<boost::mpl::_,std::bitset<1> >
|
||||
, boost::mpl::true_
|
||||
@@ -100,57 +108,130 @@ namespace test {
|
||||
)
|
||||
)
|
||||
)
|
||||
#else
|
||||
BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR((bool))
|
||||
#endif // msvc, or perfect forwarding support and not mingw
|
||||
{
|
||||
#if ( \
|
||||
!defined(__MINGW32__) && \
|
||||
defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) \
|
||||
) || defined(BOOST_MSVC)
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<0>(lrc0)
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<0>(lrc0)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_lvalue_reference
|
||||
, U::evaluate_category<1>(lr0)
|
||||
test::passed_by_lvalue_reference
|
||||
, test::U::evaluate_category<1>(lr0)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<4>(lrc1)
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<4>(lrc1)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_lvalue_reference
|
||||
, U::evaluate_category<5>(lr1)
|
||||
test::passed_by_lvalue_reference
|
||||
, test::U::evaluate_category<5>(lr1)
|
||||
);
|
||||
#else // mingw, or no perfect forwarding support and not msvc
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<0>(args[test::_lrc0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference
|
||||
, test::U::evaluate_category<1>(args[test::_lr0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<4>(args[test::_lrc1])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference
|
||||
, test::U::evaluate_category<5>(
|
||||
args[test::_lr1 | test::lvalue_bitset<5>()]
|
||||
)
|
||||
);
|
||||
#endif // msvc, or perfect forwarding support and not mingw
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if defined(__MINGW32__)
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_rvalue_reference_to_const
|
||||
, U::evaluate_category<2>(std::forward<rrc0_type>(rrc0))
|
||||
test::passed_by_rvalue_reference_to_const
|
||||
, test::U::evaluate_category<2>(args[test::_rrc0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_rvalue_reference
|
||||
, U::evaluate_category<3>(std::forward<rr0_type>(rr0))
|
||||
test::passed_by_rvalue_reference
|
||||
, test::U::evaluate_category<3>(args[test::_rr0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_rvalue_reference_to_const
|
||||
, U::evaluate_category<6>(std::forward<rrc1_type>(rrc1))
|
||||
test::passed_by_rvalue_reference_to_const
|
||||
, test::U::evaluate_category<6>(
|
||||
args[test::_rrc1 | test::rvalue_const_bitset<6>()]
|
||||
)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_rvalue_reference
|
||||
, U::evaluate_category<7>(std::forward<rr1_type>(rr1))
|
||||
test::passed_by_rvalue_reference
|
||||
, test::U::evaluate_category<7>(
|
||||
args[test::_rr1 | test::rvalue_bitset<7>()]
|
||||
)
|
||||
);
|
||||
#else // !defined(__MINGW32__)
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_rvalue_reference_to_const
|
||||
, test::U::evaluate_category<2>(std::forward<rrc0_type>(rrc0))
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_rvalue_reference
|
||||
, test::U::evaluate_category<3>(std::forward<rr0_type>(rr0))
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_rvalue_reference_to_const
|
||||
, test::U::evaluate_category<6>(std::forward<rrc1_type>(rrc1))
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_rvalue_reference
|
||||
, test::U::evaluate_category<7>(std::forward<rr1_type>(rr1))
|
||||
);
|
||||
#endif // __MINGW32__
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if defined(BOOST_MSVC)
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<2>(rrc0)
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<2>(rrc0)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<3>(rr0)
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<3>(rr0)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<6>(rrc1)
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<6>(rrc1)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
passed_by_lvalue_reference_to_const
|
||||
, U::evaluate_category<7>(rr1)
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<7>(rr1)
|
||||
);
|
||||
#else // !defined(BOOST_MSVC)
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<2>(args[test::_rrc0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<3>(args[test::_rr0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<6>(
|
||||
args[test::_rrc1 | test::rvalue_const_bitset<6>()]
|
||||
)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<7>(
|
||||
args[test::_rr1 | test::rvalue_bitset<7>()]
|
||||
)
|
||||
);
|
||||
#endif // BOOST_MSVC
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
|
||||
return true;
|
||||
@@ -163,6 +244,10 @@ int main()
|
||||
test::C cp0;
|
||||
test::C cp1;
|
||||
|
||||
#if ( \
|
||||
!defined(__MINGW32__) && \
|
||||
defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) \
|
||||
) || defined(BOOST_MSVC)
|
||||
cp0(
|
||||
test::lvalue_const_bitset<4>()
|
||||
, test::lvalue_const_bitset<0>()
|
||||
@@ -188,6 +273,33 @@ int main()
|
||||
, test::rvalue_bitset<7>()
|
||||
, test::lvalue_const_bitset<0>()
|
||||
);
|
||||
#else // mingw, or no perfect forwarding support and not msvc
|
||||
cp0(
|
||||
test::_lrc1 = test::lvalue_const_bitset<4>()
|
||||
, test::_lrc0 = test::lvalue_const_bitset<0>()
|
||||
, test::_lr0 = test::lvalue_bitset<1>()
|
||||
, test::_rrc0 = test::rvalue_const_bitset<2>()
|
||||
, test::_rr0 = test::rvalue_bitset<3>()
|
||||
);
|
||||
cp0(
|
||||
test::_lrc1 = test::lvalue_const_bitset<4>()
|
||||
, test::_lrc0 = test::lvalue_const_bitset<0>()
|
||||
, test::_rrc1 = test::rvalue_const_bitset<6>()
|
||||
, test::_lr0 = test::lvalue_bitset<1>()
|
||||
, test::_rrc0 = test::rvalue_const_bitset<2>()
|
||||
, test::_rr0 = test::rvalue_bitset<3>()
|
||||
);
|
||||
cp1(
|
||||
test::_lr0 = test::lvalue_bitset<1>()
|
||||
, test::_rrc0 = test::rvalue_const_bitset<2>()
|
||||
, test::_rr0 = test::rvalue_bitset<3>()
|
||||
, test::_lrc1 = test::lvalue_const_bitset<4>()
|
||||
, test::_lr1 = test::lvalue_bitset<5>()
|
||||
, test::_rrc1 = test::rvalue_const_bitset<6>()
|
||||
, test::_rr1 = test::rvalue_bitset<7>()
|
||||
, test::_lrc0 = test::lvalue_const_bitset<0>()
|
||||
);
|
||||
#endif // msvc, or perfect forwarding support and not mingw
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
524
test/preprocessor_eval_cat_no_spec.cpp
Normal file
524
test/preprocessor_eval_cat_no_spec.cpp
Normal file
@@ -0,0 +1,524 @@
|
||||
// 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)
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if (BOOST_PARAMETER_MAX_ARITY < 8)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 8 or greater.
|
||||
#endif
|
||||
|
||||
#include <boost/parameter/name.hpp>
|
||||
|
||||
namespace test {
|
||||
|
||||
BOOST_PARAMETER_NAME((_lrc0, kw0) in(lrc0))
|
||||
BOOST_PARAMETER_NAME((_lr0, kw1) in_out(lr0))
|
||||
BOOST_PARAMETER_NAME((_rrc0, kw2) in(rrc0))
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_PARAMETER_NAME((_rr0, kw3) consume(rr0))
|
||||
#else
|
||||
BOOST_PARAMETER_NAME((_rr0, kw3) rr0)
|
||||
#endif
|
||||
BOOST_PARAMETER_NAME((_lrc1, kw4) in(lrc1))
|
||||
BOOST_PARAMETER_NAME((_lr1, kw5) out(lr1))
|
||||
BOOST_PARAMETER_NAME((_rrc1, kw6) in(rrc1))
|
||||
BOOST_PARAMETER_NAME((_rr1, kw7) rr1)
|
||||
} // namespace test
|
||||
|
||||
#include <boost/parameter/preprocessor_no_spec.hpp>
|
||||
#include <boost/parameter/value_type.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/type_traits/is_scalar.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include "evaluate_category.hpp"
|
||||
|
||||
namespace test {
|
||||
|
||||
BOOST_PARAMETER_NO_SPEC_FUNCTION((bool), evaluate)
|
||||
{
|
||||
BOOST_TEST((
|
||||
test::passed_by_lvalue_reference_to_const == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw0::lrc0
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(args[test::_lrc0])
|
||||
));
|
||||
BOOST_TEST((
|
||||
test::passed_by_lvalue_reference == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw1::lr0
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(args[test::_lr0])
|
||||
));
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
if (
|
||||
boost::is_scalar<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw2::rrc0
|
||||
>::type
|
||||
>::type
|
||||
>::value
|
||||
)
|
||||
{
|
||||
BOOST_TEST((
|
||||
test::passed_by_lvalue_reference_to_const == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw2::rrc0
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(args[test::_rrc0])
|
||||
));
|
||||
BOOST_TEST((
|
||||
test::passed_by_lvalue_reference_to_const == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw3::rr0
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(args[test::_rr0])
|
||||
));
|
||||
}
|
||||
else // rrc0's value type isn't scalar
|
||||
{
|
||||
BOOST_TEST((
|
||||
test::passed_by_rvalue_reference_to_const == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw2::rrc0
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(args[test::_rrc0])
|
||||
));
|
||||
BOOST_TEST((
|
||||
test::passed_by_rvalue_reference == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw3::rr0
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(args[test::_rr0])
|
||||
));
|
||||
}
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST((
|
||||
test::passed_by_lvalue_reference_to_const == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw2::rrc0
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(args[test::_rrc0])
|
||||
));
|
||||
BOOST_TEST((
|
||||
test::passed_by_lvalue_reference_to_const == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw3::rr0
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(args[test::_rr0])
|
||||
));
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace test
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
#include <boost/tti/detail/dnullptr.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
#endif
|
||||
|
||||
namespace test {
|
||||
|
||||
char const* baz = "baz";
|
||||
|
||||
struct B
|
||||
{
|
||||
#if !defined(LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC) && \
|
||||
BOOST_WORKAROUND(BOOST_MSVC, >= 1800)
|
||||
B()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename Args>
|
||||
explicit B(
|
||||
Args const& args
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
, typename boost::disable_if<
|
||||
typename boost::mpl::if_<
|
||||
boost::is_base_of<B,Args>
|
||||
, boost::mpl::true_
|
||||
, boost::mpl::false_
|
||||
>::type
|
||||
>::type* = BOOST_TTI_DETAIL_NULLPTR
|
||||
#endif // BOOST_NO_SFINAE
|
||||
)
|
||||
{
|
||||
test::evaluate(
|
||||
test::_lrc0 = args[test::_lrc0]
|
||||
, test::_lr0 = args[test::_lr0]
|
||||
, test::_rrc0 = args[test::_rrc0]
|
||||
, test::_rr0 = args[test::_rr0]
|
||||
);
|
||||
}
|
||||
|
||||
BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION((bool), static evaluate)
|
||||
{
|
||||
BOOST_TEST((
|
||||
test::passed_by_lvalue_reference_to_const == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw0::lrc0
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(args[test::_lrc0])
|
||||
));
|
||||
BOOST_TEST((
|
||||
test::passed_by_lvalue_reference == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw1::lr0
|
||||
, char const*
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(args[test::_lr0 | test::baz])
|
||||
));
|
||||
BOOST_TEST((
|
||||
test::passed_by_lvalue_reference_to_const == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw2::rrc0
|
||||
, float
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(args[test::_rrc0 | 0.0f])
|
||||
));
|
||||
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST((
|
||||
test::passed_by_rvalue_reference == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw3::rr0
|
||||
, std::string
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(
|
||||
args[
|
||||
test::_rr0 | std::string(args[test::_lr0 | test::baz])
|
||||
]
|
||||
)
|
||||
));
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST((
|
||||
test::passed_by_lvalue_reference_to_const == test::A<
|
||||
typename boost::remove_const<
|
||||
typename boost::parameter::value_type<
|
||||
Args
|
||||
, test::kw3::rr0
|
||||
, std::string
|
||||
>::type
|
||||
>::type
|
||||
>::evaluate_category(
|
||||
args[
|
||||
test::_rr0 | std::string(args[test::_lr0 | test::baz])
|
||||
]
|
||||
)
|
||||
));
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
struct C : B
|
||||
{
|
||||
#if !defined(LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC) && \
|
||||
BOOST_WORKAROUND(BOOST_MSVC, >= 1800)
|
||||
C() : B()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR(C, (B))
|
||||
};
|
||||
|
||||
struct D
|
||||
{
|
||||
BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR(D, D::_evaluate)
|
||||
|
||||
BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION((bool), evaluate_m)
|
||||
{
|
||||
return D::_evaluate(args);
|
||||
}
|
||||
|
||||
BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR((bool))
|
||||
{
|
||||
return D::_evaluate(args);
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename Args>
|
||||
static bool _evaluate(Args const& args)
|
||||
{
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<0>(args[test::_lrc0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference
|
||||
, test::U::evaluate_category<1>(args[test::_lr0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<4>(args[test::_lrc1])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference
|
||||
, test::U::evaluate_category<5>(
|
||||
args[test::_lr1 | test::lvalue_bitset<5>()]
|
||||
)
|
||||
);
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_rvalue_reference_to_const
|
||||
, test::U::evaluate_category<2>(args[test::_rrc0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_rvalue_reference
|
||||
, test::U::evaluate_category<3>(args[test::_rr0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_rvalue_reference_to_const
|
||||
, test::U::evaluate_category<6>(
|
||||
args[test::_rrc1 | test::rvalue_const_bitset<6>()]
|
||||
)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_rvalue_reference
|
||||
, test::U::evaluate_category<7>(
|
||||
args[test::_rr1 | test::rvalue_bitset<7>()]
|
||||
)
|
||||
);
|
||||
#else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<2>(args[test::_rrc0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<3>(args[test::_rr0])
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<6>(
|
||||
args[test::_rrc1 | test::rvalue_const_bitset<6>()]
|
||||
)
|
||||
);
|
||||
BOOST_TEST_EQ(
|
||||
test::passed_by_lvalue_reference_to_const
|
||||
, test::U::evaluate_category<7>(
|
||||
args[test::_rr1 | test::rvalue_bitset<7>()]
|
||||
)
|
||||
);
|
||||
#endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
} // namespace test
|
||||
|
||||
int main()
|
||||
{
|
||||
test::evaluate(
|
||||
test::_lr0 = test::lvalue_float()
|
||||
, test::_rrc0 = test::rvalue_const_float()
|
||||
, test::_rr0 = test::rvalue_float()
|
||||
, test::_lrc0 = test::lvalue_const_float()
|
||||
);
|
||||
test::evaluate(
|
||||
test::_lr0 = test::lvalue_char_ptr()
|
||||
, test::_rrc0 = test::rvalue_const_char_ptr()
|
||||
, test::_rr0 = test::rvalue_char_ptr()
|
||||
, test::_lrc0 = test::lvalue_const_char_ptr()
|
||||
);
|
||||
test::evaluate(
|
||||
test::_lr0 = test::lvalue_str()
|
||||
, test::_rrc0 = test::rvalue_const_str()
|
||||
, test::_rr0 = test::rvalue_str()
|
||||
, test::_lrc0 = test::lvalue_const_str()
|
||||
);
|
||||
|
||||
test::C cf1(
|
||||
test::_lr0 = test::lvalue_float()
|
||||
, test::_rrc0 = test::rvalue_const_float()
|
||||
, test::_rr0 = test::rvalue_float()
|
||||
, test::_lrc0 = test::lvalue_const_float()
|
||||
);
|
||||
test::C cc1(
|
||||
test::_lr0 = test::lvalue_char_ptr()
|
||||
, test::_rrc0 = test::rvalue_const_char_ptr()
|
||||
, test::_rr0 = test::rvalue_char_ptr()
|
||||
, test::_lrc0 = test::lvalue_const_char_ptr()
|
||||
);
|
||||
test::C cs1(
|
||||
test::_lr0 = test::lvalue_str()
|
||||
, test::_rrc0 = test::rvalue_const_str()
|
||||
, test::_rr0 = test::rvalue_str()
|
||||
, test::_lrc0 = test::lvalue_const_str()
|
||||
);
|
||||
|
||||
char baz_arr[4] = "qux";
|
||||
typedef char char_arr[4];
|
||||
|
||||
#if !defined(LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC) && ( \
|
||||
BOOST_WORKAROUND(BOOST_GCC, < 40000) || \
|
||||
BOOST_WORKAROUND(BOOST_MSVC, >= 1800) \
|
||||
)
|
||||
// MSVC-12+ treats static_cast<char_arr&&>(baz_arr) as an lvalue.
|
||||
// GCC 3- tries to bind string literals
|
||||
// to non-const references to char const*.
|
||||
#else
|
||||
test::evaluate(
|
||||
test::_lr0 = baz_arr
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
, test::_rrc0 = static_cast<char_arr const&&>("def")
|
||||
, test::_rr0 = static_cast<char_arr&&>(baz_arr)
|
||||
#else
|
||||
, test::_rrc0 = "grl"
|
||||
, test::_rr0 = "grp"
|
||||
#endif
|
||||
, test::_lrc0 = "wld"
|
||||
);
|
||||
#endif // MSVC-12+
|
||||
test::B::evaluate(test::_lrc0 = test::lvalue_const_str()[0]);
|
||||
test::C::evaluate(
|
||||
test::_rrc0 = test::rvalue_const_float()
|
||||
, test::_lrc0 = test::lvalue_const_str()[0]
|
||||
);
|
||||
|
||||
#if !defined(LIBS_PARAMETER_TEST_COMPILE_FAILURE_MSVC) && \
|
||||
BOOST_WORKAROUND(BOOST_MSVC, >= 1800)
|
||||
// MSVC-12+ treats static_cast<char_arr&&>(baz_arr) as an lvalue.
|
||||
test::C cp0;
|
||||
test::C cp1;
|
||||
#else
|
||||
test::C cp0(
|
||||
test::_lrc0 = "frd"
|
||||
, test::_lr0 = baz_arr
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
, test::_rrc0 = static_cast<char_arr const&&>("dfs")
|
||||
, test::_rr0 = static_cast<char_arr&&>(baz_arr)
|
||||
#else
|
||||
, test::_rrc0 = "plg"
|
||||
, test::_rr0 = "thd"
|
||||
#endif
|
||||
);
|
||||
test::C cp1(
|
||||
test::_lr0 = baz_arr
|
||||
#if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
, test::_rrc0 = static_cast<char_arr const&&>("dgx")
|
||||
, test::_rr0 = static_cast<char_arr&&>(baz_arr)
|
||||
#else
|
||||
, test::_rrc0 = "hnk"
|
||||
, test::_rr0 = "xzz"
|
||||
#endif
|
||||
, test::_lrc0 = "zts"
|
||||
);
|
||||
#endif // MSVC-12+
|
||||
|
||||
cp0.evaluate(
|
||||
test::_lrc0 = test::lvalue_const_str()[0]
|
||||
, test::_lr0 = test::lvalue_char_ptr()
|
||||
, test::_rr0 = test::rvalue_str()
|
||||
, test::_rrc0 = test::rvalue_const_float()
|
||||
);
|
||||
cp1.evaluate(
|
||||
test::_lrc0 = test::lvalue_const_str()[0]
|
||||
, test::_rr0 = test::rvalue_str()
|
||||
, test::_rrc0 = test::rvalue_const_float()
|
||||
, test::_lr0 = test::lvalue_char_ptr()
|
||||
);
|
||||
|
||||
test::D dp0(
|
||||
test::_lrc1 = test::lvalue_const_bitset<4>()
|
||||
, test::_lrc0 = test::lvalue_const_bitset<0>()
|
||||
, test::_lr0 = test::lvalue_bitset<1>()
|
||||
, test::_rrc0 = test::rvalue_const_bitset<2>()
|
||||
, test::_rr0 = test::rvalue_bitset<3>()
|
||||
);
|
||||
test::D dp1(
|
||||
test::_lrc1 = test::lvalue_const_bitset<4>()
|
||||
, test::_lrc0 = test::lvalue_const_bitset<0>()
|
||||
, test::_rrc1 = test::rvalue_const_bitset<6>()
|
||||
, test::_lr0 = test::lvalue_bitset<1>()
|
||||
, test::_rrc0 = test::rvalue_const_bitset<2>()
|
||||
, test::_rr0 = test::rvalue_bitset<3>()
|
||||
);
|
||||
|
||||
dp0.evaluate_m(
|
||||
test::_lrc1 = test::lvalue_const_bitset<4>()
|
||||
, test::_lrc0 = test::lvalue_const_bitset<0>()
|
||||
, test::_rrc1 = test::rvalue_const_bitset<6>()
|
||||
, test::_lr0 = test::lvalue_bitset<1>()
|
||||
, test::_rrc0 = test::rvalue_const_bitset<2>()
|
||||
, test::_rr0 = test::rvalue_bitset<3>()
|
||||
);
|
||||
dp1.evaluate_m(
|
||||
test::_lr0 = test::lvalue_bitset<1>()
|
||||
, test::_rrc0 = test::rvalue_const_bitset<2>()
|
||||
, test::_rr0 = test::rvalue_bitset<3>()
|
||||
, test::_lrc1 = test::lvalue_const_bitset<4>()
|
||||
, test::_lr1 = test::lvalue_bitset<5>()
|
||||
, test::_rrc1 = test::rvalue_const_bitset<6>()
|
||||
, test::_rr1 = test::rvalue_bitset<7>()
|
||||
, test::_lrc0 = test::lvalue_const_bitset<0>()
|
||||
);
|
||||
dp0(
|
||||
test::_lrc1 = test::lvalue_const_bitset<4>()
|
||||
, test::_lrc0 = test::lvalue_const_bitset<0>()
|
||||
, test::_lr0 = test::lvalue_bitset<1>()
|
||||
, test::_rrc0 = test::rvalue_const_bitset<2>()
|
||||
, test::_rr0 = test::rvalue_bitset<3>()
|
||||
);
|
||||
dp1(
|
||||
test::_lr0 = test::lvalue_bitset<1>()
|
||||
, test::_rrc0 = test::rvalue_const_bitset<2>()
|
||||
, test::_rr0 = test::rvalue_bitset<3>()
|
||||
, test::_lrc1 = test::lvalue_const_bitset<4>()
|
||||
, test::_lr1 = test::lvalue_bitset<5>()
|
||||
, test::_rrc1 = test::rvalue_const_bitset<6>()
|
||||
, test::_rr1 = test::rvalue_bitset<7>()
|
||||
, test::_lrc0 = test::lvalue_const_bitset<0>()
|
||||
);
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if (BOOST_PARAMETER_MAX_ARITY < 2)
|
||||
#error Define BOOST_PARAMETER_MAX_ARITY as 2 or greater.
|
||||
#endif
|
||||
#if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
|
||||
#if (BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < 3)
|
||||
#error Define BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY \
|
||||
as 3 or greater.
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace test {
|
||||
} // namespace test
|
||||
|
||||
#include <boost/parameter/is_argument_pack.hpp>
|
||||
#include <boost/mpl/has_key.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
namespace test {
|
||||
@@ -45,12 +47,10 @@ namespace test {
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/has_key.hpp>
|
||||
#include <boost/mpl/key_type.hpp>
|
||||
#include <boost/mpl/order.hpp>
|
||||
#include <boost/mpl/count.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
namespace test {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user