default_params.hpp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef BOOST_MPL_AUX_PREPROCESSOR_DEFAULT_PARAMS_HPP_INCLUDED
  2. #define BOOST_MPL_AUX_PREPROCESSOR_DEFAULT_PARAMS_HPP_INCLUDED
  3. // Copyright Aleksey Gurtovoy 2002-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_DEFAULT_PARAMS(0,T,int): <nothing>
  15. // BOOST_MPL_PP_DEFAULT_PARAMS(1,T,int): T1 = int
  16. // BOOST_MPL_PP_DEFAULT_PARAMS(2,T,int): T1 = int, T2 = int
  17. // BOOST_MPL_PP_DEFAULT_PARAMS(n,T,int): T1 = int, T2 = int, .., Tn = int
  18. #if !defined(BOOST_MPL_CFG_NO_OWN_PP_PRIMITIVES)
  19. # include <boost/preprocessor/cat.hpp>
  20. # define BOOST_MPL_PP_DEFAULT_PARAMS(n,p,v) \
  21. BOOST_PP_CAT(BOOST_MPL_PP_DEFAULT_PARAMS_,n)(p,v) \
  22. /**/
  23. # define BOOST_MPL_PP_DEFAULT_PARAMS_0(p,v)
  24. # define BOOST_MPL_PP_DEFAULT_PARAMS_1(p,v) p##1=v
  25. # define BOOST_MPL_PP_DEFAULT_PARAMS_2(p,v) p##1=v,p##2=v
  26. # define BOOST_MPL_PP_DEFAULT_PARAMS_3(p,v) p##1=v,p##2=v,p##3=v
  27. # define BOOST_MPL_PP_DEFAULT_PARAMS_4(p,v) p##1=v,p##2=v,p##3=v,p##4=v
  28. # define BOOST_MPL_PP_DEFAULT_PARAMS_5(p,v) p##1=v,p##2=v,p##3=v,p##4=v,p##5=v
  29. # define BOOST_MPL_PP_DEFAULT_PARAMS_6(p,v) p##1=v,p##2=v,p##3=v,p##4=v,p##5=v,p##6=v
  30. # define BOOST_MPL_PP_DEFAULT_PARAMS_7(p,v) p##1=v,p##2=v,p##3=v,p##4=v,p##5=v,p##6=v,p##7=v
  31. # define BOOST_MPL_PP_DEFAULT_PARAMS_8(p,v) p##1=v,p##2=v,p##3=v,p##4=v,p##5=v,p##6=v,p##7=v,p##8=v
  32. # define BOOST_MPL_PP_DEFAULT_PARAMS_9(p,v) 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
  33. #else
  34. # include <boost/preprocessor/tuple/elem.hpp>
  35. # include <boost/preprocessor/comma_if.hpp>
  36. # include <boost/preprocessor/repeat.hpp>
  37. # include <boost/preprocessor/inc.hpp>
  38. # include <boost/preprocessor/cat.hpp>
  39. # define BOOST_MPL_PP_AUX_DEFAULT_PARAM_FUNC(unused, i, pv) \
  40. BOOST_PP_COMMA_IF(i) \
  41. BOOST_PP_CAT( BOOST_PP_TUPLE_ELEM(2,0,pv), BOOST_PP_INC(i) ) \
  42. = BOOST_PP_TUPLE_ELEM(2,1,pv) \
  43. /**/
  44. # define BOOST_MPL_PP_DEFAULT_PARAMS(n, param, value) \
  45. BOOST_PP_REPEAT( \
  46. n \
  47. , BOOST_MPL_PP_AUX_DEFAULT_PARAM_FUNC \
  48. , (param,value) \
  49. ) \
  50. /**/
  51. #endif
  52. #endif // BOOST_MPL_AUX_PREPROCESSOR_DEFAULT_PARAMS_HPP_INCLUDED