Also have a look at do-expressions:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2806r3.html
They can (if accepted) also be combined with pattern-matching:
-----Ursprüngliche Nachricht-----
Von: Tymi via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Mi 14.05.2025 07:05
Betreff: [std-proposals] switch expression/matching switch expression
An: std-proposals@lists.isocpp.org;
CC: Tymi <tymi.cpp@gmail.com>;
A matching switch expression could be useful and could get optimised into a jump table```cppint meow = 5;int purr = switch(meow){case 5: 123;case 123: 321;default: throw nullptr;};```Whatever the syntax would be, this is just an example and it can definitely improveTymi.-- Std-Proposals mailing list Std-Proposals@lists.isocpp.org https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals