[PATCH] D36089: [ELF] - Replace parallelForEach with ranged form.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 2 02:39:21 PDT 2017
>I suppose for a range algorithm (as opposed to a range adapter) you probably just need to take by T & (and T will be deduced to const U if needed).
Thanks David !
I would suggest to use next signature for parallelForEach in LLD then:
template <typename R, class FuncTy> void parallelForEach(const R &Range, FuncTy Fn)
Because without `const` for `Range` next call would report warnings:
parallelForEach(std::vector<int>({ 1, 2 }), [](int) {});
warning C4239: nonstandard extension used: 'argument': conversion from 'std::vector<int,std::allocator<int>>' to 'std::vector<int,std::allocator<int>> &'
note: A non-const reference may only be bound to an lvalue.
I know we do not use such calls in LLD, but if one day LLVM's algorithms be changed from && to &,
I think it worth to use const fo them and therefore for LLD algorithms too.
George.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170802/125ac227/attachment.html>
More information about the llvm-commits
mailing list