[PATCH] D126159: [ADT] Add edit_distance_insensitive to StringRef
Nathan James via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 3 16:40:17 PDT 2022
njames93 added inline comments.
================
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) {
----------------
dblaikie wrote:
> 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.
Reference lifetime extension is exactly what I needed, just one of those cases I always forget about
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