<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/141252>141252</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] Check request: readability-use-std-clamp
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
denzor200
</td>
</tr>
</table>
<pre>
Needs a check that will do all the same as "readability-use-std-min-max" but for `std::clamp` instead of `std::min` or `std::max`.
BEFORE:
```
void foo() {
int a = 2, b = 3, c = 4;
if (a < b)
a = b;
if (a > c)
a = c;
}
```
AFTER:
```
void foo() {
int a = 2, b = 3, c = 4;
a = std::clamp(a, b, c);
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysks2umz4QxZ9m2IyIzJjPhRfkg-X_L131BWxsgluDU2zSpk9fwY3UNr3LSkiMPL8zPh4dGYK9zsYIKI5QnBO5xtEvQpv5h1-IsUR5_RD_GaMDSuxH03_BOMqI36xzqD1K5zCOBoOcDMqAQLQYqaWyzsZHugaThqjTyc7pJL8DEao14uAXhJKFqIG3wNveyekGJUM7h2ikRj_80Z_svHVfVNvAkh2AtcDa46X7_-2yNVgLJXt-rL17q3HwHqgGahCqI7AW0c4RJQI_IwGdUO0l38p-L3PgT3BAoHpDT6iAmv0Qn1r1N3XB_pXq3ymozi_egLVt9-ny9u9dv0Mv-6Va7qqd30x-ZCvRguuGNzIxIqvymmV1URTJKHjGqSkGJfMqI1bxqh5KziTxqtaqH6rECmJUsIJ4VubEi0NZl3wouWnqnPFcasiZmaR1B-fu08Ev18SGsBqR5RkVlDipjAt7Eol6J-drGq1-ANGWzEVsqlSt1wA5czbE8GtOtNHtGf5NVpzxtOd1MV9XEyLwFj-K5r6bZF2cGGO8hW1h1AF1VxvHVR16PwF1203PX3pb_GfTR6Butx-AuucL7oJ-BgAA__9ozez9">