-
Notifications
You must be signed in to change notification settings - Fork 78
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
Case macro using C++17 structured bindings. #76
Comments
(and I guess this is off-topic from the issue title, but addresses the same problem of binding references) Alternatively, an |
Regarding the 2nd note: there were other attempts at using lambdas for pattern matching of which I was aware at the time, but decided not to go that direction. Main reason - lambdas are still functions and you get control inversion with them. When I put return inside Case statement I would like to be returning from the function I'm in, not a callback used for syntactic purposes. I also saw performance numbers of those attempts at the time and it was a definite no go in comparison to the performance the current switch gives you. Regarding structured bindings - yes, i'm planning to exploit them, just didn't have time to play around with options. Structured bindings were inspired by this library among other things :) |
Forgot to mention in the previous post. If you don't particularly care about performance, you might want to look at Simple, Extensible C++ Pattern Matching Library - it uses lambdas for syntactic sugar and doesn't use any macros AFAIK. The author had presentation at CppCon 2015 I believe, you might want to check his talk for details. |
Discussion in #67 and https://github.com/solodon4/Mach7/blob/master/code/test/unit/example04-smart-ptr.cpp notes that binding a reference from a smart pointer is unwieldy due to poor language support for proxies.
It seems that being able to unpack directly into the target variables via structured bindings would make for a much cleaner solution.
Are there any major hurdles in the existing implementation to doing this?
The text was updated successfully, but these errors were encountered: