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

http://hadesmem.googlecode.com/ · C++ Header · 78 lines · 54 code · 13 blank · 11 comment · 0 complexity · 55c2f3556385b7f714d1934a9047663e 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_VECTOR_TIE_07192005_1242)
  8. #define FUSION_VECTOR_TIE_07192005_1242
  9. #include <boost/preprocessor/iterate.hpp>
  10. #include <boost/preprocessor/cat.hpp>
  11. #include <boost/preprocessor/repetition/enum_params.hpp>
  12. #include <boost/preprocessor/repetition/enum_binary_params.hpp>
  13. #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
  14. #include <boost/preprocessor/repetition/repeat_from_to.hpp>
  15. #include <boost/fusion/container/vector/vector.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 vector_tie;
  27. }
  28. #define BOOST_FUSION_REF(z, n, data) BOOST_PP_CAT(T, n)&
  29. #define BOOST_PP_FILENAME_1 <boost/fusion/container/generation/vector_tie.hpp>
  30. #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
  31. #include BOOST_PP_ITERATE()
  32. #undef BOOST_FUSION_REF
  33. }}
  34. #endif
  35. #else // defined(BOOST_PP_IS_ITERATING)
  36. ///////////////////////////////////////////////////////////////////////////////
  37. //
  38. // Preprocessor vertical repetition code
  39. //
  40. ///////////////////////////////////////////////////////////////////////////////
  41. #define N BOOST_PP_ITERATION()
  42. namespace result_of
  43. {
  44. template <BOOST_PP_ENUM_PARAMS(N, typename T)>
  45. #if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)
  46. #define TEXT(z, n, text) , text
  47. struct vector_tie< BOOST_PP_ENUM_PARAMS(N, T) BOOST_PP_REPEAT_FROM_TO(BOOST_PP_DEC(N), FUSION_MAX_VECTOR_SIZE, TEXT, void_) >
  48. #undef TEXT
  49. #else
  50. struct vector_tie<BOOST_PP_ENUM_PARAMS(N, T)>
  51. #endif
  52. {
  53. typedef vector<BOOST_PP_ENUM(N, BOOST_FUSION_REF, _)> type;
  54. };
  55. }
  56. template <BOOST_PP_ENUM_PARAMS(N, typename T)>
  57. inline vector<BOOST_PP_ENUM(N, BOOST_FUSION_REF, _)>
  58. vector_tie(BOOST_PP_ENUM_BINARY_PARAMS(N, T, & _))
  59. {
  60. return vector<BOOST_PP_ENUM(N, BOOST_FUSION_REF, _)>(
  61. BOOST_PP_ENUM_PARAMS(N, _));
  62. }
  63. #undef N
  64. #endif // defined(BOOST_PP_IS_ITERATING)