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

http://hadesmem.googlecode.com/ · C++ Header · 91 lines · 65 code · 15 blank · 11 comment · 0 complexity · 346fcdfd4f4cc87d837499d68fb8fa67 MD5 · raw file

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