components_as_mpl_sequence.hpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. // (C) Copyright Tobias Schwinger
  2. //
  3. // Use modification and distribution are subject to the boost Software License,
  4. // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
  5. //------------------------------------------------------------------------------
  6. #ifndef BOOST_FT_DETAIL_COMPONENTS_AS_MPL_SEQUENCE_HPP_INCLUDED
  7. #define BOOST_FT_DETAIL_COMPONENTS_AS_MPL_SEQUENCE_HPP_INCLUDED
  8. #include <boost/mpl/size_fwd.hpp>
  9. #include <boost/mpl/empty_fwd.hpp>
  10. #include <boost/mpl/front_fwd.hpp>
  11. #include <boost/mpl/back_fwd.hpp>
  12. #include <boost/mpl/at_fwd.hpp>
  13. #include <boost/mpl/begin_end_fwd.hpp>
  14. #include <boost/mpl/clear_fwd.hpp>
  15. #include <boost/mpl/push_front_fwd.hpp>
  16. #include <boost/mpl/pop_front_fwd.hpp>
  17. #include <boost/mpl/push_back_fwd.hpp>
  18. #include <boost/mpl/pop_back_fwd.hpp>
  19. namespace boost { namespace mpl {
  20. template<> struct size_impl
  21. < function_types::detail::components_mpl_sequence_tag >
  22. {
  23. template< typename S > struct apply
  24. : mpl::size <typename S::types>
  25. { };
  26. };
  27. template<> struct empty_impl
  28. < function_types::detail::components_mpl_sequence_tag >
  29. {
  30. template< typename S > struct apply
  31. : mpl::empty <typename S::types>
  32. { };
  33. };
  34. template<> struct front_impl
  35. < function_types::detail::components_mpl_sequence_tag >
  36. {
  37. template< typename S > struct apply
  38. : mpl::front <typename S::types>
  39. { };
  40. };
  41. template<> struct back_impl
  42. < function_types::detail::components_mpl_sequence_tag >
  43. {
  44. template< typename S > struct apply
  45. : mpl::back <typename S::types>
  46. { };
  47. };
  48. template<> struct at_impl
  49. < function_types::detail::components_mpl_sequence_tag >
  50. {
  51. template< typename S, typename N > struct apply
  52. : mpl::at <typename S::types, N >
  53. { };
  54. };
  55. template<> struct begin_impl
  56. < function_types::detail::components_mpl_sequence_tag >
  57. {
  58. template< typename S > struct apply
  59. : mpl::begin <typename S::types>
  60. { };
  61. };
  62. template<> struct end_impl
  63. < function_types::detail::components_mpl_sequence_tag >
  64. {
  65. template< typename S > struct apply
  66. : mpl::end <typename S::types>
  67. { };
  68. };
  69. template<> struct clear_impl
  70. < function_types::detail::components_mpl_sequence_tag >
  71. {
  72. template< typename S >
  73. struct apply
  74. : S
  75. {
  76. typedef apply type;
  77. typedef typename mpl::clear< typename S::types >::type types;
  78. };
  79. };
  80. template<>
  81. struct push_front_impl
  82. < function_types::detail::components_mpl_sequence_tag >
  83. {
  84. template< typename S, typename T >
  85. struct apply
  86. : S
  87. {
  88. typedef apply type;
  89. typedef typename mpl::push_front< typename S::types, T >::type types;
  90. };
  91. };
  92. template<>
  93. struct pop_front_impl
  94. < function_types::detail::components_mpl_sequence_tag >
  95. {
  96. template< typename S >
  97. struct apply
  98. : S
  99. {
  100. typedef apply type;
  101. typedef typename mpl::pop_front< typename S::types >::type types;
  102. };
  103. };
  104. template<>
  105. struct push_back_impl
  106. < function_types::detail::components_mpl_sequence_tag >
  107. {
  108. template< typename S, typename T >
  109. struct apply
  110. : S
  111. {
  112. typedef apply type;
  113. typedef typename mpl::push_back< typename S::types, T >::type types;
  114. };
  115. };
  116. template<>
  117. struct pop_back_impl
  118. < function_types::detail::components_mpl_sequence_tag >
  119. {
  120. template< typename S >
  121. struct apply
  122. : S
  123. {
  124. typedef apply type;
  125. typedef typename mpl::pop_back< typename S::types >::type types;
  126. };
  127. };
  128. } } // namespace ::boost::mpl
  129. #endif