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