match.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright David Abrahams 2005.
  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_MATCH_DWA2005714_HPP
  6. #define BOOST_PARAMETER_MATCH_DWA2005714_HPP
  7. #include <boost/parameter/config.hpp>
  8. #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
  9. #include <boost/parameter/aux_/void.hpp>
  10. #include <boost/preprocessor/arithmetic/sub.hpp>
  11. #include <boost/preprocessor/facilities/intercept.hpp>
  12. #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
  13. #include <boost/preprocessor/seq/size.hpp>
  14. #define BOOST_PARAMETER_MATCH_DEFAULTS(ArgTypes) \
  15. BOOST_PP_ENUM_TRAILING_PARAMS( \
  16. BOOST_PP_SUB( \
  17. BOOST_PARAMETER_MAX_ARITY \
  18. , BOOST_PP_SEQ_SIZE(ArgTypes) \
  19. ) \
  20. , ::boost::parameter::void_ BOOST_PP_INTERCEPT \
  21. )
  22. /**/
  23. #else
  24. #define BOOST_PARAMETER_MATCH_DEFAULTS(ArgTypes)
  25. #endif
  26. #include <boost/parameter/aux_/preprocessor/seq_enum.hpp>
  27. //
  28. // Generates, e.g.
  29. //
  30. // typename dfs_params::match<A1,A2>::type name = dfs_params()
  31. //
  32. // with workarounds for Borland compatibility.
  33. //
  34. #define BOOST_PARAMETER_MATCH(ParameterSpec, ArgTypes, name) \
  35. typename ParameterSpec::match< \
  36. BOOST_PARAMETER_SEQ_ENUM(ArgTypes) \
  37. BOOST_PARAMETER_MATCH_DEFAULTS(ArgTypes) \
  38. >::type name = ParameterSpec()
  39. /**/
  40. #endif // include guard