numbered_c.hpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION
  2. #if defined(BOOST_PP_IS_ITERATING)
  3. // Copyright Aleksey Gurtovoy 2000-2004
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // See http://www.boost.org/libs/mpl for documentation.
  10. // $Id$
  11. // $Date$
  12. // $Revision$
  13. #include <boost/preprocessor/enum_params.hpp>
  14. #include <boost/preprocessor/enum_shifted_params.hpp>
  15. #include <boost/preprocessor/comma_if.hpp>
  16. #include <boost/preprocessor/repeat.hpp>
  17. #include <boost/preprocessor/dec.hpp>
  18. #include <boost/preprocessor/cat.hpp>
  19. #define i_ BOOST_PP_FRAME_ITERATION(1)
  20. #if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
  21. # define AUX778076_VECTOR_TAIL(vector, i_, C) \
  22. BOOST_PP_CAT(BOOST_PP_CAT(vector,i_),_c)<T \
  23. BOOST_PP_COMMA_IF(i_) BOOST_PP_ENUM_PARAMS(i_, C) \
  24. > \
  25. /**/
  26. #if i_ > 0
  27. template<
  28. typename T
  29. , BOOST_PP_ENUM_PARAMS(i_, T C)
  30. >
  31. struct BOOST_PP_CAT(BOOST_PP_CAT(vector,i_),_c)
  32. : v_item<
  33. integral_c<T,BOOST_PP_CAT(C,BOOST_PP_DEC(i_))>
  34. , AUX778076_VECTOR_TAIL(vector,BOOST_PP_DEC(i_),C)
  35. >
  36. {
  37. typedef BOOST_PP_CAT(BOOST_PP_CAT(vector,i_),_c) type;
  38. typedef T value_type;
  39. };
  40. #endif
  41. # undef AUX778076_VECTOR_TAIL
  42. #else // "brute force" implementation
  43. # define AUX778076_VECTOR_C_PARAM_FUNC(unused, i_, param) \
  44. BOOST_PP_COMMA_IF(i_) \
  45. integral_c<T,BOOST_PP_CAT(param,i_)> \
  46. /**/
  47. template<
  48. typename T
  49. , BOOST_PP_ENUM_PARAMS(i_, T C)
  50. >
  51. struct BOOST_PP_CAT(BOOST_PP_CAT(vector,i_),_c)
  52. : BOOST_PP_CAT(vector,i_)< BOOST_PP_REPEAT(i_,AUX778076_VECTOR_C_PARAM_FUNC,C) >
  53. {
  54. typedef BOOST_PP_CAT(BOOST_PP_CAT(vector,i_),_c) type;
  55. typedef T value_type;
  56. };
  57. # undef AUX778076_VECTOR_C_PARAM_FUNC
  58. #endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
  59. #undef i_
  60. #endif // BOOST_PP_IS_ITERATING