https://en.cppreference.com/w/cpp/language/lambda
◆ lambda_14()
static void lambda_14 |
( |
| ) |
|
|
static |
Definition at line 163 of file 14.cpp.
167 static_assert(__cpp_generic_lambdas);
168 auto generic_lambda = [](
auto x) {
return x; };
170 auto universal_size = [](
const auto& m) {
return m.size(); };
172 static_assert(__cpp_init_captures);
173 auto capture_initializers = [value = 1] {
return value; };
175 assert(capture_initializers() == 1);
177 auto mutable_lambda = [value = 1] ()
mutable {
return ++value; };
179 assert(mutable_lambda() == 2);
180 assert(mutable_lambda() == 3);
184 auto change_c = [value = ++c] { };
187 unique_ptr<int> ptr(
new int(10));
188 auto capture_by_move = [value = move(ptr)] {
return *value; };
◆ sort_14()
Compare with lambda::sort_11.
Definition at line 193 of file 14.cpp.
195 array<int, 10> s = {5, 7, 4, 2, 8, 6, 1, 9, 0, 3};
196 sort(s.begin(), s.end(),