3 <title>BOOST_PP_VARIADIC_HAS_OPT</title>
4 <link rel="stylesheet" type="text/css" href="../styles.css">
7 <div style="margin-left: 0px;"> The <b>BOOST_PP_VARIADIC_HAS_OPT</b> macro
8 determines whether or not the C++20 __VA_OPT__ construct is supported for the compiler's preprocessor being used.
9 Expands to 1 if the __VA_OPT__ construct is supported, otherwise expands to 0.
12 <div class="code"> <b>BOOST_PP_VARIADIC_HAS_OPT</b>() <br>
21 This macro only returns 1 if the compiler is compiling at its own C++20 level and
22 __VA_OPT__ is supported. It is possible for a compiler to support the __VA_OPT__
23 construct when not compiling at its own C++20 level, but this macro will return
24 0 in that case even if __VA_OPT__ is normally supported for that level. The reason
25 for this is that such a compiler may have a compiler switch, enforcing a strict
26 adherence to a particular C++ standard level, which gives a warning or an error
27 if __VA_OPT__ is specified below the C++20 level, and the preprocessor library
28 wants to avoid that happening. Therefore the macro will only test to see whether
29 or not __VA_OPT__ is supported at the C++20 level, while otherwise always returning
30 0 for all lesser C++ standard levels.
33 <div> <b>Header:</b> <a href="../headers/variadic/has_opt.html"><boost/preprocessor/variadic/has_opt.hpp></a>
38 #include <<a href="../headers/variadic/has_opt.html">boost/preprocessor/variadic/has_opt.hpp</a>><br>
39 #if <a href="variadic_has_opt.html">BOOST_PP_VARIADIC_HAS_OPT</a>()
40 // Preprocessor code which uses __VA_OPT__
42 // Preprocessor code which does not use __VA_OPT__
46 or within a macro definition<br><br>
48 #include <boost/preprocessor/control/iif.hpp>
49 #include <<a href="../headers/variadic/has_opt.html">boost/preprocessor/variadic/has_opt.hpp</a>><br>
50 #define USE_OPT(...) BOOST_PP_IIF(<a href="variadic_has_opt.html">BOOST_PP_VARIADIC_HAS_OPT</a>(),MACRO_USING_OPT,MACRO_NOT_USING_OPT)(__VA_ARGS__)
51 #define MACRO_USING_OPT(...) __VA_OPT__( preprocessor tokens ) anything
52 #define MACRO_NOT_USING_OPT(...) anything
56 <div style="margin-left: 0px;"> <i></i><i>© Copyright Edward Diener 2019</i> </div>
57 <div style="margin-left: 0px;">
58 <p><small>Distributed under the Boost Software License, Version 1.0.
59 (See accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a>
60 or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>