[PATCH] D36089: [ELF] - Replace parallelForEach with ranged form.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 31 23:56:57 PDT 2017


>> -template <class IterTy, class FuncTy>
>> -void parallelForEach(IterTy Begin, IterTy End, FuncTy Fn) {
>> +template <typename R, class FuncTy> auto parallelForEach(R &&Range, FuncTy Fn) {
>
>Why an r-value reference?
>
>Cheers,
>Rafael

I used LLVM algorithms like llvm::find_if, llvm::find as areference. 
They use r-value and I think they do that to support constructions like:
parallelForEach(std::vector<int>({1, 2, 3}), [](int) { ... });

I could probably use "const R &Range" for supporting above, 
but use of r-value is just consistent.
 
George.


More information about the llvm-commits mailing list