def_params_tail.hpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #ifndef BOOST_MPL_AUX_PREPROCESSOR_DEF_PARAMS_TAIL_HPP_INCLUDED
  2. #define BOOST_MPL_AUX_PREPROCESSOR_DEF_PARAMS_TAIL_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/limits/arity.hpp>
  14. #include <boost/mpl/aux_/config/dtp.hpp>
  15. #include <boost/mpl/aux_/config/preprocessor.hpp>
  16. #include <boost/preprocessor/comma_if.hpp>
  17. #include <boost/preprocessor/logical/and.hpp>
  18. #include <boost/preprocessor/identity.hpp>
  19. #include <boost/preprocessor/empty.hpp>
  20. // BOOST_MPL_PP_DEF_PARAMS_TAIL(1,T,value): , T1 = value, .., Tn = value
  21. // BOOST_MPL_PP_DEF_PARAMS_TAIL(2,T,value): , T2 = value, .., Tn = value
  22. // BOOST_MPL_PP_DEF_PARAMS_TAIL(n,T,value): <nothing>
  23. #if !defined(BOOST_MPL_CFG_NO_OWN_PP_PRIMITIVES)
  24. # include <boost/mpl/aux_/preprocessor/filter_params.hpp>
  25. # include <boost/mpl/aux_/preprocessor/sub.hpp>
  26. # define BOOST_MPL_PP_DEF_PARAMS_TAIL_IMPL(i, param, value_func) \
  27. BOOST_MPL_PP_DEF_PARAMS_TAIL_DELAY_1( \
  28. i \
  29. , BOOST_MPL_PP_SUB(BOOST_MPL_LIMIT_METAFUNCTION_ARITY,i) \
  30. , param \
  31. , value_func \
  32. ) \
  33. /**/
  34. # define BOOST_MPL_PP_DEF_PARAMS_TAIL_DELAY_1(i, n, param, value_func) \
  35. BOOST_MPL_PP_DEF_PARAMS_TAIL_DELAY_2(i,n,param,value_func) \
  36. /**/
  37. # define BOOST_MPL_PP_DEF_PARAMS_TAIL_DELAY_2(i, n, param, value_func) \
  38. BOOST_PP_COMMA_IF(BOOST_PP_AND(i,n)) \
  39. BOOST_MPL_PP_DEF_PARAMS_TAIL_##i(n,param,value_func) \
  40. /**/
  41. # define BOOST_MPL_PP_DEF_PARAMS_TAIL_0(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##1 v(),p##2 v(),p##3 v(),p##4 v(),p##5 v(),p##6 v(),p##7 v(),p##8 v(),p##9 v())
  42. # define BOOST_MPL_PP_DEF_PARAMS_TAIL_1(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##2 v(),p##3 v(),p##4 v(),p##5 v(),p##6 v(),p##7 v(),p##8 v(),p##9 v(),p1)
  43. # define BOOST_MPL_PP_DEF_PARAMS_TAIL_2(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##3 v(),p##4 v(),p##5 v(),p##6 v(),p##7 v(),p##8 v(),p##9 v(),p1,p2)
  44. # define BOOST_MPL_PP_DEF_PARAMS_TAIL_3(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##4 v(),p##5 v(),p##6 v(),p##7 v(),p##8 v(),p##9 v(),p1,p2,p3)
  45. # define BOOST_MPL_PP_DEF_PARAMS_TAIL_4(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##5 v(),p##6 v(),p##7 v(),p##8 v(),p##9 v(),p1,p2,p3,p4)
  46. # define BOOST_MPL_PP_DEF_PARAMS_TAIL_5(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##6 v(),p##7 v(),p##8 v(),p##9 v(),p1,p2,p3,p4,p5)
  47. # define BOOST_MPL_PP_DEF_PARAMS_TAIL_6(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##7 v(),p##8 v(),p##9 v(),p1,p2,p3,p4,p5,p6)
  48. # define BOOST_MPL_PP_DEF_PARAMS_TAIL_7(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##8 v(),p##9 v(),p1,p2,p3,p4,p5,p6,p7)
  49. # define BOOST_MPL_PP_DEF_PARAMS_TAIL_8(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##9 v(),p1,p2,p3,p4,p5,p6,p7,p8)
  50. # define BOOST_MPL_PP_DEF_PARAMS_TAIL_9(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p1,p2,p3,p4,p5,p6,p7,p8,p9)
  51. #else
  52. # include <boost/preprocessor/arithmetic/add.hpp>
  53. # include <boost/preprocessor/arithmetic/sub.hpp>
  54. # include <boost/preprocessor/inc.hpp>
  55. # include <boost/preprocessor/tuple/elem.hpp>
  56. # include <boost/preprocessor/repeat.hpp>
  57. # include <boost/preprocessor/cat.hpp>
  58. # define BOOST_MPL_PP_AUX_TAIL_PARAM_FUNC(unused, i, op) \
  59. , BOOST_PP_CAT( \
  60. BOOST_PP_TUPLE_ELEM(3, 1, op) \
  61. , BOOST_PP_ADD_D(1, i, BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(3, 0, op))) \
  62. ) BOOST_PP_TUPLE_ELEM(3, 2, op)() \
  63. /**/
  64. # define BOOST_MPL_PP_DEF_PARAMS_TAIL_IMPL(i, param, value_func) \
  65. BOOST_PP_REPEAT( \
  66. BOOST_PP_SUB_D(1, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, i) \
  67. , BOOST_MPL_PP_AUX_TAIL_PARAM_FUNC \
  68. , (i, param, value_func) \
  69. ) \
  70. /**/
  71. #endif // BOOST_MPL_CFG_NO_OWN_PP_PRIMITIVES
  72. #define BOOST_MPL_PP_DEF_PARAMS_TAIL(i, param, value) \
  73. BOOST_MPL_PP_DEF_PARAMS_TAIL_IMPL(i, param, BOOST_PP_IDENTITY(=value)) \
  74. /**/
  75. #if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES)
  76. # define BOOST_MPL_PP_NESTED_DEF_PARAMS_TAIL(i, param, value) \
  77. BOOST_MPL_PP_DEF_PARAMS_TAIL_IMPL(i, param, BOOST_PP_IDENTITY(=value)) \
  78. /**/
  79. #else
  80. # define BOOST_MPL_PP_NESTED_DEF_PARAMS_TAIL(i, param, value) \
  81. BOOST_MPL_PP_DEF_PARAMS_TAIL_IMPL(i, param, BOOST_PP_EMPTY) \
  82. /**/
  83. #endif
  84. #endif // BOOST_MPL_AUX_PREPROCESSOR_DEF_PARAMS_TAIL_HPP_INCLUDED