add.hpp 1.0 KB

12345678910111213141516171819202122232425
  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_DETAIL_PP_KEYWORD_FACILITY_ADD_HPP_
  7. #define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_ADD_HPP_
  8. #include <boost/preprocessor/control/expr_iif.hpp>
  9. #include <boost/preprocessor/logical/compl.hpp>
  10. // `is_front_macro(tokens)` is 1 if `tokens` start w/ `keyword` to add, else 0.
  11. #define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_ADD_FRONT( \
  12. tokens, is_front_macro, keyword) \
  13. BOOST_PP_EXPR_IIF(BOOST_PP_COMPL(is_front_macro(tokens)), keyword) tokens
  14. // `is_back_macro(tokens)` is 1 if `tokens` end with `keyword` to add, else 0.
  15. #define BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_FACILITY_ADD_BACK( \
  16. tokens, is_back_macro, keyword) \
  17. tokens BOOST_PP_EXPR_IIF(BOOST_PP_COMPL(is_back_macro(tokens)), keyword)
  18. #endif // #include guard