C++ Logo

std-proposals

Advanced search

Re: [std-proposals] escaping nested scopes : __escape

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Fri, 19 May 2023 10:26:34 +0200
Relatedly there is also a proposal active https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2806r1.html introducing scoped do expressions with a specific do return to leave their scope. Example from the paper: auto a = do { if (cond) { do return 1; } else { do return 2; } }; This would give another option for escaping nested scopes. -----Urspr√ľngliche Nachricht----- Von:Sebastian Wittmeier <wittmeier_at_[hidden]> Gesendet:Mo 01.05.2023 16:10 Betreff:AW: [std-proposals] escaping nested scopes : __escape An:std-proposals_at_[hidden]; You can use a lambda at the appropriate position instead. [&] { for (int i = 0; i < x: i++) { for (int j = 0; j < y; j++) { for (int k = 0; k < z; k++) { if (something) return; } } } }();

Received on 2023-05-19 08:26:37