apply_fwd.hpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #if !defined(BOOST_PP_IS_ITERATING)
  2. ///// header body
  3. #ifndef BOOST_MPL_APPLY_FWD_HPP_INCLUDED
  4. #define BOOST_MPL_APPLY_FWD_HPP_INCLUDED
  5. // Copyright Aleksey Gurtovoy 2000-2004
  6. //
  7. // Distributed under the Boost Software License, Version 1.0.
  8. // (See accompanying file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. //
  11. // See http://www.boost.org/libs/mpl for documentation.
  12. // $Id$
  13. // $Date$
  14. // $Revision$
  15. #if !defined(BOOST_MPL_PREPROCESSING_MODE)
  16. # include <boost/mpl/aux_/na.hpp>
  17. #endif
  18. #include <boost/mpl/aux_/config/use_preprocessed.hpp>
  19. #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
  20. && !defined(BOOST_MPL_PREPROCESSING_MODE)
  21. # define BOOST_MPL_PREPROCESSED_HEADER apply_fwd.hpp
  22. # include <boost/mpl/aux_/include_preprocessed.hpp>
  23. #else
  24. # include <boost/mpl/limits/arity.hpp>
  25. # include <boost/mpl/aux_/preprocessor/params.hpp>
  26. # include <boost/mpl/aux_/preprocessor/default_params.hpp>
  27. # include <boost/mpl/aux_/config/ctps.hpp>
  28. # include <boost/mpl/aux_/nttp_decl.hpp>
  29. # include <boost/preprocessor/comma_if.hpp>
  30. # include <boost/preprocessor/iterate.hpp>
  31. # include <boost/preprocessor/cat.hpp>
  32. // agurt, 15/jan/02: top-level 'apply' template gives an ICE on MSVC
  33. // (for known reasons)
  34. #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
  35. # define BOOST_MPL_CFG_NO_APPLY_TEMPLATE
  36. #endif
  37. namespace boost { namespace mpl {
  38. // local macro, #undef-ined at the end of the header
  39. # define AUX778076_APPLY_DEF_PARAMS(param, value) \
  40. BOOST_MPL_PP_DEFAULT_PARAMS( \
  41. BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
  42. , param \
  43. , value \
  44. ) \
  45. /**/
  46. # define AUX778076_APPLY_N_COMMA_PARAMS(n, param) \
  47. BOOST_PP_COMMA_IF(n) \
  48. BOOST_MPL_PP_PARAMS(n, param) \
  49. /**/
  50. # if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE)
  51. #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
  52. // forward declaration
  53. template<
  54. typename F, AUX778076_APPLY_DEF_PARAMS(typename T, na)
  55. >
  56. struct apply;
  57. #else
  58. namespace aux {
  59. template< BOOST_AUX_NTTP_DECL(int, arity_) > struct apply_chooser;
  60. }
  61. #endif
  62. # endif // BOOST_MPL_CFG_NO_APPLY_TEMPLATE
  63. #define BOOST_PP_ITERATION_PARAMS_1 \
  64. (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/apply_fwd.hpp>))
  65. #include BOOST_PP_ITERATE()
  66. # undef AUX778076_APPLY_N_COMMA_PARAMS
  67. # undef AUX778076_APPLY_DEF_PARAMS
  68. }}
  69. #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
  70. #endif // BOOST_MPL_APPLY_FWD_HPP_INCLUDED
  71. ///// iteration
  72. #else
  73. #define i_ BOOST_PP_FRAME_ITERATION(1)
  74. template<
  75. typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T)
  76. >
  77. struct BOOST_PP_CAT(apply,i_);
  78. #undef i_
  79. #endif // BOOST_PP_IS_ITERATING