tuple.hpp 3.5 KB

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