From dd00b99c454768c511b33078171261eefaf658e4 Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Sun, 28 Jun 2020 13:50:26 -0700 Subject: [PATCH] Restoring BOOST_LEAF_AUTO, keeping BOOST_LEAF_VAR --- benchmark/benchmark.md | 10 +- benchmark/deep_stack_leaf.cpp | 2 +- doc/leaf.adoc | 24 ++-- examples/asio_beast_leaf_rpc.cpp | 18 +-- examples/capture_in_result.cpp | 2 +- examples/exception_to_result.cpp | 2 +- examples/lua_callback_result.cpp | 2 +- .../print_file/print_file_outcome_result.cpp | 6 +- examples/print_file/print_file_result.cpp | 6 +- .../print_file_result_error_tags.cpp | 6 +- examples/print_half.cpp | 4 +- include/boost/leaf/all.hpp | 2 + include/boost/leaf/error.hpp | 2 + test/handle_all_test.cpp | 40 +++---- test/handle_basic_test.cpp | 6 +- test/handle_some_test.cpp | 104 +++++++++--------- 16 files changed, 120 insertions(+), 116 deletions(-) diff --git a/benchmark/benchmark.md b/benchmark/benchmark.md index 3a478e6..865104c 100644 --- a/benchmark/benchmark.md +++ b/benchmark/benchmark.md @@ -37,7 +37,7 @@ The most common check-only use case looks almost identically in LEAF and in Boos ```c++ // LEAF { - BOOST_LEAF_VAR(auto v, f()); // Check for errors, forward failures to the caller + BOOST_LEAF_AUTO(v, f()); // Check for errors, forward failures to the caller // If control reaches here, v is the successful result (the call succeeded). } ``` @@ -74,7 +74,7 @@ leaf::try_handle_all []() -> leaf::result { - BOOST_LEAF_VAR(auto v, f()); + BOOST_LEAF_AUTO(v, f()); // No error, use v }, @@ -142,7 +142,7 @@ leaf::result f(); leaf::result g() { - BOOST_LEAF_VAR(auto x, f()); + BOOST_LEAF_AUTO(x, f()); return x+1; } ``` @@ -207,7 +207,7 @@ leaf::result f() leaf::result g() { - BOOST_LEAF_VAR(auto x, f()); + BOOST_LEAF_AUTO(x, f()); return x+1; } ``` @@ -235,7 +235,7 @@ leaf::result f() leaf::result g() { - BOOST_LEAF_VAR(auto x, f()); + BOOST_LEAF_AUTO(x, f()); return x+1; } ``` diff --git a/benchmark/deep_stack_leaf.cpp b/benchmark/deep_stack_leaf.cpp index 19aa882..a96c8e7 100644 --- a/benchmark/deep_stack_leaf.cpp +++ b/benchmark/deep_stack_leaf.cpp @@ -169,7 +169,7 @@ struct benchmark NOINLINE static select_result_t f( int failure_rate ) noexcept { - BOOST_LEAF_VAR(auto x, (benchmark::f(failure_rate))); + BOOST_LEAF_AUTO(x, (benchmark::f(failure_rate))); return x+1; } }; diff --git a/doc/leaf.adoc b/doc/leaf.adoc index ed0bce2..17899b2 100644 --- a/doc/leaf.adoc +++ b/doc/leaf.adoc @@ -231,13 +231,13 @@ int main( int argc, char const * argv[] ) [&]() -> leaf::result <1> { - BOOST_LEAF_VAR(auto file_name, parse_command_line(argc,argv)); <2> + BOOST_LEAF_AUTO(file_name, parse_command_line(argc,argv)); <2> auto load = leaf::on_error( leaf::e_file_name{file_name} ); <3> - BOOST_LEAF_VAR(auto f, file_open(file_name)); <4> + BOOST_LEAF_AUTO(f, file_open(file_name)); <4> - BOOST_LEAF_VAR(auto s, file_size(*f)); <4> + BOOST_LEAF_AUTO(s, file_size(*f)); <4> std::string buffer( 1 + s, '\0' ); BOOST_LEAF_CHECK(file_read(*f, &buffer[0], buffer.size()-1)); <4> @@ -849,7 +849,7 @@ return leaf::try_handle_some( [&]() -> leaf::result { - BOOST_LEAF_VAR(auto r, fut.get()); + BOOST_LEAF_AUTO(r, fut.get()); //Success! return { } }, @@ -1228,7 +1228,7 @@ Here is a simple function which prints successfully computed answers, forwarding ---- leaf::result print_answer() noexcept { - BOOST_LEAF_VAR(auto answer, compute_answer()); + BOOST_LEAF_AUTO(answer, compute_answer()); std::cout << "Answer: " << answer << std::endl; return { }; } @@ -1394,7 +1394,7 @@ int main() noexcept [&]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, call_lua(&*L)); + BOOST_LEAF_AUTO(answer, call_lua(&*L)); std::cout << "do_work succeeded, answer=" << answer << '\n'; <1> return { }; }, @@ -2525,7 +2525,7 @@ return leaf::try_handle_some( [] -> leaf::result { - BOOST_LEAF_VAR(auto answer, compute_answer()); + BOOST_LEAF_AUTO(answer, compute_answer()); //Use answer .... return { }; @@ -4298,8 +4298,8 @@ leaf::result compute_value(); leaf::result add_values() { - BOOST_LEAF_VAR(auto v1, compute_value()); <1> - BOOST_LEAF_VAR(auto v2, compute_value()); <2> + BOOST_LEAF_AUTO(v1, compute_value()); <1> + BOOST_LEAF_AUTO(v2, compute_value()); <2> return v1 + v2; } ---- @@ -4527,7 +4527,7 @@ return leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto r, process_file()); //In case of errors, error objects are stored inside the try_handle_some scope + BOOST_LEAF_AUTO(r, process_file()); //In case of errors, error objects are stored inside the try_handle_some scope //Success, use r: .... @@ -4704,8 +4704,8 @@ leaf::result parse_line( std::string const & line ); leaf::result read_and_parse_line( reader & r ) { - BOOST_LEAF_VAR(auto line, read_line(r)); <1> - BOOST_LEAF_VAR(auto parsed, parse_line(line)); <2> + BOOST_LEAF_AUTO(line, read_line(r)); <1> + BOOST_LEAF_AUTO(parsed, parse_line(line)); <2> return parsed; } ---- diff --git a/examples/asio_beast_leaf_rpc.cpp b/examples/asio_beast_leaf_rpc.cpp index 50f45d4..b78db2d 100644 --- a/examples/asio_beast_leaf_rpc.cpp +++ b/examples/asio_beast_leaf_rpc.cpp @@ -318,7 +318,7 @@ leaf::result execute_command(std::string_view line) { } else if (command == "sum") { std::int64_t sum = 0; for (auto const &w : words) { - BOOST_LEAF_VAR(auto i, parse_int64(w)); + BOOST_LEAF_AUTO(i, parse_int64(w)); sum += i; } response = std::to_string(sum); @@ -326,17 +326,17 @@ leaf::result execute_command(std::string_view line) { if (words.size() < 2) { return leaf::new_error(e_unexpected_arg_count{words.size(), 2, SIZE_MAX}); } - BOOST_LEAF_VAR(auto sub, parse_int64(words.front())); + BOOST_LEAF_AUTO(sub, parse_int64(words.front())); words.pop_front(); for (auto const &w : words) { - BOOST_LEAF_VAR(auto i, parse_int64(w)); + BOOST_LEAF_AUTO(i, parse_int64(w)); sub -= i; } response = std::to_string(sub); } else if (command == "mul") { std::int64_t mul = 1; for (auto const &w : words) { - BOOST_LEAF_VAR(auto i, parse_int64(w)); + BOOST_LEAF_AUTO(i, parse_int64(w)); mul *= i; } response = std::to_string(mul); @@ -344,10 +344,10 @@ leaf::result execute_command(std::string_view line) { if (words.size() < 2) { return leaf::new_error(e_unexpected_arg_count{words.size(), 2, SIZE_MAX}); } - BOOST_LEAF_VAR(auto div, parse_int64(words.front())); + BOOST_LEAF_AUTO(div, parse_int64(words.front())); words.pop_front(); for (auto const &w : words) { - BOOST_LEAF_VAR(auto i, parse_int64(w)); + BOOST_LEAF_AUTO(i, parse_int64(w)); if (i == 0) { // In some cases this command execution function might throw, not just return an error. throw std::runtime_error{"division by zero"}; @@ -359,9 +359,9 @@ leaf::result execute_command(std::string_view line) { if (words.size() != 2) { return leaf::new_error(e_unexpected_arg_count{words.size(), 2, 2}); } - BOOST_LEAF_VAR(auto i1, parse_int64(words.front())); + BOOST_LEAF_AUTO(i1, parse_int64(words.front())); words.pop_front(); - BOOST_LEAF_VAR(auto i2, parse_int64(words.front())); + BOOST_LEAF_AUTO(i2, parse_int64(words.front())); words.pop_front(); if (i2 == 0) { // In some cases this command execution function might throw, not just return an error. @@ -404,7 +404,7 @@ response_t handle_request(request_t &&request) { return leaf::new_error(e_unexpected_http_method{http::verb::post}, e_http_status{http::status::bad_request}); } - BOOST_LEAF_VAR(auto response, execute_command(request.body())); + BOOST_LEAF_AUTO(response, execute_command(request.body())); return std::make_pair(http::status::ok, std::move(response)); }, // For the `error_quit` command and associated error condition we have the error handler itself fail diff --git a/examples/capture_in_result.cpp b/examples/capture_in_result.cpp index 6fbb18b..8291988 100644 --- a/examples/capture_in_result.cpp +++ b/examples/capture_in_result.cpp @@ -87,7 +87,7 @@ int main() leaf::try_handle_all( [&]() -> leaf::result { - BOOST_LEAF_VAR(auto r,f.get()); + BOOST_LEAF_AUTO(r,f.get()); // Success! Use r to access task_result. std::cout << "Success!" << std::endl; diff --git a/examples/exception_to_result.cpp b/examples/exception_to_result.cpp index 55c1b53..fe751aa 100644 --- a/examples/exception_to_result.cpp +++ b/examples/exception_to_result.cpp @@ -51,7 +51,7 @@ leaf::result compute_answer() noexcept // Print the answer if the call to compute_answer is successful. leaf::result print_answer() noexcept { - BOOST_LEAF_VAR(auto answer, compute_answer()); + BOOST_LEAF_AUTO( answer, compute_answer()); std::cout << "Answer: " << answer << std::endl; return { }; } diff --git a/examples/lua_callback_result.cpp b/examples/lua_callback_result.cpp index 326e14b..ac8b71a 100644 --- a/examples/lua_callback_result.cpp +++ b/examples/lua_callback_result.cpp @@ -109,7 +109,7 @@ int main() [&]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, call_lua(&*L)); + BOOST_LEAF_AUTO(answer, call_lua(&*L)); std::cout << "do_work succeeded, answer=" << answer << '\n'; return { }; }, diff --git a/examples/print_file/print_file_outcome_result.cpp b/examples/print_file/print_file_outcome_result.cpp index ec5fc42..4cbe58f 100644 --- a/examples/print_file/print_file_outcome_result.cpp +++ b/examples/print_file/print_file_outcome_result.cpp @@ -65,13 +65,13 @@ int main( int argc, char const * argv[] ) [&]() -> result { - BOOST_LEAF_VAR(auto file_name, parse_command_line(argc,argv)); + BOOST_LEAF_AUTO(file_name, parse_command_line(argc,argv)); auto load = leaf::on_error( leaf::e_file_name{file_name} ); - BOOST_LEAF_VAR(auto f, file_open(file_name)); + BOOST_LEAF_AUTO(f, file_open(file_name)); - BOOST_LEAF_VAR(auto s, file_size(*f)); + BOOST_LEAF_AUTO(s, file_size(*f)); std::string buffer(1 + s, '\0'); BOOST_LEAF_CHECK(file_read(*f, &buffer[0], buffer.size()-1)); diff --git a/examples/print_file/print_file_result.cpp b/examples/print_file/print_file_result.cpp index c2c9b2c..ea46568 100644 --- a/examples/print_file/print_file_result.cpp +++ b/examples/print_file/print_file_result.cpp @@ -59,13 +59,13 @@ int main( int argc, char const * argv[] ) [&]() -> result { - BOOST_LEAF_VAR(auto file_name, parse_command_line(argc,argv)); + BOOST_LEAF_AUTO(file_name, parse_command_line(argc,argv)); auto load = leaf::on_error( leaf::e_file_name{file_name} ); - BOOST_LEAF_VAR(auto f, file_open(file_name)); + BOOST_LEAF_AUTO(f, file_open(file_name)); - BOOST_LEAF_VAR(auto s, file_size(*f)); + BOOST_LEAF_AUTO(s, file_size(*f)); std::string buffer(1 + s, '\0'); BOOST_LEAF_CHECK(file_read(*f, &buffer[0], buffer.size()-1)); diff --git a/examples/print_file/print_file_result_error_tags.cpp b/examples/print_file/print_file_result_error_tags.cpp index 456dd5b..4a0af22 100644 --- a/examples/print_file/print_file_result_error_tags.cpp +++ b/examples/print_file/print_file_result_error_tags.cpp @@ -57,13 +57,13 @@ int main( int argc, char const * argv[] ) [&]() -> result { - BOOST_LEAF_VAR(auto file_name, parse_command_line(argc,argv)); + BOOST_LEAF_AUTO(file_name, parse_command_line(argc,argv)); auto load = leaf::on_error( leaf::e_file_name{file_name} ); - BOOST_LEAF_VAR(auto f, file_open(file_name)); + BOOST_LEAF_AUTO(f, file_open(file_name)); - BOOST_LEAF_VAR(auto s, file_size(*f)); + BOOST_LEAF_AUTO(s, file_size(*f)); std::string buffer(1 + s, '\0'); BOOST_LEAF_CHECK(file_read(*f, &buffer[0], buffer.size()-1)); diff --git a/examples/print_half.cpp b/examples/print_half.cpp index 9aa1e23..9e01101 100644 --- a/examples/print_half.cpp +++ b/examples/print_half.cpp @@ -51,13 +51,13 @@ leaf::result print_half(const std::string& text) return leaf::try_handle_some( [&]() -> leaf::result { - BOOST_LEAF_VAR(auto r,convert(text)); + BOOST_LEAF_AUTO(r,convert(text)); std::cout << r / 2 << std::endl; return { }; }, [&]( leaf::match ) -> leaf::result { - BOOST_LEAF_VAR(auto i, BigInt::fromString(text)); + BOOST_LEAF_AUTO(i, BigInt::fromString(text)); std::cout << i.half() << std::endl; return { }; } ); diff --git a/include/boost/leaf/all.hpp b/include/boost/leaf/all.hpp index 97fed5f..c8db88a 100644 --- a/include/boost/leaf/all.hpp +++ b/include/boost/leaf/all.hpp @@ -1019,6 +1019,8 @@ namespace boost { namespace leaf { return BOOST_LEAF_TOKEN_PASTE2(boost_leaf_temp_, __LINE__).error();\ v = BOOST_LEAF_TOKEN_PASTE2(boost_leaf_temp_, __LINE__).value() +#define BOOST_LEAF_AUTO(v, r) BOOST_LEAF_VAR(auto && v, r) + #define BOOST_LEAF_CHECK(r)\ {\ static_assert(::boost::leaf::is_result_type::type>::value, "BOOST_LEAF_CHECK requires a result type");\ diff --git a/include/boost/leaf/error.hpp b/include/boost/leaf/error.hpp index 9bf9368..88f2f4e 100644 --- a/include/boost/leaf/error.hpp +++ b/include/boost/leaf/error.hpp @@ -52,6 +52,8 @@ return BOOST_LEAF_TOKEN_PASTE2(boost_leaf_temp_, __LINE__).error();\ v = BOOST_LEAF_TOKEN_PASTE2(boost_leaf_temp_, __LINE__).value() +#define BOOST_LEAF_AUTO(v, r) BOOST_LEAF_VAR(auto && v, r) + #define BOOST_LEAF_CHECK(r)\ {\ static_assert(::boost::leaf::is_result_type::type>::value, "BOOST_LEAF_CHECK requires a result type");\ diff --git a/test/handle_all_test.cpp b/test/handle_all_test.cpp index b734f46..6f9f128 100644 --- a/test/handle_all_test.cpp +++ b/test/handle_all_test.cpp @@ -54,7 +54,7 @@ int main() leaf::try_handle_all( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::ok)); + BOOST_LEAF_AUTO(answer, f(my_error_code::ok)); c = answer; return { }; }, @@ -72,7 +72,7 @@ int main() leaf::try_handle_all( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -98,7 +98,7 @@ int main() leaf::try_handle_all( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f_errc(errc_a::a0)); + BOOST_LEAF_AUTO(answer, f_errc(errc_a::a0)); c = answer; return { }; }, @@ -129,7 +129,7 @@ int main() leaf::try_handle_all( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f_errc_wrapped(errc_a::a0)); + BOOST_LEAF_AUTO(answer, f_errc_wrapped(errc_a::a0)); c = answer; return { }; }, @@ -160,7 +160,7 @@ int main() leaf::try_handle_all( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -191,7 +191,7 @@ int main() leaf::try_handle_all( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -222,7 +222,7 @@ int main() leaf::try_handle_all( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -251,7 +251,7 @@ int main() leaf::try_handle_all( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -282,7 +282,7 @@ int main() leaf::try_handle_all( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -311,7 +311,7 @@ int main() leaf::try_handle_all( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -343,7 +343,7 @@ int main() int r = leaf::try_handle_all( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::ok)); + BOOST_LEAF_AUTO(answer, f(my_error_code::ok)); return answer; }, [] @@ -358,7 +358,7 @@ int main() int r = leaf::try_handle_all( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( my_error_code ec, info<1> const & x, info<2> y ) @@ -380,7 +380,7 @@ int main() int r = leaf::try_handle_all( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f_errc(errc_a::a0)); + BOOST_LEAF_AUTO(answer, f_errc(errc_a::a0)); return answer; }, []( leaf::match, cond_x::x11> ) @@ -406,7 +406,7 @@ int main() int r = leaf::try_handle_all( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f_errc_wrapped(errc_a::a0)); + BOOST_LEAF_AUTO(answer, f_errc_wrapped(errc_a::a0)); return answer; }, []( leaf::match, cond_x::x11> ) @@ -432,7 +432,7 @@ int main() int r = leaf::try_handle_all( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -458,7 +458,7 @@ int main() int r = leaf::try_handle_all( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -484,7 +484,7 @@ int main() int r = leaf::try_handle_all( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -508,7 +508,7 @@ int main() int r = leaf::try_handle_all( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -534,7 +534,7 @@ int main() int r = leaf::try_handle_all( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -558,7 +558,7 @@ int main() int r = leaf::try_handle_all( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) diff --git a/test/handle_basic_test.cpp b/test/handle_basic_test.cpp index 56e5298..e8e0527 100644 --- a/test/handle_basic_test.cpp +++ b/test/handle_basic_test.cpp @@ -87,7 +87,7 @@ leaf::result handle_some_errors_void( int what_to_do ) return leaf::try_handle_some( [=]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, compute_answer(what_to_do)); + BOOST_LEAF_AUTO(answer, compute_answer(what_to_do)); (void) answer; return { }; }, @@ -178,7 +178,7 @@ int main() int r = leaf::try_handle_all( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer,handle_some_errors(3)); + BOOST_LEAF_AUTO(answer,handle_some_errors(3)); (void) answer; return 0; }, @@ -202,7 +202,7 @@ int main() int r = leaf::try_handle_all( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer,handle_some_errors_float(1)); + BOOST_LEAF_AUTO(answer,handle_some_errors_float(1)); (void) answer; return 0; }, diff --git a/test/handle_some_test.cpp b/test/handle_some_test.cpp index 2a103ca..0bc994e 100644 --- a/test/handle_some_test.cpp +++ b/test/handle_some_test.cpp @@ -54,7 +54,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::ok)); + BOOST_LEAF_AUTO(answer, f(my_error_code::ok)); c = answer; return { }; }, @@ -74,7 +74,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -96,7 +96,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f_errc(errc_a::a0)); + BOOST_LEAF_AUTO(answer, f_errc(errc_a::a0)); c = answer; return { }; }, @@ -118,7 +118,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f_errc_wrapped(errc_a::a0)); + BOOST_LEAF_AUTO(answer, f_errc_wrapped(errc_a::a0)); c = answer; return { }; }, @@ -140,7 +140,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -167,7 +167,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -194,7 +194,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -219,7 +219,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -246,7 +246,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -271,7 +271,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -301,7 +301,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -339,7 +339,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f_errc(errc_a::a0)); + BOOST_LEAF_AUTO(answer, f_errc(errc_a::a0)); c = answer; return { }; }, @@ -377,7 +377,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f_errc_wrapped(errc_a::a0)); + BOOST_LEAF_AUTO(answer, f_errc_wrapped(errc_a::a0)); c = answer; return { }; }, @@ -415,7 +415,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -453,7 +453,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -491,7 +491,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -527,7 +527,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -565,7 +565,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -601,7 +601,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -639,7 +639,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -677,7 +677,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f_errc(errc_a::a0)); + BOOST_LEAF_AUTO(answer, f_errc(errc_a::a0)); c = answer; return { }; }, @@ -715,7 +715,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f_errc_wrapped(errc_a::a0)); + BOOST_LEAF_AUTO(answer, f_errc_wrapped(errc_a::a0)); c = answer; return { }; }, @@ -752,7 +752,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -790,7 +790,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -828,7 +828,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -864,7 +864,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -902,7 +902,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -938,7 +938,7 @@ int main() leaf::result r = leaf::try_handle_some( [&c]() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); c = answer; return { }; }, @@ -974,7 +974,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::ok)); + BOOST_LEAF_AUTO(answer, f(my_error_code::ok)); return answer; }, []( leaf::error_info const & unmatched ) @@ -989,7 +989,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( my_error_code ec, info<1> const & x, info<2> y ) @@ -1008,7 +1008,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f_errc(errc_a::a0)); + BOOST_LEAF_AUTO(answer, f_errc(errc_a::a0)); return answer; }, []( leaf::match, cond_x::x11> ) @@ -1031,7 +1031,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -1054,7 +1054,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -1077,7 +1077,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -1098,7 +1098,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -1121,7 +1121,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -1142,7 +1142,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -1168,7 +1168,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( info<4> ) @@ -1200,7 +1200,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f_errc(errc_a::a0)); + BOOST_LEAF_AUTO(answer, f_errc(errc_a::a0)); return answer; }, []( leaf::match, cond_x::x11> ) @@ -1232,7 +1232,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -1264,7 +1264,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -1296,7 +1296,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -1326,7 +1326,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -1358,7 +1358,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -1388,7 +1388,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ) @@ -1420,7 +1420,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( my_error_code ec, info<1> const & x, info<2> y ) @@ -1452,7 +1452,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ec, info<1> const & x, info<2> y ) @@ -1484,7 +1484,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ec, info<1> const & x, info<2> y ) @@ -1516,7 +1516,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ec, info<1> const & x, info<2> y ) @@ -1546,7 +1546,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ec, info<1> const & x, info<2> y ) @@ -1578,7 +1578,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ec, info<1> const & x, info<2> y ) @@ -1608,7 +1608,7 @@ int main() leaf::result r = leaf::try_handle_some( []() -> leaf::result { - BOOST_LEAF_VAR(auto answer, f(my_error_code::error1)); + BOOST_LEAF_AUTO(answer, f(my_error_code::error1)); return answer; }, []( leaf::match ec, info<1> const & x, info<2> y )