Issue 174351
Summary [clang-tidy] Add `modernize-use-std-next` check
Labels enhancement, clang-tidy, check-request
Assignees
Reporter zeyi2
    It would be useful if `clang-tidy` can replace binary operator + (and optionally -) between an iterator and an integer with std::next (and std::prev).

Some examples:

```c++
// before
auto it = vec.begin();
auto next_it = it + 2;

// after
auto it = vec.begin();
auto next_it = std::next(it, 2);
```

```c++
// before
auto it = vec.begin() + 5;

// after
auto it = std::next(vec.begin(), 5);
```

```c++
// before
auto prev_it = it - 1;

// after
auto prev_it = std::prev(it);
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to