param.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright (C) 2009-2012 Lorenzo Caminiti
  2. // Distributed under the Boost Software License, Version 1.0
  3. // (see accompanying file LICENSE_1_0.txt or a copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // Home at http://www.boost.org/libs/local_function
  6. #ifndef BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_HPP_
  7. #define BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_HPP_
  8. #include <boost/preprocessor/tuple/elem.hpp>
  9. // PRIVATE //
  10. // Param 2-tuple `([auto | register] type name, default_value)`.
  11. #define BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_INDEX_DECL_ 0
  12. #define BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_INDEX_DEFAULT_ 1
  13. #define BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_INDEX_MAX_ 2
  14. // PUBLIC //
  15. // Expand: `[auto | register] type_ name_` (parameter declaration).
  16. #define BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_DECL(param_traits) \
  17. BOOST_PP_TUPLE_ELEM(BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_INDEX_MAX_, \
  18. BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_INDEX_DECL_, param_traits)
  19. // Expand: `default ... EMPTY()` if default value, `EMPTY()` otherwise.
  20. // Leading default is kept because default value might not be alphanumeric
  21. // (e.g., -123) so failing `CAT` for `IS_EMPTY` check.
  22. #define BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_DEFAULT(param_traits) \
  23. BOOST_PP_TUPLE_ELEM(BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_INDEX_MAX_, \
  24. BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_INDEX_DEFAULT_, \
  25. param_traits)(/* expand EMPTY */)
  26. #endif // #include guard