impl_pp_keyword.cpp 1.0 KB

12345678910111213141516171819202122232425262728
  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. //[impl_pp_keyword
  7. #include <boost/local_function/detail/preprocessor/keyword/thisunderscore.hpp>
  8. #include <boost/local_function/detail/preprocessor/keyword/const.hpp>
  9. #include <boost/local_function/detail/preprocessor/keyword/bind.hpp>
  10. #include <boost/detail/lightweight_test.hpp>
  11. // Expand to 1 if space-separated tokens end with `this_`, 0 otherwise.
  12. #define IS_THIS_BACK(tokens) \
  13. BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_THISUNDERSCORE_BACK( \
  14. BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_BIND_REMOVE_FRONT( \
  15. BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT( \
  16. tokens \
  17. )))
  18. int main(void) {
  19. BOOST_TEST(IS_THIS_BACK(const bind this_) == 1);
  20. BOOST_TEST(IS_THIS_BACK(const bind& x) == 0);
  21. return boost::report_errors();
  22. }
  23. //]