Avoid double-move

This was flagged by coverity but doesn't seem to be an actual issue in
g++/clang.  It technically leaves the moved rvalue in a "valid but
undefined state", so it is best to avoid.  The single copy into an
lvalue is (I think) cheap
This commit is contained in:
Seth Hillbrand 2022-12-04 10:24:28 -08:00 committed by Marek Roszko
parent 33f75fbd0a
commit 4a9994931a
1 changed files with 2 additions and 1 deletions

View File

@ -405,8 +405,9 @@ public:
blocks blks(first_index, index_after_last, num_blocks ? num_blocks : thread_count);
if (blks.get_total_size() > 0)
{
F internal_loop = loop;
for (size_t i = 0; i < blks.get_num_blocks(); ++i)
push_task(std::forward<F>(loop), blks.start(i), blks.end(i));
push_task(std::forward<F>(internal_loop), blks.start(i), blks.end(i));
}
}