-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lambda parameters instead of id variables #68
Comments
@BowenFu If that isn't possible i propose to add an special match for variants that works as syntactic sugar for visit, with functionality similar to the "overloaded" type defined here : https://en.cppreference.com/w/cpp/utility/variant/visit |
@GunpowderGuy Will this meet your requirements? match(x)(
visit<std::string>(
[](const std::string& text) {
std::cout << "Text message: " << text << std::endl;
}),
visit<int32_t>(
[](const int32_t num) {
std::cout << "Number: " << num << std::endl;
})
); Note: We need to store the value instead ref in match(x)(
visit<std::string>(
[](const std::string& text) {
std::cout << "Text message: " << text << std::endl;
}) = []{},
visit<int32_t>(
[](const int32_t num) {
std::cout << "Number: " << num << std::endl;
}) = []{}
); |
The memory issue has been fixed. |
Could having to use id variables be replaced with lambda parameters?
eg: instead of this
this
The text was updated successfully, but these errors were encountered: