<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/146086>146086</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] feature request: modernize-use-range should include swap
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
justusranvier
</td>
</tr>
</table>
<pre>
Part of modernizing a project to use ranges includes replacing uses of `std::swap` or instances of the ["std 2-step"](https://stackoverflow.com/a/68516678) pattern with calls to `std::ranges::swap`.
Example:
```
std::swap(a, b);
```
or
```
using std::swap;
swap(a, b);
```
can both be replaced with:
```
std::ranges::swap(a, b);
```
In the latter case an unqualified call to `swap` should only be flagged if `using std::swap;` is present in the same scope before the call.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEU81u2zwQfBrqsrBBUT-2DzooXz4DvfUVVuJKYkqTCpd0mj59IVlp4wZtAAGCxJ3dmVkOMpvRETWiehDVY4YpTj40T4lj4oDuaihkndevzVcMEfwAF68pOPPDuBEQ5uCfqI8QPSQmCOhGYjCut0kTQ6DZYr-UJiZe4KKWHLUoWlG0_IKzqCX4AMZxRNffauJEsPBRiqMGteNIs1BKVI9CHacYZ17w6izUmSP23_yVwmD9y773F6HOKNS5PlZ5XR-OQp1gxhgpOHgxcYIereWF7nsiN9p3pPZCtkK2_3_Hy2xpOVq_RS23R7b3OtQRhfoPOqFOonj4o9SHj_DEiy_3TVbg5-2EbHt00Pk4QUeby6RXhf-m-kHpZ3O-uHUddvUQemQCdJDcc0JrBkN6dfTN0G2hPPlkNXhnXxd-g8VxJA1mXf9fdNcSDMMciMlFMLexjBcC7v1M0NHgA61_l4n7TDeFPhUnzKjJD1Uui7KUKpuaSpaFPGrKscP8lCMOBXWyO_TVQWscqsw0SqpK1uqQl6ou8z2qrstLVdaUH7EuK1FKuqCxe2uvl70PY2aYEzV5WctjnVnsyHJzu6G9RTfuotGvtxuahWZB7bo0siilNRz5d59ool2z9g5WPcJAGFNYFvmciKMo2l8xo11i2q1re7N1SxcszmUp2OY-EqOJU-q2LCyTt9duy6pQ51UOC3XeFF0b9TMAAP__NBI_ag">