[PATCH] D126159: [ADT] Add edit_distance_insensitive to StringRef

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 13:46:59 PDT 2022


dblaikie accepted this revision.
dblaikie added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/include/llvm/ADT/edit_distance.h:81
     unsigned Previous = y - 1;
+    decltype(Map(FromArray[y - 1])) CurItem = Map(FromArray[y - 1]);
     for (typename ArrayRef<T>::size_type x = 1; x <= n; ++x) {
----------------
I'm not sure this amounts to anything different than using `auto`?

But if the intent was to allow reference types here - maybe this could rely on reference lifetime extension?
```
const auto &CurItem = ...
```
If the map function returns by value, this'll do reference lifetime extension, and if it returns by reference it'll be a reference.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126159



More information about the llvm-commits mailing list