fold_right.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. # /* Copyright (C) 2001
  2. # * Housemarque Oy
  3. # * http://www.housemarque.com
  4. # *
  5. # * Distributed under the Boost Software License, Version 1.0. (See
  6. # * accompanying file LICENSE_1_0.txt or copy at
  7. # * http://www.boost.org/LICENSE_1_0.txt)
  8. # */
  9. #
  10. # /* Revised by Paul Mensonides (2002) */
  11. # /* Revised by Edward Diener (2020) */
  12. #
  13. # /* See http://www.boost.org for most recent version. */
  14. #
  15. # ifndef BOOST_PREPROCESSOR_LIST_FOLD_RIGHT_HPP
  16. # define BOOST_PREPROCESSOR_LIST_FOLD_RIGHT_HPP
  17. #
  18. # include <boost/preprocessor/config/config.hpp>
  19. #
  20. # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
  21. #
  22. # include <boost/preprocessor/cat.hpp>
  23. # include <boost/preprocessor/control/while.hpp>
  24. # include <boost/preprocessor/debug/error.hpp>
  25. # include <boost/preprocessor/detail/auto_rec.hpp>
  26. #
  27. # if 0
  28. # define BOOST_PP_LIST_FOLD_RIGHT(op, state, list)
  29. # endif
  30. #
  31. # define BOOST_PP_LIST_FOLD_RIGHT BOOST_PP_CAT(BOOST_PP_LIST_FOLD_RIGHT_, BOOST_PP_AUTO_REC(BOOST_PP_WHILE_P, 256))
  32. #
  33. # define BOOST_PP_LIST_FOLD_RIGHT_257(o, s, l) BOOST_PP_ERROR(0x0004)
  34. #
  35. # define BOOST_PP_LIST_FOLD_RIGHT_D(d, o, s, l) BOOST_PP_LIST_FOLD_RIGHT_ ## d(o, s, l)
  36. # define BOOST_PP_LIST_FOLD_RIGHT_2ND BOOST_PP_LIST_FOLD_RIGHT
  37. # define BOOST_PP_LIST_FOLD_RIGHT_2ND_D BOOST_PP_LIST_FOLD_RIGHT_D
  38. #
  39. # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
  40. # include <boost/preprocessor/list/detail/edg/fold_right.hpp>
  41. # else
  42. # include <boost/preprocessor/list/detail/fold_right.hpp>
  43. # endif
  44. #
  45. # else
  46. #
  47. # include <boost/preprocessor/arithmetic/dec.hpp>
  48. # include <boost/preprocessor/cat.hpp>
  49. # include <boost/preprocessor/control/while.hpp>
  50. # include <boost/preprocessor/debug/error.hpp>
  51. # include <boost/preprocessor/detail/auto_rec.hpp>
  52. #
  53. # if 0
  54. # define BOOST_PP_LIST_FOLD_RIGHT(op, state, list)
  55. # endif
  56. #
  57. # include <boost/preprocessor/config/limits.hpp>
  58. #
  59. # if BOOST_PP_LIMIT_WHILE == 256
  60. # define BOOST_PP_LIST_FOLD_RIGHT BOOST_PP_CAT(BOOST_PP_LIST_FOLD_RIGHT_, BOOST_PP_DEC(BOOST_PP_AUTO_REC(BOOST_PP_WHILE_P, 256)))
  61. # define BOOST_PP_LIST_FOLD_RIGHT_257(o, s, l) BOOST_PP_ERROR(0x0004)
  62. # elif BOOST_PP_LIMIT_WHILE == 512
  63. # define BOOST_PP_LIST_FOLD_RIGHT BOOST_PP_CAT(BOOST_PP_LIST_FOLD_RIGHT_, BOOST_PP_DEC(BOOST_PP_AUTO_REC(BOOST_PP_WHILE_P, 512)))
  64. # define BOOST_PP_LIST_FOLD_RIGHT_513(o, s, l) BOOST_PP_ERROR(0x0004)
  65. # elif BOOST_PP_LIMIT_WHILE == 1024
  66. # define BOOST_PP_LIST_FOLD_RIGHT BOOST_PP_CAT(BOOST_PP_LIST_FOLD_RIGHT_, BOOST_PP_DEC(BOOST_PP_AUTO_REC(BOOST_PP_WHILE_P, 1024)))
  67. # define BOOST_PP_LIST_FOLD_RIGHT_1025(o, s, l) BOOST_PP_ERROR(0x0004)
  68. # else
  69. # error Incorrect value for the BOOST_PP_LIMIT_WHILE limit
  70. # endif
  71. #
  72. # define BOOST_PP_LIST_FOLD_RIGHT_D(d, o, s, l) BOOST_PP_LIST_FOLD_RIGHT_ ## d(o, s, l)
  73. # define BOOST_PP_LIST_FOLD_RIGHT_2ND BOOST_PP_LIST_FOLD_RIGHT
  74. # define BOOST_PP_LIST_FOLD_RIGHT_2ND_D BOOST_PP_LIST_FOLD_RIGHT_D
  75. #
  76. # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
  77. # include <boost/preprocessor/list/detail/edg/fold_right.hpp>
  78. # else
  79. # include <boost/preprocessor/list/detail/fold_right.hpp>
  80. # endif
  81. #
  82. # endif
  83. #
  84. # endif