preprocessor_no_spec.hpp 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // Copyright Cromwell D. Enage 2019.
  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. #ifndef BOOST_PARAMETER_PREPROCESSOR_NO_SPEC_HPP
  6. #define BOOST_PARAMETER_PREPROCESSOR_NO_SPEC_HPP
  7. #include <boost/parameter/aux_/preprocessor/impl/function_name.hpp>
  8. #include <boost/parameter/aux_/preprocessor/impl/no_spec_overloads.hpp>
  9. // Exapnds to a variadic function header that is enabled if and only if all
  10. // its arguments are tagged arguments. All arguments are accessible via args
  11. // and keywords only.
  12. #define BOOST_PARAMETER_NO_SPEC_FUNCTION(result, name) \
  13. BOOST_PARAMETER_NO_SPEC_FUNCTION_HEAD(result, name, 0) \
  14. BOOST_PARAMETER_NO_SPEC_FUNCTION_IMPL_HEAD(name, 0); \
  15. BOOST_PARAMETER_NO_SPEC_FUNCTION_OVERLOAD(name, name, 0, 0) \
  16. BOOST_PARAMETER_NO_SPEC_FUNCTION_IMPL_HEAD(name, 0)
  17. /**/
  18. #include <boost/preprocessor/control/expr_if.hpp>
  19. #include <boost/preprocessor/control/if.hpp>
  20. // Helper macro for BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION,
  21. // BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION,
  22. // BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR, and
  23. // and BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR.
  24. #define BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION_AUX(result, name, impl, c) \
  25. BOOST_PARAMETER_NO_SPEC_FUNCTION_HEAD(result, impl, c) \
  26. BOOST_PARAMETER_NO_SPEC_FUNCTION_OVERLOAD( \
  27. name \
  28. , impl \
  29. , BOOST_PP_IF(BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(impl), 0, 1) \
  30. , c \
  31. ) \
  32. BOOST_PARAMETER_NO_SPEC_FUNCTION_IMPL_HEAD(impl, c) \
  33. BOOST_PP_EXPR_IF(c, const)
  34. /**/
  35. // Exapnds to a variadic member function header that is enabled if and only if
  36. // all its arguments are tagged arguments. All arguments are accessible via
  37. // args and keywords only.
  38. #define BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION(result, name) \
  39. BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION_AUX(result, name, name, 0)
  40. /**/
  41. // Exapnds to a const-qualified variadic member function header that is
  42. // enabled if and only if all its arguments are tagged arguments. All
  43. // arguments are accessible via args and keywords only.
  44. #define BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION(result, name) \
  45. BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION_AUX(result, name, name, 1)
  46. /**/
  47. // Exapnds to a variadic function call operator header that is enabled if and
  48. // only if all its arguments are tagged arguments. All arguments are
  49. // accessible via args and keywords only.
  50. #define BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR(result) \
  51. BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION_AUX( \
  52. result, operator(), operator, 0 \
  53. )
  54. /**/
  55. // Exapnds to a const-qualified variadic function call operator header that is
  56. // enabled if and only if all its arguments are tagged arguments. All
  57. // arguments are accessible via args and keywords only.
  58. #define BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR(result) \
  59. BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION_AUX( \
  60. result, operator(), operator, 1 \
  61. )
  62. /**/
  63. #endif // include guard