mirror of
https://github.com/boostorg/local_function.git
synced 2026-01-25 06:12:27 +00:00
Reworked all LocalFunction tests and examples to use Boost.Detail/LightweightTest (instead of Boost.Test) and test sequence syntax without variadic macros (..._nova tests).
[SVN r77747]
This commit is contained in:
35
example/noncopyable_cxx11_lambda_error.cpp
Normal file
35
example/noncopyable_cxx11_lambda_error.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
// Copyright (C) 2009-2012 Lorenzo Caminiti
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// (see accompanying file LICENSE_1_0.txt or a copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// Home at http://www.boost.org/libs/local_function
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_NO_LAMBDAS
|
||||
# error "lambda functions required"
|
||||
#else
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <cassert>
|
||||
|
||||
//[noncopyable_lambda_error
|
||||
struct n: boost::noncopyable {
|
||||
int i;
|
||||
n(int _i): i(_i) {}
|
||||
};
|
||||
|
||||
int main(void) {
|
||||
n x(-1);
|
||||
|
||||
auto f = [x](void) { // Error: x is non-copyable, but if
|
||||
assert(x.i == -1); // bind `&x` then `x` is not constant.
|
||||
};
|
||||
f();
|
||||
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
|
||||
#endif // LAMBDAS
|
||||
|
||||
Reference in New Issue
Block a user