enum_shifted_binary_params.hpp 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # /* **************************************************************************
  2. # * *
  3. # * (C) Copyright Paul Mensonides 2005. *
  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_REPETITION_ENUM_SHIFTED_BINARY_PARAMS_HPP
  13. # define BOOST_PREPROCESSOR_REPETITION_ENUM_SHIFTED_BINARY_PARAMS_HPP
  14. #
  15. # include <boost/preprocessor/arithmetic/dec.hpp>
  16. # include <boost/preprocessor/arithmetic/inc.hpp>
  17. # include <boost/preprocessor/cat.hpp>
  18. # include <boost/preprocessor/config/config.hpp>
  19. # include <boost/preprocessor/punctuation/comma_if.hpp>
  20. # include <boost/preprocessor/repetition/repeat.hpp>
  21. # include <boost/preprocessor/tuple/elem.hpp>
  22. # include <boost/preprocessor/tuple/rem.hpp>
  23. #
  24. # /* BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS */
  25. #
  26. # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
  27. # define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS(count, p1, p2) BOOST_PP_REPEAT(BOOST_PP_DEC(count), BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M, (p1, p2))
  28. # else
  29. # define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS(count, p1, p2) BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_I(count, p1, p2)
  30. # define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_I(count, p1, p2) BOOST_PP_REPEAT(BOOST_PP_DEC(count), BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M, (p1, p2))
  31. # endif
  32. #
  33. # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
  34. # define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M(z, n, pp) BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M_IM(z, n, BOOST_PP_TUPLE_REM_2 pp)
  35. # define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M_IM(z, n, im) BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M_I(z, n, im)
  36. # else
  37. # define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M(z, n, pp) BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M_I(z, n, BOOST_PP_TUPLE_ELEM(2, 0, pp), BOOST_PP_TUPLE_ELEM(2, 1, pp))
  38. # endif
  39. #
  40. # define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M_I(z, n, p1, p2) BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(p1, BOOST_PP_INC(n)) BOOST_PP_CAT(p2, BOOST_PP_INC(n))
  41. #
  42. # /* BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_Z */
  43. #
  44. # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
  45. # define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_Z(z, count, p1, p2) BOOST_PP_REPEAT_ ## z(BOOST_PP_DEC(count), BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M, (p1, p2))
  46. # else
  47. # define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_Z(z, count, p1, p2) BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_Z_I(z, count, p1, p2)
  48. # define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_Z_I(z, count, p1, p2) BOOST_PP_REPEAT_ ## z(BOOST_PP_DEC(count), BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M, (p1, p2))
  49. # endif
  50. #
  51. # endif