forked from boostorg/preprocessor
Changed name of macro from BOOST_PP_VARIADIC_OPT to BOOST_PP_VARIADIC_HAS_OPT
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
</div>
|
||||
<h4>Contents</h4>
|
||||
<ul>
|
||||
<li><a href="../../ref/variadic_opt.html">BOOST_PP_VARIADIC_OPT</a> <br>
|
||||
<li><a href="../../ref/variadic_opt.html">BOOST_PP_VARIADIC_HAS_OPT</a> <br>
|
||||
</li>
|
||||
</ul>
|
||||
<hr size="1">
|
||||
|
@ -299,7 +299,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_opt.html">VARIADIC_HAS_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>
|
||||
|
@ -19,17 +19,17 @@ the compilation is at the C++20 level and the __VA_OPT__ construct is supported.
|
||||
</dl>
|
||||
<h4>Remarks</h4>
|
||||
<div>
|
||||
When the macro invocation BOOST_PP_VARIADIC_OPT() expands to 1, then this
|
||||
When the macro invocation BOOST_PP_VARIADIC_HAS_OPT() expands to 1, then this
|
||||
macro exists and can be invoked, otherwise this macro does not exist
|
||||
and attempting to invoke it will lead to a preprocessor error that the macro
|
||||
can not be found. Because of this condition the header file for including
|
||||
this macro includes the header file for the BOOST_PP_VARIADIC_OPT macro.<br>
|
||||
this macro includes the header file for the BOOST_PP_VARIADIC_HAS_OPT macro.<br>
|
||||
It is possible to pass data to this macro which expands to nothing, in which
|
||||
case this macro will expand to 1 just as if nothing has been passed.
|
||||
</div>
|
||||
<h4>See Also</h4>
|
||||
<ul>
|
||||
<li><a href="variadic_opt.html">BOOST_PP_VARIADIC_OPT</a></li>
|
||||
<li><a href="variadic_opt.html">BOOST_PP_VARIADIC_HAS_OPT</a></li>
|
||||
</ul>
|
||||
<h4>Requirements</h4>
|
||||
<div> <b>Header:</b> <a href="../headers/facilities/check_empty.html"><boost/preprocessor/facilities/check_empty.hpp></a>
|
||||
@ -39,7 +39,7 @@ case this macro will expand to 1 just as if nothing has been passed.
|
||||
<pre>
|
||||
#include <<a href="../headers/facilities/check_empty.html">boost/preprocessor/facilities/check_empty.hpp</a>>
|
||||
|
||||
# if <a href="variadic_opt.html">BOOST_PP_VARIADIC_OPT</a>()
|
||||
# if <a href="variadic_opt.html">BOOST_PP_VARIADIC_HAS_OPT</a>()
|
||||
|
||||
#define DATA
|
||||
#define OBJECT OBJECT2
|
||||
|
@ -1,15 +1,15 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>BOOST_PP_VARIADIC_OPT</title>
|
||||
<title>BOOST_PP_VARIADIC_HAS_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
|
||||
<div style="margin-left: 0px;"> The <b>BOOST_PP_VARIADIC_HAS_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 class="code"> <b>BOOST_PP_VARIADIC_HAS_OPT</b>() <br>
|
||||
</div>
|
||||
<h4>Arguments</h4>
|
||||
<dl>
|
||||
@ -36,7 +36,7 @@ Expands to 1 if the __VA_OPT__ construct is supported, otherwise expands to 0.
|
||||
<div>
|
||||
<pre>
|
||||
#include <<a href="../headers/variadic/opt.html">boost/preprocessor/variadic/opt.hpp</a>><br>
|
||||
#if <a href="variadic_opt.html">BOOST_PP_VARIADIC_OPT</a>()
|
||||
#if <a href="variadic_opt.html">BOOST_PP_VARIADIC_HAS_OPT</a>()
|
||||
// Preprocessor code which uses __VA_OPT__
|
||||
#else
|
||||
// Preprocessor code which does not use __VA_OPT__
|
||||
@ -47,7 +47,7 @@ or within a macro definition<br><br>
|
||||
<pre>
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
#include <<a href="../headers/variadic/opt.html">boost/preprocessor/variadic/opt.hpp</a>><br>
|
||||
#define USE_OPT(...) BOOST_PP_IIF(<a href="variadic_opt.html">BOOST_PP_VARIADIC_OPT</a>(),MACRO_USING_OPT,MACRO_NOT_USING_OPT)(__VA_ARGS__)
|
||||
#define USE_OPT(...) BOOST_PP_IIF(<a href="variadic_opt.html">BOOST_PP_VARIADIC_HAS_OPT</a>(),MACRO_USING_OPT,MACRO_NOT_USING_OPT)(__VA_ARGS__)
|
||||
#define MACRO_USING_OPT(...) __VA_OPT__( preprocessor tokens ) anything
|
||||
#define MACRO_NOT_USING_OPT(...) anything
|
||||
</pre>
|
||||
|
@ -284,7 +284,7 @@
|
||||
<!-- V -->
|
||||
<br>BOOST_PP_VALUE
|
||||
<br>BOOST_PP_VARIADIC_ELEM
|
||||
<br>BOOST_PP_VARIADIC_OPT
|
||||
<br>BOOST_PP_VARIADIC_HAS_OPT
|
||||
<br>BOOST_PP_VARIADIC_SIZE
|
||||
<br>BOOST_PP_VARIADIC_TO_ARRAY
|
||||
<br>BOOST_PP_VARIADIC_TO_LIST
|
||||
|
@ -98,7 +98,7 @@
|
||||
not publicly appeared. This library uses that code to test for __VA_OPT__ as a necessary prelude
|
||||
for creating a variadic macro which is 100% reliable in testing for emptiness.<br><br>
|
||||
The Boost Preprocessor macro for testing whether the __VA_OPT__ construct is supported during
|
||||
compilation is called BOOST_PP_VARIADIC_OPT, which is a function-like macro taking no parameters
|
||||
compilation is called BOOST_PP_VARIADIC_HAS_OPT, which is a function-like macro taking no parameters
|
||||
and returning 1 if the __VA_OPT__ construct is supported and 0 if it is not. The macro
|
||||
only returns 1 when variadic macros are supported, when the compiler is at the C++20 level,
|
||||
and when the __VA_OPT__ construct can be used according to the C++20 standard. In particular
|
||||
@ -109,13 +109,13 @@
|
||||
can produce a warning, or even an error, when it even sees a macro using the __VA_OPT__
|
||||
construct at a level below C++20, even though it supports it, if other compiler options
|
||||
requiring strict adherence to the level of the C++ standard being used are passed on the
|
||||
command line. So taking a conservative approach the BOOST_PP_VARIADIC_OPT macros requires
|
||||
command line. So taking a conservative approach the BOOST_PP_VARIADIC_HAS_OPT macros requires
|
||||
compilation at the C++20 level, along with variadic macro support, along with the testing code
|
||||
expanding to 1, in order to specify that __VA_OPT__ is supported.<br><br>
|
||||
The actual Boost Preprocessor library for testing for emptiness in C++20 mode is called
|
||||
BOOST_PP_CHECK_EMPTY. The macro is a variadic macro with a single variadic parameter. The
|
||||
macro only exists if our previous macro for testing for __VA_OPT__ called BOOST_PP_VARIADIC_OPT
|
||||
expands to 1 when invoked as BOOST_PP_VARIADIC_OPT(). If BOOST_PP_VARIADIC_OPT() expands to 0
|
||||
macro only exists if our previous macro for testing for __VA_OPT__ called BOOST_PP_VARIADIC_HAS_OPT
|
||||
expands to 1 when invoked as BOOST_PP_VARIADIC_HAS_OPT(). If BOOST_PP_VARIADIC_HAS_OPT() expands to 0
|
||||
the BOOST_PP_CHECK_EMPTY macro does not exist at all in this library. The input to the macro
|
||||
can be any variadic data. If the data passed to the macro is empty, or if the data passed to
|
||||
the macro is not empty but when the data itself is expanded it is empty, the macro returns
|
||||
@ -135,7 +135,7 @@
|
||||
</div>
|
||||
<b>See</b> <b>Also</b><br>
|
||||
<ul>
|
||||
<li><a href="../ref/variadic_opt.html">BOOST_PP_VARIADIC_OPT</a></li>
|
||||
<li><a href="../ref/variadic_opt.html">BOOST_PP_VARIADIC_HAS_OPT</a></li>
|
||||
<li><a href="../ref/check_empty.html">BOOST_PP_CHECK_EMPTY</a></li>
|
||||
</ul>
|
||||
<hr size="1">
|
||||
|
@ -151,7 +151,7 @@
|
||||
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.
|
||||
support for the __VA_OPT__ construct is called BOOST_PP_VARIADIC_HAS_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.
|
||||
|
@ -12,8 +12,8 @@
|
||||
# ifndef BOOST_PREPROCESSOR_FACILITIES_CHECK_EMPTY_HPP
|
||||
# define BOOST_PREPROCESSOR_FACILITIES_CHECK_EMPTY_HPP
|
||||
# include <boost/preprocessor/variadic/opt.hpp>
|
||||
# if BOOST_PP_VARIADIC_OPT()
|
||||
# if BOOST_PP_VARIADIC_HAS_OPT()
|
||||
# include <boost/preprocessor/facilities/is_empty_variadic.hpp>
|
||||
# define BOOST_PP_CHECK_EMPTY(...) BOOST_PP_IS_EMPTY_OPT(__VA_ARGS__)
|
||||
# endif /* BOOST_PP_VARIADIC_OPT() */
|
||||
# endif /* BOOST_PP_VARIADIC_HAS_OPT() */
|
||||
# endif /* BOOST_PREPROCESSOR_FACILITIES_CHECK_EMPTY_HPP */
|
||||
|
@ -42,7 +42,7 @@
|
||||
#define BOOST_PP_IS_EMPTY(...) \
|
||||
BOOST_PP_DETAIL_IS_EMPTY_IIF \
|
||||
( \
|
||||
BOOST_PP_VARIADIC_OPT() \
|
||||
BOOST_PP_VARIADIC_HAS_OPT() \
|
||||
) \
|
||||
( \
|
||||
BOOST_PP_IS_EMPTY_OPT, \
|
||||
@ -57,7 +57,7 @@
|
||||
BOOST_PP_IS_EMPTY_FUNCTION2(__VA_ARGS__) \
|
||||
/**/
|
||||
#define BOOST_PP_IS_EMPTY_OPT(...) \
|
||||
BOOST_PP_VARIADIC_OPT_ELEM0(BOOST_PP_IS_EMPTY_FUNCTION(__VA_ARGS__),) \
|
||||
BOOST_PP_VARIADIC_HAS_OPT_ELEM0(BOOST_PP_IS_EMPTY_FUNCTION(__VA_ARGS__),) \
|
||||
/**/
|
||||
# else
|
||||
#define BOOST_PP_IS_EMPTY(...) \
|
||||
|
@ -16,14 +16,14 @@
|
||||
#
|
||||
# if BOOST_PP_VARIADICS && defined(__cplusplus) && __cplusplus > 201703L
|
||||
#
|
||||
# define BOOST_PP_VARIADIC_OPT_FUNCTION(...) \
|
||||
# define BOOST_PP_VARIADIC_HAS_OPT_FUNCTION(...) \
|
||||
__VA_OPT__(,) , 1, 0 \
|
||||
/**/
|
||||
#
|
||||
# define BOOST_PP_VARIADIC_OPT_ELEM0(e0, ...) BOOST_PP_VARIADIC_OPT_ELEM_0(e0,__VA_ARGS__)
|
||||
# define BOOST_PP_VARIADIC_OPT_ELEM2(e0, ...) BOOST_PP_VARIADIC_OPT_ELEM_2(e0,__VA_ARGS__)
|
||||
# define BOOST_PP_VARIADIC_OPT_ELEM_0(e0, ...) e0
|
||||
# define BOOST_PP_VARIADIC_OPT_ELEM_2(e0, e1, e2, ...) e2
|
||||
# define BOOST_PP_VARIADIC_HAS_OPT_ELEM0(e0, ...) BOOST_PP_VARIADIC_HAS_OPT_ELEM_0(e0,__VA_ARGS__)
|
||||
# define BOOST_PP_VARIADIC_HAS_OPT_ELEM2(e0, ...) BOOST_PP_VARIADIC_HAS_OPT_ELEM_2(e0,__VA_ARGS__)
|
||||
# define BOOST_PP_VARIADIC_HAS_OPT_ELEM_0(e0, ...) e0
|
||||
# define BOOST_PP_VARIADIC_HAS_OPT_ELEM_2(e0, e1, e2, ...) e2
|
||||
#
|
||||
# endif
|
||||
#
|
||||
|
@ -14,15 +14,15 @@
|
||||
#
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
#
|
||||
# /* BOOST_PP_VARIADIC_OPT */
|
||||
# /* BOOST_PP_VARIADIC_HAS_OPT */
|
||||
#
|
||||
# if BOOST_PP_VARIADICS && defined(__cplusplus) && __cplusplus > 201703L
|
||||
# include <boost/preprocessor/variadic/detail/opt.hpp>
|
||||
# define BOOST_PP_VARIADIC_OPT() \
|
||||
BOOST_PP_VARIADIC_OPT_ELEM2(BOOST_PP_VARIADIC_OPT_FUNCTION(?),) \
|
||||
# define BOOST_PP_VARIADIC_HAS_OPT() \
|
||||
BOOST_PP_VARIADIC_HAS_OPT_ELEM2(BOOST_PP_VARIADIC_HAS_OPT_FUNCTION(?),) \
|
||||
/**/
|
||||
# else
|
||||
# define BOOST_PP_VARIADIC_OPT() 0
|
||||
# define BOOST_PP_VARIADIC_HAS_OPT() 0
|
||||
# endif
|
||||
#
|
||||
# endif
|
||||
|
@ -12,7 +12,7 @@
|
||||
# include <libs/preprocessor/test/test.h>
|
||||
# include <boost/preprocessor/facilities/check_empty.hpp>
|
||||
|
||||
# if BOOST_PP_VARIADIC_OPT()
|
||||
# if BOOST_PP_VARIADIC_HAS_OPT()
|
||||
|
||||
# include <boost/preprocessor/facilities/empty.hpp>
|
||||
|
||||
|
@ -94,7 +94,7 @@ void print_macros()
|
||||
PRINT_MACRO(BOOST_PP_CONFIG_FLAGS());
|
||||
PRINT_MACRO(BOOST_PP_VARIADICS);
|
||||
PRINT_MACRO(BOOST_PP_VARIADICS_MSVC);
|
||||
PRINT_MACRO(BOOST_PP_VARIADIC_OPT());
|
||||
PRINT_MACRO(BOOST_PP_VARIADIC_HAS_OPT());
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
# include <boost/preprocessor/variadic/opt.hpp>
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus > 201703L && BOOST_PP_VARIADIC_OPT()
|
||||
#if defined(__cplusplus) && __cplusplus > 201703L && BOOST_PP_VARIADIC_HAS_OPT()
|
||||
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
# include <boost/preprocessor/variadic/opt.hpp>
|
||||
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == BOOST_PP_VARIADIC_OPT() END
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == BOOST_PP_VARIADIC_HAS_OPT() END
|
||||
|
||||
#else
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
# include <boost/preprocessor/variadic/opt.hpp>
|
||||
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == BOOST_PP_VARIADIC_OPT() END
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == BOOST_PP_VARIADIC_HAS_OPT() END
|
||||
|
||||
#else
|
||||
|
||||
|
Reference in New Issue
Block a user