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
8 #include <boost/config.hpp>
9 #ifdef BOOST_NO_CXX11_LAMBDAS
10 # error "lambda functions required"
16 //[expensive_copy_cxx11_lambda
20 n(n const& x): i(x.i) { // Some time consuming copy operation.
21 for (unsigned i = 0; i < 10000; ++i) std::cout << '.';
29 auto f = [x]() { // Problem: Expensive copy, but if bind
30 assert(x.i == -1); // by `&x` then `x` is not constant.