mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 04:24:43 +00:00
gdbsupport: use iterator range in parallel_for_each interface
I think it would be convenient for parallel_for_each to pass an iterator_range to the worker function, instead of separate begin and end parameters. This allows using a ranged for loop directly. Change-Id: I8f9681da65b0eb00b738379dfd2f4dc6fb1ee612 Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <tuple>
|
||||
#include "gdbsupport/iterator-range.h"
|
||||
#include "gdbsupport/thread-pool.h"
|
||||
|
||||
namespace gdb
|
||||
@@ -114,7 +115,7 @@ parallel_for_each (const RandomIt first, const RandomIt last,
|
||||
static_cast<size_t> (this_batch_first - first),
|
||||
static_cast<size_t> (this_batch_last - first));
|
||||
|
||||
worker (this_batch_first, this_batch_last);
|
||||
worker ({ this_batch_first, this_batch_last });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -138,7 +139,7 @@ sequential_for_each (RandomIt first, RandomIt last, WorkerArgs &&...worker_args)
|
||||
if (first == last)
|
||||
return;
|
||||
|
||||
Worker (std::forward<WorkerArgs> (worker_args)...) (first, last);
|
||||
Worker (std::forward<WorkerArgs> (worker_args)...) ({ first, last });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user