/Src/Dependencies/Boost/boost/fusion/container/vector/detail/vector_n_chooser.hpp

http://hadesmem.googlecode.com/ · C++ Header · 81 lines · 56 code · 13 blank · 12 comment · 0 complexity · 7d9962ed7bf228e778e201164943e53b 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_N_CHOOSER_07072005_1248)
  8. #define FUSION_VECTOR_N_CHOOSER_07072005_1248
  9. #include <boost/fusion/container/vector/limits.hpp>
  10. // include vector0..N where N is FUSION_MAX_VECTOR_SIZE
  11. #include <boost/fusion/container/vector/vector10.hpp>
  12. #if (FUSION_MAX_VECTOR_SIZE > 10)
  13. #include <boost/fusion/container/vector/vector20.hpp>
  14. #endif
  15. #if (FUSION_MAX_VECTOR_SIZE > 20)
  16. #include <boost/fusion/container/vector/vector30.hpp>
  17. #endif
  18. #if (FUSION_MAX_VECTOR_SIZE > 30)
  19. #include <boost/fusion/container/vector/vector40.hpp>
  20. #endif
  21. #if (FUSION_MAX_VECTOR_SIZE > 40)
  22. #include <boost/fusion/container/vector/vector50.hpp>
  23. #endif
  24. #include <boost/preprocessor/cat.hpp>
  25. #include <boost/preprocessor/arithmetic/dec.hpp>
  26. #include <boost/preprocessor/arithmetic/sub.hpp>
  27. #include <boost/preprocessor/facilities/intercept.hpp>
  28. #include <boost/preprocessor/repetition/enum_params.hpp>
  29. #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
  30. namespace boost { namespace fusion
  31. {
  32. struct void_;
  33. }}
  34. namespace boost { namespace fusion { namespace detail
  35. {
  36. template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename T)>
  37. struct vector_n_chooser
  38. {
  39. typedef BOOST_PP_CAT(vector, FUSION_MAX_VECTOR_SIZE)<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)> type;
  40. };
  41. template <>
  42. struct vector_n_chooser<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, void_ BOOST_PP_INTERCEPT)>
  43. {
  44. typedef vector0<> type;
  45. };
  46. #define BOOST_PP_FILENAME_1 \
  47. <boost/fusion/container/vector/detail/vector_n_chooser.hpp>
  48. #define BOOST_PP_ITERATION_LIMITS (1, BOOST_PP_DEC(FUSION_MAX_VECTOR_SIZE))
  49. #include BOOST_PP_ITERATE()
  50. }}}
  51. #endif
  52. ///////////////////////////////////////////////////////////////////////////////
  53. //
  54. // Preprocessor vertical repetition code
  55. //
  56. ///////////////////////////////////////////////////////////////////////////////
  57. #else // defined(BOOST_PP_IS_ITERATING)
  58. #define N BOOST_PP_ITERATION()
  59. template <BOOST_PP_ENUM_PARAMS(N, typename T)>
  60. struct vector_n_chooser<
  61. BOOST_PP_ENUM_PARAMS(N, T)
  62. BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(FUSION_MAX_VECTOR_SIZE, N), void_ BOOST_PP_INTERCEPT)>
  63. {
  64. typedef BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)> type;
  65. };
  66. #undef N
  67. #endif // defined(BOOST_PP_IS_ITERATING)