]>
Commit | Line | Data |
---|---|---|
1 | // Copyright (c) 2018-2020 Emil Dotchevski and Reverge Studios, Inc. | |
2 | ||
3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
5 | ||
6 | #include <boost/leaf/handle_errors.hpp> | |
7 | #include <boost/leaf/pred.hpp> | |
8 | #include <boost/leaf/result.hpp> | |
9 | ||
10 | namespace leaf = boost::leaf; | |
11 | ||
12 | int main() | |
13 | { | |
14 | return leaf::try_handle_all( | |
15 | []() -> leaf::result<int> | |
16 | { | |
17 | return 0; | |
18 | }, | |
19 | []( leaf::catch_<int> & ) // leaf::catch_<> must be taken by value | |
20 | { | |
21 | return 1; | |
22 | }, | |
23 | [] | |
24 | { | |
25 | return 2; | |
26 | }); | |
27 | return 0; | |
28 | } |