• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef __GNUC__
10 #   error "GCC required (using non-standard GCC statement expressions)"
11 #else
12 
13 #include "gcc_lambda.hpp"
14 #include <boost/detail/lightweight_test.hpp>
15 #include <algorithm>
16 
main(void)17 int main(void) {
18     //[gcc_lambda
19     int val = 2;
20     int nums[] = {1, 2, 3};
21     int* end = nums + 3;
22 
23     int* iter = std::find_if(nums, end,
24         GCC_LAMBDA(const bind val, int num, return bool) {
25             return num == val;
26         } GCC_LAMBDA_END
27     );
28     //]
29 
30     BOOST_TEST(iter != end);
31     BOOST_TEST(*iter == val);
32     return boost::report_errors();
33 }
34 
35 #endif // GCC
36 
37