Documentation for variadic opt functionality.

This commit is contained in:
Edward Diener
2019-09-25 15:43:07 -04:00
parent e476f10f52
commit 22deb165b6
8 changed files with 95 additions and 4 deletions

View File

@ -230,6 +230,7 @@
<li><a href="headers/variadic.html">variadic.hpp</a></li>
<li>variadic/</li>
<li class="ps"><a href="headers/variadic/elem.html">elem.hpp</a> <a href="topics/variadic_macros.html#VNotation">(v)</a></li>
<li class="ps"><a href="headers/variadic/opt.html">opt.hpp</a> </li>
<li class="ps"><a href="headers/variadic/size.html">size.hpp</a> <a href="topics/variadic_macros.html#VNotation">(v)</a></li>
<li class="ps"><a href="headers/variadic/to_array.html">to_array.hpp</a> <a
href="topics/variadic_macros.html#VNotation">(v)</a></li>

View File

@ -14,6 +14,7 @@
<h4>Includes</h4>
<ul>
<li><a href="variadic/elem.html">&lt;boost/preprocessor/variadic/elem.hpp&gt;</a> <a href="../topics/variadic_macros.html#VNotation" target="_self">(v)</a></li>
<li><a href="variadic/opt.html">&lt;boost/preprocessor/variadic/opt.hpp&gt;</a> </li>
<li><a href="variadic/size.html">&lt;boost/preprocessor/variadic/size.hpp&gt;</a> <a href="../topics/variadic_macros.html#VNotation" target="_self">(v)</a></li>
<li><a href="variadic/to_array.html">&lt;boost/preprocessor/variadic/to_array.hpp&gt;</a> <a href="../topics/variadic_macros.html#VNotation" target="_self">(v)</a></li>
<li><a href="variadic/to_list.html">&lt;boost/preprocessor/variadic/to_list.hpp&gt;</a> <a href="../topics/variadic_macros.html#VNotation" target="_self">(v)</a></li>
@ -22,7 +23,7 @@
</ul>
<hr size="1">
<div style="margin-left: 0px;">
<i></i><i><EFBFBD> Copyright Edward Diener 2011,2013</i>
<i></i><i><EFBFBD> Copyright Edward Diener 2011,2013,2019</i>
</div>
<div style="margin-left: 0px;">
<p><small>Distributed under the Boost Software License, Version 1.0. (See

View File

@ -0,0 +1,25 @@
<html><head>
<title>variadic/opt.hpp</title>
<link rel="stylesheet" type="text/css" href="../../styles.css"></head><body>
<div style="margin-left: 0px;">
The <b>variadic/opt.hpp</b> header defines a macro that determines whether or not the __VA_OPT__ construct is supported.
</div>
<h4>Usage</h4>
<div class="code">
#include <b>&lt;boost/preprocessor/variadic/opt.hpp&gt;</b>
</div>
<h4>Contents</h4>
<ul>
<li><a href="../../ref/variadic_opt.html">BOOST_PP_VARIADIC_OPT</a> <br>
</li>
</ul>
<hr size="1">
<div style="margin-left: 0px;">
<i></i><i><EFBFBD> Copyright Edward Diener 2019</i>
</div>
<div style="margin-left: 0px;">
<p><small>Distributed under the Boost Software License, Version 1.0. (See
accompanying file <a href="../../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
copy at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
</div>
</body></html>

View File

@ -298,6 +298,7 @@
<li><a href="ref/value.html">VALUE</a></li>
<li><a href="ref/variadics.html">VARIADICS</a></li>
<li><a href="ref/variadic_elem.html">VARIADIC_ELEM</a> <a href="topics/variadic_macros.html#VNotation">(v)</a></li>
<li><a href="ref/variadic_opt.html">VARIADIC_OPT</a></li>
<li><a href="ref/variadic_seq_to_seq.html">VARIADIC_SEQ_TO_SEQ</a> <a href="topics/variadic_macros.html#VNotation">(v)</a></li>
<li><a href="ref/variadic_size.html">VARIADIC_SIZE</a> <a href="topics/variadic_macros.html#VNotation">(v)</a></li>
<li><a href="ref/variadic_to_array.html">VARIADIC_TO_ARRAY</a> <a href="topics/variadic_macros.html#VNotation">(v)</a></li>

41
doc/ref/variadic_opt.html Normal file
View File

@ -0,0 +1,41 @@
<html>
<head>
<title>BOOST_PP_VARIADIC_OPT</title>
<link rel="stylesheet" type="text/css" href="../styles.css">
</head>
<body>
<div style="margin-left: 0px;"> The <b>BOOST_PP_VARIADIC_OPT</b> macro
determines whether or not the C++20 __VA_OPT__ construct is supported for the compiler's preprocessor being used.
Expands to 1 if the __VA_OPT__ construct is supported, otherwise expands to 0.
</div>
<h4>Usage</h4>
<div class="code"> <b>BOOST_PP_VARIADIC_OPT</b>() <br>
</div>
<h4>Arguments</h4>
<dl>
<dt>None<br>
</dt>
</dl>
<h4>Requirements</h4>
<div> <b>Header:</b> &nbsp;<a href="../headers/variadic/opt.html">&lt;boost/preprocessor/variadic/opt.hpp&gt;</a>
</div>
<h4>Sample Code</h4>
<div>
<pre>
#include &lt;<a href="../headers/variadic/opt.html">boost/preprocessor/variadic/opt.hpp</a>&gt;<br>
#if <a href="variadic_opt.html">BOOST_PP_VARIADIC_OPT</a>()<br>
// Preprocessor code which uses __VA_OPT__<br>
#else<br>
// Preprocessor code which does not use __VA_OPT__<br>
#endif<br>
</pre>
</div>
<hr size="1">
<div style="margin-left: 0px;"> <i></i><i><EFBFBD> Copyright Edward Diener 2019</i> </div>
<div style="margin-left: 0px;">
<p><small>Distributed under the Boost Software License, Version 1.0.
(See accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a>
or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
</div>
</body>
</html>

View File

@ -284,6 +284,7 @@
<!-- V -->
<br>BOOST_PP_VALUE
<br>BOOST_PP_VARIADIC_ELEM
<br>BOOST_PP_VARIADIC_OPT
<br>BOOST_PP_VARIADIC_SIZE
<br>BOOST_PP_VARIADIC_TO_ARRAY
<br>BOOST_PP_VARIADIC_TO_LIST

View File

@ -136,6 +136,27 @@
use this variadic data reliably as arguments to other macros, one needs
variadic macro support.<br>
</div>
<h4>C++20 Support For Variadic Macros</h4>
<div>
In the C++20 specification there is a new construct which can be
used in the expansion of a variadic macro, called __VA_OPT__. This
construct when used in the expansion of a variadic macro is followed
by an opening paranthesis ('('), preprocessor data, and a closing
parenthesis ('}'). When the variadic data passed by the invocation
of a variadic macro is empty, this new construct expands to nothing.
When the variadic data passed by the invocation of a variadic macro
is not empty, this new construct expands to the preprocessor data
between its opening and closing parentheses.
<br><br>
This library offers support for this new C++20 construct by automatically
detecting whether this new construct is supported by the compiler's
preprocessor when using the library. The library macro which detects
support for the __VA_OPT__ construct is called BOOST_PP_VARIADIC_OPT.
This is a function-like macro which takes no parameters and returns
1 if the compiler is working in C++20 mode and supports the __VA_OPT__
construct, while otherwise it returns 0.
<br>
</div>
<u style="font-weight: bold;"> Using a Tuple Instead of an Array<br>
</u>
<div>An array as a preprocessor data type is a two-element tuple where the
@ -257,6 +278,5 @@
(See accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a>
or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
</div>
</body></html>
</body>
</html>