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_LAMBDAS 10 # error "lambda functions required" 11 #else 12 13 #include <boost/detail/lightweight_test.hpp> 14 #include <algorithm> 15 main(void)16int main(void) { 17 //[gcc_cxx11_lambda 18 int val = 2; 19 int nums[] = {1, 2, 3}; 20 int* end = nums + 3; 21 22 int* iter = std::find_if(nums, end, 23 [val](int num) -> bool { 24 return num == val; 25 } 26 ); 27 //] 28 29 BOOST_TEST(iter != end); 30 BOOST_TEST(*iter == val); 31 return boost::report_errors(); 32 } 33 34 #endif // LAMBDAS 35 36