overloads.hpp 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // Copyright David Abrahams, Daniel Wallin 2003.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // This file generates overloads in this format:
  6. //
  7. // template <typename A0, typename A1>
  8. // typename ::boost::mpl::apply_wrap1<
  9. // ::boost::parameter::aux::make_arg_list<
  10. // PS0,A0
  11. // , ::boost::parameter::aux::make_arg_list<
  12. // PS1,A1
  13. // , ::boost::mpl::identity<
  14. // ::boost::parameter::aux::empty_arg_list
  15. // >
  16. // >
  17. // >
  18. // , unnamed_list
  19. // >::type
  20. // operator()(A0 const& a0, A1 const& a1) const
  21. // {
  22. // typedef typename ::boost::mpl::apply_wrap1<
  23. // ::boost::parameter::aux::make_arg_list<
  24. // PS0,A0
  25. // , ::boost::parameter::aux::make_arg_list<
  26. // PS1,A1
  27. // , ::boost::mpl::identity<
  28. // ::boost::parameter::aux::empty_arg_list
  29. // >
  30. // >
  31. // >
  32. // >::type arg_tuple;
  33. //
  34. // return arg_tuple(
  35. // a0
  36. // , a1
  37. // , ::boost::parameter::aux::void_()
  38. // ...
  39. // );
  40. // }
  41. //
  42. #if !defined(BOOST_PP_IS_ITERATING)
  43. # error Boost.Parameters - do not include this file!
  44. #endif
  45. #define N BOOST_PP_ITERATION()
  46. #define BOOST_PARAMETER_open_list(z, n, text) \
  47. ::boost::parameter::aux::item< \
  48. BOOST_PP_CAT(PS, n), BOOST_PP_CAT(A, n)
  49. #define BOOST_PARAMETER_close_list(z, n, text) >
  50. #define BOOST_PARAMETER_arg_list(n) \
  51. ::boost::parameter::aux::make_arg_list< \
  52. BOOST_PP_ENUM(N, BOOST_PARAMETER_open_list, _) \
  53. , ::boost::parameter::void_ \
  54. BOOST_PP_REPEAT(N, BOOST_PARAMETER_close_list, _) \
  55. , deduced_list \
  56. , ::boost::parameter::aux::tag_keyword_arg \
  57. >
  58. #define BOOST_PARAMETER_arg_pack_init(z, n, limit) \
  59. BOOST_PP_CAT(a, BOOST_PP_SUB(limit, n))
  60. template <BOOST_PP_ENUM_PARAMS(N, typename A)>
  61. typename ::boost::mpl::first<
  62. typename BOOST_PARAMETER_arg_list(N)::type
  63. >::type
  64. operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, & a)) const
  65. {
  66. typedef typename BOOST_PARAMETER_arg_list(N)::type result;
  67. typedef typename ::boost::mpl::first<result>::type result_type;
  68. typedef typename ::boost::mpl::second<result>::type error;
  69. error();
  70. return result_type(
  71. BOOST_PP_ENUM(N, BOOST_PARAMETER_arg_pack_init, BOOST_PP_DEC(N))
  72. BOOST_PP_ENUM_TRAILING_PARAMS(
  73. BOOST_PP_SUB(BOOST_PARAMETER_COMPOSE_MAX_ARITY, N)
  74. , ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT
  75. )
  76. );
  77. }
  78. #undef BOOST_PARAMETER_arg_list
  79. #undef BOOST_PARAMETER_close_list
  80. #undef BOOST_PARAMETER_open_list
  81. #undef N