Issue 126987
Summary [clang-tidy] Check request: readability-avoid-enable-if
Labels clang-tidy
Assignees
Reporter denzor200
    
Needs a check that will find redundant usage of `std::enable_if` and will suggest more simplified overloading without SFINAE at all.
For example, in 90% usages of `std::is_same` type trait in a cooperation with `std::enable_if` we don't really want it.

Look at the sample below...
```
template<typename T>
std::enable_if<std::is_same<T, int>::value>::type process(T value) {
 // int's implementation..
}

template<typename T>
std::enable_if<!std::is_same<T, int>::value>::type process(const T& value) {
    // generic implementation..
}
```

...which might be changed to:
```
void process(int value) {
    // int's implementation..
}

template<typename T>
void process(const T& value) {
 // generic implementation..
}
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to