Issue |
132763
|
Summary |
[clang-tidy] Check request: readability-use-std-mem-fn
|
Labels |
clang-tidy
|
Assignees |
|
Reporter |
denzor200
|
Needs a check that will find redundant usages of `std::bind` and suggest to change them to `std::mem_fn`.
Assume the stuct for two examples below:
```
struct Foo
{
void display_greeting() {}
void display_number(int i) {}
int add_xy(int x, int y) {}
template<typename... Args> int add_many(Args... args) {}
auto add_them(auto... args) {} // C++20 required
int data = ""
};
```
BEFORE:
```
std::bind(&Foo::display_greeting, _1);
std::bind(&Foo::display_number, _1, _2);
std::bind(&Foo::data, _1);
std::bind(&Foo::add_xy, _1, _2, _3);
std::bind(&Foo::add_many<short, int, long>, _1, _2, _3, _4);
std::bind(&Foo::add_them<short, int, float, double>, _1, _2, _3, _4, _5);
```
AFTER:
```
std::mem_fn(&Foo::display_greeting);
std::mem_fn(&Foo::display_number);
std::mem_fn(&Foo::data);
std::mem_fn(&Foo::add_xy);
std::mem_fn(&Foo::add_many<short, int, long>);
std::mem_fn(&Foo::add_them<short, int, float, double>);
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs