[clang-tools-extra] [clang-tidy] Add modernize-use-span-first-last check (PR #118074)

Carlos Galvez via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 29 01:31:18 PST 2024


carlosgalvezp wrote:

```cpp
auto sub2 = s.subspan(n);        // transforms to: auto sub2 = s.last(s.size() - n);
```

IMHO the transformed code is less readable. It would be more useful to do the opposite transformation, maybe that's what you intended?

```cpp
auto sub2 = s.subspan(s.size() - n);        // transforms to: auto sub2 = s.last(n);
```

https://github.com/llvm/llvm-project/pull/118074


More information about the cfe-commits mailing list