From a42f374b97e338cac17eaf7c5daf0b92c8278d63 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Thu, 26 Sep 2019 01:19:31 -0400 Subject: [PATCH] Updated example for using the BOOST_PP_VARIADIC_OPT macro. --- doc/ref/variadic_opt.html | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/ref/variadic_opt.html b/doc/ref/variadic_opt.html index 7383caa..d8c425a 100644 --- a/doc/ref/variadic_opt.html +++ b/doc/ref/variadic_opt.html @@ -23,11 +23,20 @@ Expands to 1 if the __VA_OPT__ construct is supported, otherwise expands to 0.
 #include <boost/preprocessor/variadic/opt.hpp>
-#if BOOST_PP_VARIADIC_OPT()
-// Preprocessor code which uses __VA_OPT__
-#else
-// Preprocessor code which does not use __VA_OPT__
-#endif
+#if BOOST_PP_VARIADIC_OPT() +// Preprocessor code which uses __VA_OPT__ +#else +// Preprocessor code which does not use __VA_OPT__ +#endif +
+
+or within a macro definition

+
+#include <boost/preprocessor/control/iif.hpp>
+#include <boost/preprocessor/variadic/opt.hpp>
+#define USE_OPT(...) BOOST_PP_IIF(BOOST_PP_VARIADIC_OPT(),MACRO_USING_OPT,MACRO_NOT_USING_OPT)(__VA_ARGS__) +#define MACRO_USING_OPT(...) __VA_OPT__( preprocessor tokens ) anything +#define MACRO_NOT_USING_OPT(...) anything