test_is_empty_tuple_succeed.cxx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // (C) Copyright Edward Diener 2011-2015
  2. // Use, modification and distribution are subject to the Boost Software License,
  3. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt).
  5. #include <boost/detail/lightweight_test.hpp>
  6. #include <boost/preprocessor/cat.hpp>
  7. #include <boost/preprocessor/control/if.hpp>
  8. #include <boost/preprocessor/tuple/elem.hpp>
  9. int main()
  10. {
  11. #if BOOST_PP_VARIADICS
  12. #define TN_GEN_ONE(p) (1)
  13. #define TN_GEN_ZERO(p) (0)
  14. #define TN_TEST_ONE_MORE(parameter,ens) \
  15. BOOST_PP_IF \
  16. ( \
  17. BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(1,0,ens),0), \
  18. TN_GEN_ONE, \
  19. TN_GEN_ZERO \
  20. ) \
  21. (parameter) \
  22. /**/
  23. #define TN_TEST_ONE(parameter,ens) \
  24. BOOST_PP_TUPLE_ELEM \
  25. ( \
  26. 1, \
  27. 0, \
  28. TN_TEST_ONE_MORE(parameter,ens) \
  29. ) \
  30. /**/
  31. BOOST_TEST_EQ(TN_TEST_ONE(A,(1)),1);
  32. BOOST_TEST_EQ(TN_TEST_ONE(A,()),0);
  33. #else
  34. BOOST_ERROR("No variadic macro support");
  35. #endif /* BOOST_PP_VARIADICS */
  36. return boost::report_errors();
  37. }