Fix capturing in latch_tests

This commit is contained in:
Christian Mazakas
2023-04-25 13:41:36 -07:00
parent 0bc4f2c4b9
commit d7acb7e8b8

View File

@ -114,7 +114,7 @@ namespace {
void test_arrive_and_wait() void test_arrive_and_wait()
{ {
constexpr std::ptrdiff_t n = 16; std::ptrdiff_t const n = 16;
boost::latch l(2 * n); boost::latch l(2 * n);
@ -122,7 +122,8 @@ namespace {
std::vector<std::thread> threads; std::vector<std::thread> threads;
for (int i = 0; i < n; ++i) { for (int i = 0; i < n; ++i) {
threads.emplace_back([&l, &xs, i] { threads.emplace_back([&l, &xs, i, n] {
(void)n;
for (int j = 0; j < n; ++j) { for (int j = 0; j < n; ++j) {
BOOST_TEST_EQ(xs[j], 0); BOOST_TEST_EQ(xs[j], 0);
} }