add_with_default_seq.cpp 578 B

123456789101112131415161718192021
  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/local_function.hpp>
  7. #include <boost/detail/lightweight_test.hpp>
  8. #define WITH_DEFAULT )(default
  9. int main(void) {
  10. int BOOST_LOCAL_FUNCTION( (int x) (int y WITH_DEFAULT 2) ) {
  11. return x + y;
  12. } BOOST_LOCAL_FUNCTION_NAME(add)
  13. BOOST_TEST(add(1) == 3);
  14. return boost::report_errors();
  15. }