as_set.hpp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  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. #ifndef BOOST_PP_IS_ITERATING
  7. #if !defined(FUSION_AS_SET_0932005_1341)
  8. #define FUSION_AS_SET_0932005_1341
  9. #include <boost/preprocessor/iterate.hpp>
  10. #include <boost/preprocessor/repetition/enum_params.hpp>
  11. #include <boost/preprocessor/repetition/enum_binary_params.hpp>
  12. #include <boost/preprocessor/repetition/repeat.hpp>
  13. #include <boost/preprocessor/cat.hpp>
  14. #include <boost/preprocessor/inc.hpp>
  15. #include <boost/preprocessor/dec.hpp>
  16. #include <boost/fusion/container/set/set.hpp>
  17. #include <boost/fusion/iterator/value_of.hpp>
  18. #include <boost/fusion/iterator/deref.hpp>
  19. #include <boost/fusion/iterator/next.hpp>
  20. namespace boost { namespace fusion { namespace detail
  21. {
  22. template <int size>
  23. struct as_set;
  24. template <>
  25. struct as_set<0>
  26. {
  27. template <typename Iterator>
  28. struct apply
  29. {
  30. typedef set<> type;
  31. };
  32. template <typename Iterator>
  33. static typename apply<Iterator>::type
  34. call(Iterator)
  35. {
  36. return set<>();
  37. }
  38. };
  39. }}}
  40. #if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
  41. #include <boost/fusion/container/set/detail/preprocessed/as_set.hpp>
  42. #else
  43. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  44. #pragma wave option(preserve: 2, line: 0, output: "preprocessed/as_set" FUSION_MAX_SET_SIZE_STR ".hpp")
  45. #endif
  46. /*=============================================================================
  47. Copyright (c) 2001-2011 Joel de Guzman
  48. Distributed under the Boost Software License, Version 1.0. (See accompanying
  49. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  50. This is an auto-generated file. Do not edit!
  51. ==============================================================================*/
  52. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  53. #pragma wave option(preserve: 1)
  54. #endif
  55. namespace boost { namespace fusion { namespace detail
  56. {
  57. #define BOOST_FUSION_NEXT_ITERATOR(z, n, data) \
  58. typedef typename fusion::result_of::next<BOOST_PP_CAT(I, n)>::type \
  59. BOOST_PP_CAT(I, BOOST_PP_INC(n));
  60. #define BOOST_FUSION_NEXT_CALL_ITERATOR(z, n, data) \
  61. typename gen::BOOST_PP_CAT(I, BOOST_PP_INC(n)) \
  62. BOOST_PP_CAT(i, BOOST_PP_INC(n)) = fusion::next(BOOST_PP_CAT(i, n));
  63. #define BOOST_FUSION_VALUE_OF_ITERATOR(z, n, data) \
  64. typedef typename fusion::result_of::value_of<BOOST_PP_CAT(I, n)>::type \
  65. BOOST_PP_CAT(T, n);
  66. #define BOOST_PP_FILENAME_1 <boost/fusion/container/set/detail/as_set.hpp>
  67. #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_SET_SIZE)
  68. #include BOOST_PP_ITERATE()
  69. #undef BOOST_FUSION_NEXT_ITERATOR
  70. #undef BOOST_FUSION_NEXT_CALL_ITERATOR
  71. #undef BOOST_FUSION_VALUE_OF_ITERATOR
  72. }}}
  73. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  74. #pragma wave option(output: null)
  75. #endif
  76. #endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
  77. #endif
  78. #else // defined(BOOST_PP_IS_ITERATING)
  79. ///////////////////////////////////////////////////////////////////////////////
  80. //
  81. // Preprocessor vertical repetition code
  82. //
  83. ///////////////////////////////////////////////////////////////////////////////
  84. #define N BOOST_PP_ITERATION()
  85. template <>
  86. struct as_set<N>
  87. {
  88. template <typename I0>
  89. struct apply
  90. {
  91. BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _)
  92. BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _)
  93. typedef set<BOOST_PP_ENUM_PARAMS(N, T)> type;
  94. };
  95. template <typename Iterator>
  96. static typename apply<Iterator>::type
  97. call(Iterator const& i0)
  98. {
  99. typedef apply<Iterator> gen;
  100. typedef typename gen::type result;
  101. BOOST_PP_REPEAT(BOOST_PP_DEC(N), BOOST_FUSION_NEXT_CALL_ITERATOR, _)
  102. return result(BOOST_PP_ENUM_PARAMS(N, *i));
  103. }
  104. };
  105. #undef N
  106. #endif // defined(BOOST_PP_IS_ITERATING)