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

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 15:36:55 PDT 2017


David Blaikie <dblaikie at gmail.com> writes:

> If "const T&" is used, then users can't pass mutable data - which seems
> like a reasonable thing users of a parallel API might want (I want to do a
> parellel mutation of data - like if I have a vector of vectors and want to
> reduce the subvectors in some way - replace them with a single-element
> vector containing the sum of the elements of the original vector)
>
> If "T" is used, then they can mutate data, but would've had to copy it
> first, which probably defeats the point (since then the side effects get
> thrown away at the end)
>
> But sure - if you want to restrict the use of the API to non-mutating cases
> for now, it's your/LLD's code. But it seems like a reasonable
> implementation to use T&& thus allowing mutation or non-mutation (same as a
> normal for loop, or std::for_each, etc) without waiting for the specific
> use case.

No, it is perfectly reasonable to allow mutations.

So LGTM with &&.

Thanks,
Rafael


More information about the llvm-commits mailing list