ext_params.hpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef BOOST_MPL_AUX_PREPROCESSOR_EXT_PARAMS_HPP_INCLUDED
  2. #define BOOST_MPL_AUX_PREPROCESSOR_EXT_PARAMS_HPP_INCLUDED
  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/mpl/aux_/config/preprocessor.hpp>
  14. // BOOST_MPL_PP_EXT_PARAMS(2,2,T): <nothing>
  15. // BOOST_MPL_PP_EXT_PARAMS(2,3,T): T2
  16. // BOOST_MPL_PP_EXT_PARAMS(2,4,T): T2, T3
  17. // BOOST_MPL_PP_EXT_PARAMS(2,n,T): T2, T3, .., Tn-1
  18. #if !defined(BOOST_MPL_CFG_NO_OWN_PP_PRIMITIVES)
  19. # include <boost/mpl/aux_/preprocessor/filter_params.hpp>
  20. # include <boost/mpl/aux_/preprocessor/sub.hpp>
  21. # define BOOST_MPL_PP_EXT_PARAMS(i,j,p) \
  22. BOOST_MPL_PP_EXT_PARAMS_DELAY_1(i,BOOST_MPL_PP_SUB(j,i),p) \
  23. /**/
  24. # define BOOST_MPL_PP_EXT_PARAMS_DELAY_1(i,n,p) \
  25. BOOST_MPL_PP_EXT_PARAMS_DELAY_2(i,n,p) \
  26. /**/
  27. # define BOOST_MPL_PP_EXT_PARAMS_DELAY_2(i,n,p) \
  28. BOOST_MPL_PP_EXT_PARAMS_##i(n,p) \
  29. /**/
  30. # define BOOST_MPL_PP_EXT_PARAMS_1(i,p) BOOST_MPL_PP_FILTER_PARAMS_##i(p##1,p##2,p##3,p##4,p##5,p##6,p##7,p##8,p##9)
  31. # define BOOST_MPL_PP_EXT_PARAMS_2(i,p) BOOST_MPL_PP_FILTER_PARAMS_##i(p##2,p##3,p##4,p##5,p##6,p##7,p##8,p##9,p1)
  32. # define BOOST_MPL_PP_EXT_PARAMS_3(i,p) BOOST_MPL_PP_FILTER_PARAMS_##i(p##3,p##4,p##5,p##6,p##7,p##8,p##9,p1,p2)
  33. # define BOOST_MPL_PP_EXT_PARAMS_4(i,p) BOOST_MPL_PP_FILTER_PARAMS_##i(p##4,p##5,p##6,p##7,p##8,p##9,p1,p2,p3)
  34. # define BOOST_MPL_PP_EXT_PARAMS_5(i,p) BOOST_MPL_PP_FILTER_PARAMS_##i(p##5,p##6,p##7,p##8,p##9,p1,p2,p3,p4)
  35. # define BOOST_MPL_PP_EXT_PARAMS_6(i,p) BOOST_MPL_PP_FILTER_PARAMS_##i(p##6,p##7,p##8,p##9,p1,p2,p3,p4,p5)
  36. # define BOOST_MPL_PP_EXT_PARAMS_7(i,p) BOOST_MPL_PP_FILTER_PARAMS_##i(p##7,p##8,p##9,p1,p2,p3,p4,p5,p6)
  37. # define BOOST_MPL_PP_EXT_PARAMS_8(i,p) BOOST_MPL_PP_FILTER_PARAMS_##i(p##8,p##9,p1,p2,p3,p4,p5,p6,p7)
  38. # define BOOST_MPL_PP_EXT_PARAMS_9(i,p) BOOST_MPL_PP_FILTER_PARAMS_##i(p##9,p1,p2,p3,p4,p5,p6,p7,p8)
  39. #else
  40. # include <boost/preprocessor/arithmetic/add.hpp>
  41. # include <boost/preprocessor/arithmetic/sub.hpp>
  42. # include <boost/preprocessor/comma_if.hpp>
  43. # include <boost/preprocessor/repeat.hpp>
  44. # include <boost/preprocessor/tuple/elem.hpp>
  45. # include <boost/preprocessor/cat.hpp>
  46. # define BOOST_MPL_PP_AUX_EXT_PARAM_FUNC(unused, i, op) \
  47. BOOST_PP_COMMA_IF(i) \
  48. BOOST_PP_CAT( \
  49. BOOST_PP_TUPLE_ELEM(2,1,op) \
  50. , BOOST_PP_ADD_D(1, i, BOOST_PP_TUPLE_ELEM(2,0,op)) \
  51. ) \
  52. /**/
  53. # define BOOST_MPL_PP_EXT_PARAMS(i, j, param) \
  54. BOOST_PP_REPEAT( \
  55. BOOST_PP_SUB_D(1,j,i) \
  56. , BOOST_MPL_PP_AUX_EXT_PARAM_FUNC \
  57. , (i,param) \
  58. ) \
  59. /**/
  60. #endif
  61. #endif // BOOST_MPL_AUX_PREPROCESSOR_EXT_PARAMS_HPP_INCLUDED