2017-06-01 13:53 GMT+02:00 Mathias Gaunard via Boost
Ok so the approach is to do
auto expected1 = do_statement1(); if (!expected1) return expected1; auto expected1_value = expected1.value();
auto expected2 = do_statement2(expected1_value); if (!expected2) return expected2; auto expected2_value = expected2.value();
return do_statement3(expected2_value);
with that logic being encoded by the TRY macros?
I'd rather use continuation passing style, was that considered?
return expected_flow(do_statement1)
[](auto const& expected1_value) { return do_statement2(expected1_value); } [](auto const& expected2_value) { return do_statement3(expected2_value); } ;
Does this solution scale to more complicated control flows? How would the following flow be represented by this style? ``` auto rslt1 = fun1(); RETURN_IF_FAILED(rslt1); auto rslt2 = fun2(); RETURN_IF_FAILED(rslt2); auto rslt3 = fun3(rslt2); RETURN_IF_FAILED(rslt3); return fun4(rslt1, rslt3) ``` Regards, &rzej;