pp_map_tie.hpp 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2006 Dan Marsden
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #ifndef BOOST_PP_IS_ITERATING
  8. #if !defined(FUSION_PP_MAP_TIE_20060814_1116)
  9. #define FUSION_PP_MAP_TIE_20060814_1116
  10. #include <boost/preprocessor/iterate.hpp>
  11. #include <boost/preprocessor/repetition/enum_params.hpp>
  12. #include <boost/preprocessor/repetition/enum_binary_params.hpp>
  13. #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
  14. #include <boost/preprocessor/repetition/repeat_from_to.hpp>
  15. #include <boost/fusion/container/map/map.hpp>
  16. #include <boost/fusion/container/map/detail/cpp03/limits.hpp>
  17. #include <boost/fusion/support/pair.hpp>
  18. #include <boost/fusion/container/generation/pair_tie.hpp>
  19. #include <boost/type_traits/add_reference.hpp>
  20. #if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
  21. #include <boost/fusion/container/generation/detail/preprocessed/map_tie.hpp>
  22. #else
  23. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  24. #pragma wave option(preserve: 2, line: 0, output: "preprocessed/map_tie" FUSION_MAX_MAP_SIZE_STR".hpp")
  25. #endif
  26. /*=============================================================================
  27. Copyright (c) 2001-2011 Joel de Guzman
  28. Distributed under the Boost Software License, Version 1.0. (See accompanying
  29. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  30. This is an auto-generated file. Do not edit!
  31. ==============================================================================*/
  32. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  33. #pragma wave option(preserve: 1)
  34. #endif
  35. namespace boost { namespace fusion
  36. {
  37. struct void_;
  38. namespace result_of
  39. {
  40. template <
  41. BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
  42. FUSION_MAX_MAP_SIZE, typename K, void_)
  43. , BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
  44. FUSION_MAX_MAP_SIZE, typename D, void_)
  45. , typename Extra = void_
  46. >
  47. struct map_tie;
  48. template <>
  49. struct map_tie<>
  50. {
  51. typedef map<> type;
  52. };
  53. }
  54. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  55. inline map<>
  56. map_tie()
  57. {
  58. return map<>();
  59. }
  60. #define BOOST_FUSION_TIED_PAIR(z, n, data) \
  61. fusion::pair< \
  62. BOOST_PP_CAT(K, n) \
  63. , typename add_reference<BOOST_PP_CAT(D, n)>::type>
  64. #define BOOST_FUSION_PAIR_TIE(z, n, _) \
  65. fusion::pair_tie<BOOST_PP_CAT(K, n)>(BOOST_PP_CAT(_, n)) \
  66. #define BOOST_PP_FILENAME_1 <boost/fusion/container/generation/detail/pp_map_tie.hpp>
  67. #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_MAP_SIZE)
  68. #include BOOST_PP_ITERATE()
  69. #undef BOOST_FUSION_PAIR
  70. #undef BOOST_FUSION_MAKE_PAIR
  71. }}
  72. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  73. #pragma wave option(output: null)
  74. #endif
  75. #endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
  76. #endif
  77. #else // defined(BOOST_PP_IS_ITERATING)
  78. ///////////////////////////////////////////////////////////////////////////////
  79. //
  80. // Preprocessor vertical repetition code
  81. //
  82. ///////////////////////////////////////////////////////////////////////////////
  83. #define N BOOST_PP_ITERATION()
  84. namespace result_of
  85. {
  86. template <
  87. BOOST_PP_ENUM_PARAMS(N, typename K)
  88. , BOOST_PP_ENUM_PARAMS(N, typename D)
  89. >
  90. #define TEXT(z, n, text) , text
  91. struct map_tie<BOOST_PP_ENUM_PARAMS(N, K), BOOST_PP_ENUM_PARAMS(N, D) BOOST_PP_REPEAT_FROM_TO(N, FUSION_MAX_MAP_SIZE, TEXT, void_) BOOST_PP_REPEAT_FROM_TO(BOOST_PP_DEC(N), FUSION_MAX_MAP_SIZE, TEXT, void_)>
  92. #undef TEXT
  93. {
  94. typedef map<BOOST_PP_ENUM(N, BOOST_FUSION_TIED_PAIR, _)> type;
  95. };
  96. }
  97. template <
  98. BOOST_PP_ENUM_PARAMS(N, typename K)
  99. , BOOST_PP_ENUM_PARAMS(N, typename D)
  100. >
  101. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  102. inline map<BOOST_PP_ENUM(N, BOOST_FUSION_TIED_PAIR, _)>
  103. map_tie(BOOST_PP_ENUM_BINARY_PARAMS(N, D, & arg))
  104. {
  105. return map<BOOST_PP_ENUM(N, BOOST_FUSION_TIED_PAIR, _)>(
  106. BOOST_PP_ENUM(N, BOOST_FUSION_PAIR_TIE, arg));
  107. }
  108. #undef N
  109. #endif // defined(BOOST_PP_IS_ITERATING)