<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/121295>121295</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] Check request: modernize-use-ctad-to-construct-heterogenous-containers
</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>
C++17 suggests us a way to invoke templated class constructor without explicit template arguments specification.
Without that feature we had to use special wrappers like `std::make_pair` and `std::make_tuple`, so we don't want them anymore(except the case when `std::reference_wrapper` passed).
```
extern int a;
extern int b;
auto t1 = std::make_tuple(a, b); // INCORRECT
auto t2 = std::tuple{a, b}; // OK
auto p1 = std::make_pair(a, b); // INCORRECT
auto p2 = std::pair{a, b}; // OK
auto t3 = std::make_tuple(std::ref(a), b); // OK because of `std::reference_wrapper`
auto p3 = std::make_pair(std::cref(a), b); // OK the same reason
```
Bear in mind that this check should not work with generic types, because it's impossible to know is that types are reference wrappers:
```
template<typename T>
void process(T a, int b) {
auto p1 = std::make_pair(a, b); // OK
auto p2 = std::make_pair(static_cast<int>(a), b); // INCORRECT, should be changed to `std::pair{static_cast<int>(a), b}`
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVU2L40gM_TWVi0hjlx27ffAhHxNYFnZgGNhjUy4rdm3sKm9J7nTm1y_leNJJT_c0bDAElOjpPenJUkSmsYilWG3EardQI7fOlzXaH87LKFpUrj6XIlpvhdwIuYlzoLFpkJhgJFBwUmdgB8Y-uyMCYz90irEG3Ski0M4S-1Gz83Ay3LqRAV-GzmjD1z-D8s3Yo2UCGlCbg9GKjbMPIlr_PSdxqxgOqHj0CCeEVtWh7Eh4yVEdnLwaBvQEnTkiiCwirkWyFsm6V0d8GpTxIotA2frXH3kcOhRZJOQWyIUCtbNC5gwnZUN17EHZc-88CvmILxqHKQpaEcKp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