va_opt.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334
  1. # /* **************************************************************************
  2. # * *
  3. # * (C) Copyright Edward Diener 2019.
  4. # * Distributed under the Boost Software License, Version 1.0. (See
  5. # * accompanying file LICENSE_1_0.txt or copy at
  6. # * http://www.boost.org/LICENSE_1_0.txt)
  7. # * *
  8. # ************************************************************************** */
  9. #
  10. # /* See http://www.boost.org for most recent version. */
  11. #
  12. # ifndef BOOST_PREPROCESSOR_FACILITIES_VA_OPT_HPP
  13. # define BOOST_PREPROCESSOR_FACILITIES_VA_OPT_HPP
  14. # include <boost/preprocessor/variadic/has_opt.hpp>
  15. # if BOOST_PP_VARIADIC_HAS_OPT()
  16. # include <boost/preprocessor/control/iif.hpp>
  17. # include <boost/preprocessor/facilities/check_empty.hpp>
  18. # include <boost/preprocessor/tuple/rem.hpp>
  19. # define BOOST_PP_VA_OPT_IMPL(atuple) \
  20. BOOST_PP_TUPLE_REM() atuple \
  21. /**/
  22. # define BOOST_PP_VA_OPT(rdata,rempty,...) \
  23. BOOST_PP_VA_OPT_IMPL \
  24. ( \
  25. BOOST_PP_IIF \
  26. ( \
  27. BOOST_PP_CHECK_EMPTY(__VA_ARGS__), \
  28. rempty, \
  29. rdata \
  30. ) \
  31. ) \
  32. /**/
  33. # endif /* BOOST_PP_VARIADIC_HAS_OPT() */
  34. # endif /* BOOST_PREPROCESSOR_FACILITIES_VA_OPT_HPP */