map.hpp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. #if !defined(FUSION_MAP_07212005_1106)
  7. #define FUSION_MAP_07212005_1106
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/support/pair.hpp>
  10. #include <boost/fusion/support/category_of.hpp>
  11. #include <boost/fusion/support/detail/access.hpp>
  12. #include <boost/fusion/container/map/detail/cpp03/map_fwd.hpp>
  13. #include <boost/fusion/container/map/detail/cpp03/at_impl.hpp>
  14. #include <boost/fusion/container/map/detail/cpp03/value_at_impl.hpp>
  15. #include <boost/fusion/container/map/detail/cpp03/begin_impl.hpp>
  16. #include <boost/fusion/container/map/detail/cpp03/end_impl.hpp>
  17. #include <boost/fusion/container/map/detail/cpp03/value_of_impl.hpp>
  18. #include <boost/fusion/container/map/detail/cpp03/deref_data_impl.hpp>
  19. #include <boost/fusion/container/map/detail/cpp03/deref_impl.hpp>
  20. #include <boost/fusion/container/map/detail/cpp03/key_of_impl.hpp>
  21. #include <boost/fusion/container/map/detail/cpp03/value_of_data_impl.hpp>
  22. #include <boost/fusion/container/vector/vector.hpp>
  23. #include <boost/mpl/identity.hpp>
  24. #include <boost/mpl/bool.hpp>
  25. #include <boost/preprocessor/iterate.hpp>
  26. #include <boost/preprocessor/repetition/enum_params.hpp>
  27. #include <boost/preprocessor/repetition/enum_binary_params.hpp>
  28. #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
  29. defined(BOOST_MSVC) && (BOOST_MSVC == 1700)
  30. // see map_forward_ctor.hpp
  31. #include <boost/core/enable_if.hpp>
  32. #include <boost/type_traits/is_same.hpp>
  33. #endif
  34. #if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
  35. #include <boost/fusion/container/map/detail/cpp03/preprocessed/map.hpp>
  36. #else
  37. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  38. #pragma wave option(preserve: 2, line: 0, output: "preprocessed/map" FUSION_MAX_MAP_SIZE_STR ".hpp")
  39. #endif
  40. /*=============================================================================
  41. Copyright (c) 2001-2011 Joel de Guzman
  42. Distributed under the Boost Software License, Version 1.0. (See accompanying
  43. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  44. This is an auto-generated file. Do not edit!
  45. ==============================================================================*/
  46. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  47. #pragma wave option(preserve: 1)
  48. #endif
  49. #define FUSION_HASH #
  50. namespace boost { namespace fusion
  51. {
  52. struct void_;
  53. struct fusion_sequence_tag;
  54. template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_MAP_SIZE, typename T)>
  55. struct map : sequence_base<map<BOOST_PP_ENUM_PARAMS(FUSION_MAX_MAP_SIZE, T)> >
  56. {
  57. struct category : random_access_traversal_tag, associative_tag {};
  58. typedef map_tag fusion_tag;
  59. typedef fusion_sequence_tag tag; // this gets picked up by MPL
  60. typedef mpl::false_ is_view;
  61. typedef vector<
  62. BOOST_PP_ENUM_PARAMS(FUSION_MAX_MAP_SIZE, T)>
  63. storage_type;
  64. typedef typename storage_type::size size;
  65. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  66. map()
  67. : data() {}
  68. BOOST_FUSION_GPU_ENABLED
  69. map(map const& rhs)
  70. : data(rhs.data) {}
  71. template <typename Sequence>
  72. BOOST_FUSION_GPU_ENABLED
  73. map(Sequence const& rhs)
  74. : data(rhs) {}
  75. #include <boost/fusion/container/map/detail/cpp03/map_forward_ctor.hpp>
  76. template <typename T>
  77. BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  78. map& operator=(T const& rhs)
  79. {
  80. data = rhs;
  81. return *this;
  82. }
  83. BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  84. map& operator=(map const& rhs)
  85. {
  86. data = rhs.data;
  87. return *this;
  88. }
  89. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  90. FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
  91. #endif
  92. #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
  93. (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
  94. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  95. map(map&& rhs)
  96. : data(std::move(rhs.data)) {}
  97. template <typename T>
  98. BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  99. map& operator=(T&& rhs)
  100. {
  101. data = BOOST_FUSION_FWD_ELEM(T, rhs);
  102. return *this;
  103. }
  104. BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  105. map& operator=(map&& rhs)
  106. {
  107. data = std::move(rhs.data);
  108. return *this;
  109. }
  110. #endif
  111. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  112. FUSION_HASH endif
  113. #endif
  114. BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  115. storage_type& get_data() { return data; }
  116. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  117. storage_type const& get_data() const { return data; }
  118. private:
  119. storage_type data;
  120. };
  121. }}
  122. #undef FUSION_HASH
  123. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  124. #pragma wave option(output: null)
  125. #endif
  126. #endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
  127. #endif