2 // Copyright 2018 Mateusz Loskot <mateusz at loskot dot net>
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 #include <boost/gil/algorithm.hpp>
9 #include <boost/gil/image.hpp>
11 #include <boost/core/lightweight_test.hpp>
13 namespace gil = boost::gil;
15 void test_lambda_expression()
17 gil::gray8_pixel_t const gray128(128);
18 gil::gray8_image_t image(2, 2, gray128);
21 gil::for_each_pixel(gil::view(image), [&sum](gil::gray8_pixel_t& p) {
22 sum += gil::at_c<0>(p);
24 BOOST_TEST(sum == 2 * 2 * 128);
29 test_lambda_expression();
31 return boost::report_errors();