add_classifiers.cpp 882 B

123456789101112131415161718192021222324252627282930
  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. #include <boost/config.hpp>
  7. #if !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)
  8. # error "auto-declarations not allowed (using `auto` as storage classifier)"
  9. #elif defined(BOOST_NO_CXX11_VARIADIC_MACROS)
  10. # error "variadic macros required"
  11. #else
  12. #include <boost/local_function.hpp>
  13. #include <boost/detail/lightweight_test.hpp>
  14. int main(void) {
  15. //[add_classifiers
  16. int BOOST_LOCAL_FUNCTION(auto int x, register int y) { // Classifiers.
  17. return x + y;
  18. } BOOST_LOCAL_FUNCTION_NAME(add)
  19. //]
  20. BOOST_TEST(add(1, 2) == 3);
  21. return boost::report_errors();
  22. }
  23. #endif // AUTO_DECLARATIONS && VARIADIC_MACROS