Last active
September 3, 2021 02:49
-
-
Save yipo/c5cacecccaefe6dc6413a3961be792f9 to your computer and use it in GitHub Desktop.
Omit unused parameters of lambda.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <functional> | |
#include <string> | |
void test(std::function<int(const std::string & a, const std::string & b, const std::string & c)> func) | |
{ | |
func({}, {}, {}); | |
} | |
int main() | |
{ | |
test([](const std::string & a, const std::string & b, const std::string & c) | |
{ | |
return 0; | |
}); | |
test([](auto, auto, auto) | |
{ | |
return 0; | |
}); | |
test([](auto...) | |
{ | |
return 0; | |
}); | |
test([](...) | |
{ | |
return 0; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment