iterate.hpp 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*==============================================================================
  2. Copyright (c) 2010 Thomas Heller
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. ==============================================================================*/
  6. #if !BOOST_PP_IS_ITERATING
  7. #include <boost/preprocessor/tuple/elem.hpp>
  8. #ifndef BOOST_PHOENIX_ITERATION_PARAMS
  9. #error "BOOST_PHOENIX_ITERATION_PARAMS not defined"
  10. #endif
  11. #define BOOST_PHOENIX_ITERATION_PARAMS_SIZE \
  12. BOOST_PP_TUPLE_ELEM(2, 0, BOOST_PHOENIX_ITERATION_PARAMS) \
  13. /**/
  14. #define BOOST_PHOENIX_ITERATION_TUPLE \
  15. BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PHOENIX_ITERATION_PARAMS) \
  16. /**/
  17. #define BOOST_PHOENIX_ITERATION_START \
  18. BOOST_PP_TUPLE_ELEM( \
  19. BOOST_PHOENIX_ITERATION_PARAMS_SIZE, 0, BOOST_PHOENIX_ITERATION_TUPLE) \
  20. /**/
  21. #define BOOST_PHOENIX_ITERATION_END \
  22. BOOST_PP_TUPLE_ELEM( \
  23. BOOST_PHOENIX_ITERATION_PARAMS_SIZE, 1, BOOST_PHOENIX_ITERATION_TUPLE) \
  24. /**/
  25. #define BOOST_PHOENIX_ITERATION_FILE() \
  26. BOOST_PP_TUPLE_ELEM( \
  27. BOOST_PHOENIX_ITERATION_PARAMS_SIZE, 2, BOOST_PHOENIX_ITERATION_TUPLE) \
  28. /**/
  29. #if BOOST_PHOENIX_ITERATION_PARAMS_SIZE == 3
  30. #define BOOST_PP_ITERATION_PARAMS_1 \
  31. (3, (BOOST_PHOENIX_ITERATION_START, BOOST_PHOENIX_ITERATION_END, \
  32. <boost/phoenix/support/detail/iterate.hpp>)) \
  33. /**/
  34. #else
  35. #define BOOST_PHOENIX_ITERATION_FLAG \
  36. BOOST_PP_TUPLE_ELEM( \
  37. BOOST_PHOENIX_ITERATION_PARAMS_SIZE, 3, BOOST_PHOENIX_ITERATION_TUPLE) \
  38. /**/
  39. #define BOOST_PP_ITERATION_PARAMS_1 \
  40. (4, (BOOST_PHOENIX_ITERATION_START, BOOST_PHOENIX_ITERATION_END, \
  41. <boost/phoenix/support/detail/iterate.hpp>, \
  42. BOOST_PHOENIX_ITERATION_FLAG)) \
  43. /**/
  44. #endif
  45. #include BOOST_PP_ITERATE()
  46. #undef BOOST_PHOENIX_ITERATION_PARAMS_SIZE
  47. #undef BOOST_PHOENIX_ITERATION_TUPLE
  48. #undef BOOST_PHOENIX_ITERATION_START
  49. #undef BOOST_PHOENIX_ITERATION_END
  50. #undef BOOST_PHOENIX_ITERATION_PARAMS
  51. #else
  52. #undef BOOST_PHOENIX_IS_ITERATING
  53. #define BOOST_PHOENIX_IS_ITERATING 1
  54. #include <boost/phoenix/support/detail/iterate_undef.hpp>
  55. #include <boost/phoenix/support/detail/iterate_define.hpp>
  56. #include BOOST_PHOENIX_ITERATION_FILE()
  57. #undef BOOST_PHOENIX_ITERATION
  58. #undef BOOST_PHOENIX_IS_ITERATING
  59. #define BOOST_PHOENIX_IS_ITERATING 0
  60. #include <boost/phoenix/support/detail/iterate_undef.hpp>
  61. #include <boost/phoenix/support/detail/iterate_define.hpp>
  62. #endif