diff --git a/doc/headers.html b/doc/headers.html index 58f33db..7df8cb0 100644 --- a/doc/headers.html +++ b/doc/headers.html @@ -230,6 +230,7 @@
  • variadic.hpp
  • variadic/
  • elem.hpp (v)
  • +
  • opt.hpp
  • size.hpp (v)
  • to_array.hpp (v)
  • diff --git a/doc/headers/variadic.html b/doc/headers/variadic.html index 0acc99c..c555e95 100644 --- a/doc/headers/variadic.html +++ b/doc/headers/variadic.html @@ -14,6 +14,7 @@

    Includes


    - © Copyright Edward Diener 2011,2013 + © Copyright Edward Diener 2011,2013,2019

    Distributed under the Boost Software License, Version 1.0. (See diff --git a/doc/headers/variadic/opt.html b/doc/headers/variadic/opt.html new file mode 100644 index 0000000..d65d592 --- /dev/null +++ b/doc/headers/variadic/opt.html @@ -0,0 +1,25 @@ + + variadic/opt.hpp + +

    + The variadic/opt.hpp header defines a macro that determines whether or not the __VA_OPT__ construct is supported. +
    +

    Usage

    +
    + #include <boost/preprocessor/variadic/opt.hpp> +
    +

    Contents

    + +
    +
    + © Copyright Edward Diener 2019 +
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or + copy at www.boost.org/LICENSE_1_0.txt)

    +
    + \ No newline at end of file diff --git a/doc/ref.html b/doc/ref.html index 102325a..749e881 100644 --- a/doc/ref.html +++ b/doc/ref.html @@ -298,6 +298,7 @@
  • VALUE
  • VARIADICS
  • VARIADIC_ELEM (v)
  • +
  • VARIADIC_OPT
  • VARIADIC_SEQ_TO_SEQ (v)
  • VARIADIC_SIZE (v)
  • VARIADIC_TO_ARRAY (v)
  • diff --git a/doc/ref/variadic_opt.html b/doc/ref/variadic_opt.html new file mode 100644 index 0000000..7383caa --- /dev/null +++ b/doc/ref/variadic_opt.html @@ -0,0 +1,41 @@ + + + BOOST_PP_VARIADIC_OPT + + + +
    The BOOST_PP_VARIADIC_OPT 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. +
    +

    Usage

    +
    BOOST_PP_VARIADIC_OPT()
    +
    +

    Arguments

    +
    +
    None
    +
    +
    +

    Requirements

    +
    Header:  <boost/preprocessor/variadic/opt.hpp> +
    +

    Sample Code

    +
    +
    +#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
    +
    +
    +
    +
    © Copyright Edward Diener 2019
    +
    +

    Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt +or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + + diff --git a/doc/syntax.html b/doc/syntax.html index abc0b2a..68dd9f6 100644 --- a/doc/syntax.html +++ b/doc/syntax.html @@ -284,6 +284,7 @@
    BOOST_PP_VALUE
    BOOST_PP_VARIADIC_ELEM +
    BOOST_PP_VARIADIC_OPT
    BOOST_PP_VARIADIC_SIZE
    BOOST_PP_VARIADIC_TO_ARRAY
    BOOST_PP_VARIADIC_TO_LIST diff --git a/doc/topics/variadic_macros.html b/doc/topics/variadic_macros.html index 985b9eb..5ecbd18 100644 --- a/doc/topics/variadic_macros.html +++ b/doc/topics/variadic_macros.html @@ -136,6 +136,27 @@ use this variadic data reliably as arguments to other macros, one needs variadic macro support.
    +

    C++20 Support For Variadic Macros

    +
    + 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. +

    + 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. +
    +
    Using a Tuple Instead of an Array
    An array as a preprocessor data type is a two-element tuple where the @@ -257,6 +278,5 @@ (See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)

    - - - \ No newline at end of file + + \ No newline at end of file diff --git a/include/boost/preprocessor/variadic.hpp b/include/boost/preprocessor/variadic.hpp index a28e026..c2c37f2 100644 --- a/include/boost/preprocessor/variadic.hpp +++ b/include/boost/preprocessor/variadic.hpp @@ -14,6 +14,7 @@ # define BOOST_PREPROCESSOR_VARIADIC_HPP # # include +# include # include # include # include