tuple.hpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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_TUPLE_10032005_0810)
  7. #define FUSION_TUPLE_10032005_0810
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/tuple/detail/tuple_fwd.hpp>
  10. #include <boost/fusion/container/vector/vector.hpp>
  11. #include <boost/fusion/sequence/intrinsic/size.hpp>
  12. #include <boost/fusion/sequence/intrinsic/value_at.hpp>
  13. #include <boost/fusion/sequence/intrinsic/at.hpp>
  14. #include <boost/fusion/sequence/comparison.hpp>
  15. #include <boost/fusion/sequence/io.hpp>
  16. #include <boost/utility/enable_if.hpp>
  17. #include <boost/type_traits/is_const.hpp>
  18. #include <boost/config/no_tr1/utility.hpp>
  19. #if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
  20. #include <boost/fusion/tuple/detail/preprocessed/tuple.hpp>
  21. #else
  22. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  23. #pragma wave option(preserve: 2, line: 0, output: "preprocessed/tuple" FUSION_MAX_VECTOR_SIZE_STR ".hpp")
  24. #endif
  25. /*=============================================================================
  26. Copyright (c) 2001-2011 Joel de Guzman
  27. Distributed under the Boost Software License, Version 1.0. (See accompanying
  28. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  29. This is an auto-generated file. Do not edit!
  30. ==============================================================================*/
  31. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  32. #pragma wave option(preserve: 1)
  33. #endif
  34. namespace boost { namespace fusion
  35. {
  36. template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename T)>
  37. struct tuple : vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)>
  38. {
  39. typedef vector<
  40. BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)>
  41. base_type;
  42. BOOST_FUSION_GPU_ENABLED tuple()
  43. : base_type() {}
  44. BOOST_FUSION_GPU_ENABLED tuple(tuple const& rhs)
  45. : base_type(static_cast<base_type const&>(rhs)) {}
  46. template <typename U1, typename U2>
  47. BOOST_FUSION_GPU_ENABLED
  48. tuple(std::pair<U1, U2> const& rhs)
  49. : base_type(rhs) {}
  50. #include <boost/fusion/tuple/detail/tuple_expand.hpp>
  51. template <typename T>
  52. BOOST_FUSION_GPU_ENABLED
  53. tuple& operator=(T const& rhs)
  54. {
  55. base_type::operator=(rhs);
  56. return *this;
  57. }
  58. BOOST_FUSION_GPU_ENABLED
  59. tuple& operator=(tuple const& rhs)
  60. {
  61. base_type::operator=(static_cast<base_type const&>(rhs));
  62. return *this;
  63. }
  64. template <typename U1, typename U2>
  65. BOOST_FUSION_GPU_ENABLED
  66. tuple& operator=(std::pair<U1, U2> const& rhs)
  67. {
  68. base_type::operator=(rhs);
  69. return *this;
  70. }
  71. };
  72. template <typename Tuple>
  73. struct tuple_size : result_of::size<Tuple> {};
  74. template <int N, typename Tuple>
  75. struct tuple_element : result_of::value_at_c<Tuple, N> {};
  76. template <int N, typename Tuple>
  77. BOOST_FUSION_GPU_ENABLED
  78. inline typename
  79. lazy_disable_if<
  80. is_const<Tuple>
  81. , result_of::at_c<Tuple, N>
  82. >::type
  83. get(Tuple& tup)
  84. {
  85. return at_c<N>(tup);
  86. }
  87. template <int N, typename Tuple>
  88. BOOST_FUSION_GPU_ENABLED
  89. inline typename result_of::at_c<Tuple const, N>::type
  90. get(Tuple const& tup)
  91. {
  92. return at_c<N>(tup);
  93. }
  94. }}
  95. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  96. #pragma wave option(output: null)
  97. #endif
  98. #endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
  99. #endif