[PATCH] D93851: [RISCV] Rewrite and simplify helper function. NFC.

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 28 11:10:57 PST 2020


frasercrmck added a comment.

In D93851#2472839 <https://reviews.llvm.org/D93851#2472839>, @luismarques wrote:

> (Now, that C++ has lambdas, etc, I wonder if using a standard find algorithm would be even simpler/cleaner?)

I played around with it but couldn't find a use of `find_if` which worked with `enumerate` that I was happier with. You still have to grab iterators, check against `end` and deref to return the index so imho it's not much clearer to read. Plus I got a bit scared about whether `enumerate` is to be stable when called twice on the same range: once for `find_if` and once for `end`..


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93851/new/

https://reviews.llvm.org/D93851



More information about the llvm-commits mailing list