The BOOST_PP_VA_OPT variadic
+ macro is a more flexible alternative to the C++20 __VA_OPT__
+ construct. It expands to either one of two inputs depending on
+ whether the variadic data is empty or not, whereas the C++20
+ __VA_OPT__ constructs expands to either its input or nothing
+ depending on whether the variadic data is empty or not. This macro
+ only exists when the compilation is at the C++20 level and the
+ __VA_OPT__ construct is supported.
x
+ A tuple
+ whose data is the macro expansion if the variadic data is
+ not empty
+ y
+ A tuple
+ whose data is the macro expansion if the variadic data is
+ empty
+ ,,,
+ The variadic
+ data to be checked for emptiness
+
+
+
+
Remarks
+
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_HAS_OPT macro.
+
+ The difference between this macro and the __VA_OPT__ construct
+ illustrates a limitation of the latter construct with a trade off
+ of simpler syntax. The differences between the __VA_OPT__
+ construct and this macro are:
+
+
The __VA_OPT__ construct offers a choice as its expansion
+ only between its input preprocessing tokens or nothing (
+ called a "single placemarker token" ) depending on whether the
+ implicit variadic data is empty or not. There is no way using
+ the __VA_OPT__ construct to specify any alternative but the
+ "single placemarker token" when the variadic data is empty
+ whereas any preprocessing tokens can be specified when the
+ variadic data is not empty. With the BOOST_PP_VA_OPT macro the
+ user can specify as its expansion preprocessing tokens both
+ when the variadic data is empty and when the variadic data is
+ not empty.
+
The __VA_OPT__ construct offers a simple syntax whereas this
+ macro is more verbose. The BOOST_PP_VA_OPT macro's first and
+ second parameters must be Boost PP tuples of data, in order to
+ expand to normal or variadic data, and the third parameter
+ must be the variadic data to check for emptiness, whereas the
+ __VA_OPT__ construct has an implied variadic data as
+ __VA_ARGS__ to check for emptiness and can specify its
+ expansion directly in terms of its input.
+
The __VA_OPT__ construct can only be specified in the
+ replacement list of some macro, whereas the BOOST_PP_VA_OPT
+ macro can be used both as an alternative to the __VA_OPT__
+ construct in the replacement list of some macro and anywhere
+ else a macro can be used.
+
It is impossible to have a left parenthesis '(' or a right
+ parenthesis ')' as preprocessing token data within the
+ __VA_OPT__ construct whereas both are possible as part of the
+ expanded data for the BOOST_PP_VA_OPT macro.
+
+
+
+ The exact BOOST_PP_VA_OPT equivalent to the construct of
+ '__VA_OPT__ ( pp-tokens )' in the replacement list of a macro is
+ 'BOOST_PP_VA_OPT (( pp-tokens ),(),__VA_ARGS__)'.