1 
2 // Copyright (C) 2009-2012 Lorenzo Caminiti
3 // Distributed under the Boost Software License, Version 1.0
4 // (see accompanying file LICENSE_1_0.txt or a copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 // Home at http://www.boost.org/libs/local_function
7 
8 #include <boost/config.hpp>
9 #ifdef BOOST_NO_CXX11_VARIADIC_MACROS
10 #   error "variadic macros required"
11 #else
12 
13 #include <boost/local_function.hpp>
14 #include <boost/detail/lightweight_test.hpp>
15 
16 //[add_with_default_macro
17 #define WITH_DEFAULT , default
18 //]
19 
main(void)20 int main(void) {
21     //[add_with_default
22     int BOOST_LOCAL_FUNCTION(int x, int y WITH_DEFAULT 2) { // Default.
23         return x + y;
24     } BOOST_LOCAL_FUNCTION_NAME(add)
25 
26     BOOST_TEST(add(1) == 3);
27     //]
28     return boost::report_errors();
29 }
30 
31 #endif // VARIADIC_MACROS
32 
33