/Src/Dependencies/Boost/boost/fusion/container/generation/make_deque.hpp

http://hadesmem.googlecode.com/ · C++ Header · 98 lines · 65 code · 15 blank · 18 comment · 0 complexity · 21226ebe3303765af9f063feec25a90c MD5 · raw file

  1. /*=============================================================================
  2. Copyright (c) 2001-2006 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. /*=============================================================================
  8. Copyright (c) 2001-2006 Joel de Guzman
  9. Distributed under the Boost Software License, Version 1.0. (See accompanying
  10. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  11. ==============================================================================*/
  12. #ifndef BOOST_PP_IS_ITERATING
  13. #if !defined(FUSION_MAKE_DEQUE_07162005_0243)
  14. #define FUSION_MAKE_DEQUE_07162005_0243
  15. #include <boost/preprocessor/iterate.hpp>
  16. #include <boost/preprocessor/repetition/enum_params.hpp>
  17. #include <boost/preprocessor/repetition/enum_binary_params.hpp>
  18. #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
  19. #include <boost/preprocessor/repetition/repeat_from_to.hpp>
  20. #include <boost/fusion/container/deque/deque.hpp>
  21. #include <boost/fusion/support/detail/as_fusion_element.hpp>
  22. namespace boost { namespace fusion
  23. {
  24. struct void_;
  25. namespace result_of
  26. {
  27. template <
  28. BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
  29. FUSION_MAX_DEQUE_SIZE, typename T, void_)
  30. , typename Extra = void_
  31. >
  32. struct make_deque;
  33. template <>
  34. struct make_deque<>
  35. {
  36. typedef deque<> type;
  37. };
  38. }
  39. inline deque<>
  40. make_deque()
  41. {
  42. return deque<>();
  43. }
  44. #define BOOST_FUSION_AS_FUSION_ELEMENT(z, n, data) \
  45. typename detail::as_fusion_element<BOOST_PP_CAT(T, n)>::type
  46. #define BOOST_PP_FILENAME_1 <boost/fusion/container/generation/make_deque.hpp>
  47. #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE)
  48. #include BOOST_PP_ITERATE()
  49. #undef BOOST_FUSION_AS_FUSION_ELEMENT
  50. }}
  51. #endif
  52. #else // defined(BOOST_PP_IS_ITERATING)
  53. ///////////////////////////////////////////////////////////////////////////////
  54. //
  55. // Preprocessor vertical repetition code
  56. //
  57. ///////////////////////////////////////////////////////////////////////////////
  58. #define N BOOST_PP_ITERATION()
  59. namespace result_of
  60. {
  61. template <BOOST_PP_ENUM_PARAMS(N, typename T)>
  62. #if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)
  63. #define TEXT(z, n, text) , text
  64. struct make_deque< BOOST_PP_ENUM_PARAMS(N, T) BOOST_PP_REPEAT_FROM_TO(BOOST_PP_DEC(N), FUSION_MAX_DEQUE_SIZE, TEXT, void_) >
  65. #undef TEXT
  66. #else
  67. struct make_deque<BOOST_PP_ENUM_PARAMS(N, T)>
  68. #endif
  69. {
  70. typedef deque<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)> type;
  71. };
  72. }
  73. template <BOOST_PP_ENUM_PARAMS(N, typename T)>
  74. inline deque<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>
  75. make_deque(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _))
  76. {
  77. return deque<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>(
  78. BOOST_PP_ENUM_PARAMS(N, _));
  79. }
  80. #undef N
  81. #endif // defined(BOOST_PP_IS_ITERATING)