• 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 #ifdef BOOST_NO_CXX11_LAMBDAS
10 #   error "lambda functions required"
11 #else
12 
13 #include <boost/noncopyable.hpp>
14 #include <cassert>
15 
16 //[noncopyable_cxx11_lambda_error
17 struct n: boost::noncopyable {
18     int i;
nn19     n(int _i): i(_i) {}
20 };
21 
22 
main(void)23 int main(void) {
24     n x(-1);
25 
26     auto f = [x](void) {    // Error: x is non-copyable, but if
27         assert(x.i == -1);  // bind `&x` then `x` is not constant.
28     };
29     f();
30 
31     return 0;
32 }
33 //]
34 
35 #endif // LAMBDAS
36 
37